[cfe-dev] Missing libclang_rt.* in self-built clang/llvm 3.8.0 ?

Vedant Kumar via cfe-dev cfe-dev at lists.llvm.org
Tue Mar 15 12:14:38 PDT 2016


You'll also need compiler-rt checked out in llvm/projects.

best,
vedant

> On Mar 15, 2016, at 10:40 AM, Paul Smith via cfe-dev <cfe-dev at lists.llvm.org> wrote:
> 
> Hi all; I'm building a local copy of Clang/LLVM 3.8.0 on my GNU/Linux
> system.  I also have built my own GCC 5.3.0 / binutils 2.26 (with gold)
> and I've configured clang to find that instance of GCC rather than the
> system GCC by using GCC_INSTALL_PREFIX with cmake.  I'm starting with
> the source tarballs downloaded from llvm.org/releases: clang, cfe, and
> clang-tools-extra, and I drop the latter two into the build tree as
> described.
> 
> After the build I used "make install" to install it.
> 
> The build works, and compiling my code (C++) works and a basic test
> suite passes and using "clang++ -v" I see that the right libraries and
> linker etc. are being used.  Yay!
> 
> However, when I try to build with ASAN things don't go so well.
> Compilation succeeds but linking fails:
> 
>  /opt/clang/current/bin/clang++ -std=c++11 -fsanitize=address <...>.o  \
>        -o myTest -rdynamic  -latomic -luuid -lrt -lpthread -lnsl -ldl
>  /gcc/generic/lib/gcc/x86_64-generic-linux-gnu/5.3.0/../../../../x86_64-generic-linux-gnu/bin/ld: error: cannot open /opt/clang/clang-3.8/bin/../lib64/clang/3.8.0/lib/linux/libclang_rt.asan-x86_64.a: No such file or directory
>  /gcc/generic/lib/gcc/x86_64-generic-linux-gnu/5.3.0/../../../../x86_64-generic-linux-gnu/bin/ld: error: cannot open /opt/clang/clang-3.8/bin/../lib64/clang/3.8.0/lib/linux/libclang_rt.asan_cxx-x86_64.a: No such file or directory
>  test/EnvironmentTest.cpp:78: error: undefined reference to '__asan_option_detect_stack_use_after_return'
>  test/EnvironmentTest.cpp:78: error: undefined reference to '__asan_stack_malloc_2'
>  GTest/include/gtest/gtest.h:288: error: undefined reference to '__asan_report_load1'
>  /gcc/generic/lib/gcc/x86_64-generic-linux-gnu/5.3.0/../../../../x86_64-generic-linux-gnu/include/c++/5.3.0/bits/atomic_base.h:304: error: undefined reference to '__asan_report_store4'
>    ... etc...
> 
> If I do a find -name '*.asan*.a' or 'libclang_rt*' in both the original
> build directory and the install directory, nothing shows up.  In fact
> there's no "lib" directory at all under lib64/clang/3.8.0; only an
> include directory.
> 
> Clearly I messed something up.  Any ideas on what do look for?
> 
> Here's the cmake command I used to set up the configuration:
> 
> cmake ../llvm-3.8.0.src -DCMAKE_C_COMPILER=x86_64-tools-linux-gnu-gcc \
>  -DCMAKE_CXX_COMPILER=x86_64-tools-linux-gnu-g++ \
>  -DCMAKE_C_FLAGS='-g -O2 -static-libgcc' \
>  -DCMAKE_CXX_FLAGS=-g -O2 -static-libgcc -static-libstdc++' \
>  -G 'Unix Makefiles' -DCMAKE_INSTALL_PREFIX=/work/clang/dist \
>  -DCMAKE_BUILD_TYPE=Release -DLLVM_BUILD_EXAMPLES=OFF \
>  -DCMAKE_MAKE_PROGRAM=make -DGCC_INSTALL_PREFIX=/gcc/x86_64-linux/cc/generic \
>  -DLLVM_HOST_TRIPLE=x86_64-generic-linux-gnu -DLLVM_INCLUDE_TESTS=OFF \
>  -DCMAKE_PREFIX_PATH=/gcc/x86_64-linux/sysroot/tools/usr \
>  -DLLVM_TARGETS_TO_BUILD=X86 -DLLVM_LIBDIR_SUFFIX=64 -DLLVM_INCLUDE_EXAMPLES=OFF
> _______________________________________________
> cfe-dev mailing list
> cfe-dev at lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev




More information about the cfe-dev mailing list