I’m trying to build LLVM from scratch as I need 32 bit library support. I am using certain flags ( -fprofile-arc) that require libclang_rt.profile, specifically libclang_rt.profile-i386.a.
This is the error I encounter:
ld.lld: error: cannot open
/llvm_32/lib/clang/10.0.1/lib/linux/libclang_rt.profile-i386.a: No such file or directory
clang-10: error: linker command failed with exit code 1 (use -v to see invocation)
If you look at the directory of which it complains, there is nothing in there
Only file is directory to include, no lib directory whatsoever, meaning nothing is being built here…
I’m trying with llvm-project-10.0.1
cmake -DCMAKE_BUILD_TYPE=Release -DBENCHMARK_BUILD_32_BITS:BOOL=1 -DLLVM_BUILD_INSTRUMENTED=IR -DLLVM_ENABLE_PROJECTS=lld,clang,compiler-rt,clang-tools-extra,libclc -DLLVM_ENABLE_ZLIB:bool=0 -DLLVM_ENABLE_EH=ON -DLLVM_ENABLE_PIC=ON -DLLVM_ENABLE_RTTI=ON -DCOMPILER_RT_BUILD_BUILTINS=On -DCOMPILER_RT_USE_BUILTINS_LIBRARY=On -DCMAKE_INSTALL_PREFIX=…/…//llvm_32 …/
Any idea what I am doing wrong here?
ninja clang does not build some needed runtime libraries.
For -fprofile-arcs, `ninja profile`. To install it, `ninja install-profile`.
I’m still not following, if you could help me a bit more. I added ninja but seems to not have fixed anything.
This is what I did:
cmake -DCMAKE_BUILD_TYPE=Release -DBENCHMARK_BUILD_32_BITS:BOOL=1 -DLLVM_BUILD_INSTRUMENTED=IR -DLLVM_ENABLE_PROJECTS=lld,clang,compiler-rt,clang-tools-extra,libclc -DLLVM_ENABLE_ZLIB:bool=0 -G Ninja -DCMAKE_INSTALL_PREFIX=…/…/llvm_32 …/
It made no difference. I could not find ninja profile and ninja install-profile.
Thank you so much for your help!
Still no library files such as libclang_rt.profile
The -DLLVM_ENABLE_PROJECTS list needs to be `;` separated.
If the list has `compiler-rt`, you should get a build target called
`profile` which builds libclang_rt.profile-$arch.a
Thank you! I was totally building it wrong. I need to build llvm and clang first then feed the llvm-config into compiler-rt
As explained here: https://compiler-rt.llvm.org/
The initial errors I got led me astray to building this completely wrong. Thanks again!