Unable to build with Bazel on Linux
MarkShark99 opened this issue · comments
I'm trying to build fruit as a dependency for my project, but am seemingly unable to do so following the provided Bazel example due to the way the BUILD
files are symlinked. Downloading with strip_prefix
set to fruit-master/extras/bazel_root
leads to BUILD
being deleted, so the symlink under extras/bazel_root/third_party/fruit
doesn't point to a file anymore.
http_archive
doesn't seem to provide an option to dereference symlinks upon unzipping, so that's probably not an option.
My MODULE.bazel
:
http_archive(
name = "fruit",
urls = ["https://github.com/google/fruit/archive/refs/heads/master.tar.gz"],
integrity = "sha256-k42B09zN8zwp5x1vMxaJnvny9Tn71gyDmT6b1/EsUpQ=",
strip_prefix = "fruit-master",
)
Build command: bazel build @fruit//third_party/fruit
Hi, I committed a minor fix to https://github.com/google/fruit/blob/master/extras/bazel_usage_example/WORKSPACE now I checked that with that that example WORKSPACE works.
I also tried http_archive but that doesn't seem to work as you mentioned.
It's not clear to me how to make that work without either:
- Restructuring the repository so that all sources are under third_party/fruit (but I'd rather not do that, bazel is just 1 of the build systems I support)
- Changing the label references in BUILD files from //third_party/fruit/foo to //foo. I could do this I suppose but it would make it harder to import updates to the Fruit codebase in Google's codebase.
Does using git_repository work for you?
Or, do you have other suggestions on what I could do to improve this?
Thanks
git_repository
did work, so I would consider this resolved. I assume this is a problem with http_archive
and the way it's handling symlinks, I'll report this to the Bazel team.
Other than that I can't think of any suggestions, as long as this works I don't want to make any extra work for third_party maintainers. Thanks 🙂