Open sertel opened 5 years ago
I finally found this post: https://groups.google.com/forum/#!searchin/bazel-discuss/cc_library$20includes%7Csort:date/bazel-discuss/lsbxZxNjJQw/NKb7f_eJBwAJ It suggests to set up a local repository:
WORKSPACE:
new_local_repository(
name = "llvm",
path = "/usr/lib/llvm-6.0/include",
build_file_content = """
package(default_visibility = ["//visibility:public"])
cc_library(
name = "headers",
hdrs = glob(["**/*.h"])
)
"""
)
BUILD:
package(default_visibility = ["//visibility:public"])
cc_binary(
name = "my-llvm-project",
srcs = glob(["*.cc"]),
copts = ["-Iexternal/llvm"],
deps = ["@llvm//:headers"]
)
I leave the issue open nevertheless because it would really be great to find this trivial use case on the documentation website. It would have been a great help for me.
I changed the title to highlight that this is really a knowledge transfer problem. PTAL.
Is creating a repository the generally accepted solution? Feels like there's still a documentation gap -- if not a knowledge gap here.
Thank you for contributing to the Bazel repository! This issue has been marked as stale since it has not had any activity in the last 1+ years. It will be closed in the next 90 days unless any other activity occurs. If you think this issue is still relevant and should stay open, please post any comment here and the issue will no longer be marked as stale.
Is there a documentation in the meantime ? It would be good if bazel would emit an actionable error message, i.e. have a link to an explanation and how to fix or work-around.
The more people start using systems that expose includes in content-hash-derived paths (such as NixOS), being able to direct bazel to accept system headers in in paths outside its sandboxed comfort-zone is important.
Bugs: what's the simplest, easiest way to reproduce this bug? Please provide a minimal example if possible.
I'm trying to configure a simple C++ project with the following BUILD:
The error is:
I also tried to use
includes
instead:Bazel says:
Even if I declare
llvm
as a library:I get the following error message:
If there is a preferred way of doing this in bazel then it should be in the docs.
What operating system are you running Bazel on?
Ubuntu LTS 18.04 (bionic) on the following kernel: Linux 4.4.0-17763-Microsoft (WSL)
What's the output of
bazel info release
?release 0.27.1
If
bazel info release
returns "development version" or "(@non-git)", tell us how you built Bazel.I used the binary installer as described here: https://docs.bazel.build/versions/master/install-ubuntu.html#install-with-installer-ubuntu
Have you found anything relevant by searching the web?
This issue might be related: https://github.com/bazelbuild/bazel/issues/3239