Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bazel build ERROR on ubuntu #21

Open
geonove opened this issue Jan 6, 2024 · 1 comment
Open

Bazel build ERROR on ubuntu #21

geonove opened this issue Jan 6, 2024 · 1 comment

Comments

@geonove
Copy link

geonove commented Jan 6, 2024

I am using Linux Ubuntu 22.04.3 LTS (WSL 2) on a windows 11 machine and I have python 3.10, numpy 1.26.3 and bazel 7.0.0 installed.
I modified the WORKSPACE script according to my path to python and numpy, which are respectively:
/usr/include/python3.10
/usr/local/lib/python3.10/dist-packages/numpy/core/

However, when I go in qcc/src/lib and try to build using bazel build all I got this error:

ERROR: /home/username/qcc/WORKSPACE:1:21: //external:third_party_python: invalid label '/home/username/qcc/python.BUILD' in attribute 'build_file' in 'new_local_repository' rule: invalid target name '/home/username/qcc/python.BUILD': target names may not start with '/'
ERROR: /home/username/qcc/WORKSPACE:8:21: //external:third_party_numpy: invalid label '/home/username/qcc/numpy.BUILD' in attribute 'build_file' in 'new_local_repository' rule: invalid target name '/home/username/qcc/numpy.BUILD': target names may not start with '/'
ERROR: Error computing the main repository mapping: Encountered error while reading extension file 'toolchains/jdk_build_file.bzl': no such package '@@rules_java_builtin//toolchains': error loading package 'external': Could not load //external package

SOLUTION

My solution was the following:

  • in the main folder qcc, create a folder called external:
  • move python.BUILD and numpy.BUILD from qcc to qcc/external
  • then modify the WORKSPACE script as follows:
new_local_repository(
    name = "third_party_python",
    build_file = "//external:python.BUILD",
    path = "/usr/include/python3.10",
)

new_local_repository(
    name = "third_party_numpy",
    build_file = "//external:numpy.BUILD",
    path = "/usr/local/lib/python3.10/dist-packages/numpy/core/",
)

This solved the issue for me.
Hope this was helpful, have a greate day :)

@hundt98847
Copy link
Contributor

hundt98847 commented Jan 6, 2024 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants