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

Add support for bazel-contrib/toolchains_llvm #26

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

scasagrande
Copy link
Contributor

@scasagrande scasagrande commented Aug 31, 2024

When using bazel-contrib/toolchains_llvm and specifying:

toolchains = {
    "cc_toolchain": "@bazel_tools//tools/cpp:current_cc_toolchain",
},

You end up with the following error:

Error in fail: toolchain target @bazel_tools//tools/cpp:current_cc_toolchain for 'cc_toolchain' has files from different repositories: external/toolchains_llvm~~llvm~llvm_toolchain_llvm, external/toolchains_llvm~~llvm~llvm_toolchain

However the second one actually just points back to the first:

❯ ls -la /private/var/tmp/_bazel_steven/d71d77490eeb3a6c5a6efc45dc1ed897/external/toolchains_llvm\~\~llvm\~llvm_toolchain/bin
total 16
drwxr-xr-x@ 14 steven  wheel   448 Aug 31 13:21 .
drwxr-xr-x@  7 steven  wheel   224 Aug 31 13:21 ..
-rwxr-xr-x@  1 steven  wheel  6516 Aug 31 13:21 cc_wrapper.sh
lrwxr-xr-x@  1 steven  wheel   128 Aug 31 13:21 clang-cpp -> /private/var/tmp/_bazel_steven/d71d77490eeb3a6c5a6efc45dc1ed897/external/toolchains_llvm~~llvm~llvm_toolchain_llvm/bin/clang-cpp
lrwxr-xr-x@  1 steven  wheel   125 Aug 31 13:21 ld.lld -> /private/var/tmp/_bazel_steven/d71d77490eeb3a6c5a6efc45dc1ed897/external/toolchains_llvm~~llvm~llvm_toolchain_llvm/bin/ld.lld
lrwxr-xr-x@  1 steven  wheel   138 Aug 31 13:21 libtool -> /private/var/tmp/_bazel_steven/d71d77490eeb3a6c5a6efc45dc1ed897/external/toolchains_llvm~~llvm~llvm_toolchain_llvm/bin/llvm-libtool-darwin
<trimmed>

My current implementation here is just to add a special case for toolchains_llvm, however I understand that's probably not ideal. I'm open to better ideas.

Then there is the question of testing. I can add toolchains_llvm to examples/ but we'll have to download a large pre-built llvm package as part of CI. Let me know what you'd like to see.

@fmeum
Copy link
Collaborator

fmeum commented Aug 31, 2024

Thanks for the detailed description of the problem!

I would like to take some time to think of a cleaner approach than hardcoding repos.

@scasagrande
Copy link
Contributor Author

Yeah, I don't like it either. Take your time, let me know if you come up with something.

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

Successfully merging this pull request may close these issues.

2 participants