[llvm-dev] Can't seem to build libclang_rt.profile

977 views
Skip to first unread message

ehsan fatehi via llvm-dev

unread,
Jan 15, 2021, 5:45:19 PM1/15/21
to llvm...@lists.llvm.org
Hello,


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
/nfs/proj/fast/user/efatehi/llvm_32/lib/clang/10.0.1/
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

llvm-project-10.0.1.tar.xz


Using:

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?

Thanks

Fangrui Song via llvm-dev

unread,
Jan 15, 2021, 8:59:59 PM1/15/21
to ehsan fatehi, llvm...@lists.llvm.org

ninja clang does not build some needed runtime libraries.
For -fprofile-arcs, `ninja profile`. To install it, `ninja install-profile`.
_______________________________________________
LLVM Developers mailing list
llvm...@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev

ehsan fatehi via llvm-dev

unread,
Jan 16, 2021, 2:27:01 PM1/16/21
to llvm...@lists.llvm.org
Hello Fangrui,

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 ../

ninja all
ninja install

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

Fāng-ruì Sòng via llvm-dev

unread,
Jan 16, 2021, 2:28:44 PM1/16/21
to ehsan fatehi, LLVM Developers Mailing List
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

> _______________________________________________
> LLVM Developers mailing list
> llvm...@lists.llvm.org
> https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev

--
宋方睿

ehsan fatehi via llvm-dev

unread,
Jan 16, 2021, 4:48:53 PM1/16/21
to LLVM Developers Mailing List
Thank you! I was totally building it wrong. I need to build llvm and clang first then feed the llvm-config into compiler-rt
-DLLVM_CONFIG_PATH=/path/to/llvm-config

As explained here: https://compiler-rt.llvm.org/

The initial errors I got led me astray to building this completely wrong. Thanks again!

Reply all
Reply to author
Forward
0 new messages