clangllvmcarbon-lang

Why is clang/llvm throwing me this error using Bazel while building carbon


So I am trying to build carbon-lang i have done everything, installed clang/llvm it works fine but when I run the command bazel run //explorer -- ./explorer/testdata/print/format_only.carbon it gives me this error I have googled but cannot find the solution to this error:

[bret@archxbret carbon-lang]$ bazel run //explorer -- ./explorer/testdata/print/format_only.carbon 
Starting local Bazel server and connecting to it... 
INFO: Invocation ID: 6fb0bb2c-cc78-4fb0-8e35-90759b75109d 
INFO: Analyzed target //explorer:explorer (67 packages loaded, 1567 targets configured). 
INFO: Found 1 target... 
ERROR: /home/bret/.cache/bazel/_bazel_bret/e6835bf0f6859c4bbbb42f026d02cce5/external/m4_v1.4.18/bin/BUILD. bazel:2:10: Linking external/m4_v1.4.18/bin/m4 (for host] failed: (Exit 1): 
clang++ failed: error executing command /us r/bin/clang++ Obazel-out/host/bin/external/m4_v1.4.18/bin/m4-2.params

Jse --sandbox_debug to see verbose messages from the sandbox and retain the sandbox build root for debugging 
ld.lld: error: unable to find library -lc++ 
ld.lld: error: unable to find library -l:libunwind.a  
ld.lld: error: unable to find library -l:libunwind.a
clang++: error: linker command failed with exit code 1 (use -v to see invocation)
Target //explorer:explorer failed to build
Jse --verbose_failures to see the command lines of failed build steps. 
INFO: Elapsed time: 29.584s, Critical Path: 0.68s 
INFO: 2 processes: 2 internal. 
FAILED: Build did NOT complete successfully 
FAILED: Build did NOT complete successfully

I am using arch Linux any help is appreciated I have tried adding llvm to path but it doesn't seem to work. the llvm is in /usr/include/llvm but when I add it to my .bashrc and source it it shows up in when I echo $PATH but when I run the command which llvm it shows that no llvm found in the current added to PATH directories unlike when I run which clang it shows that it is found in /usr/bin but the command llvm-config --version works so I am not sure if it means that is already added to PATH or not. I am really lost here any help is appreciated. apologies in advance if I made an obvious mistake.


Solution

  • So after rigorously searching for a solution to this error it turns out that carbon has issues with system installed versions of clang and llvm and for now if you want carbon-lang to work you have to install llvm with homebrew.