我从源头构建了clang-4.0。当我尝试使用" Undefined Behavior"洗手液,我得到了以下输出。
$ clang -fsanitize=undefined parallel_big_loop.c
/usr/bin/ld: cannot find /home/user/Software/polly/llvm_build/bin/../lib/clang/4.0.0/lib/linux/libclang_rt.ubsan_standalone-x86_64.a: No such file or directory
clang-4.0: error: linker command failed with exit code 1 (use -v to see invocation)
使用Ubuntu 14.04.5 amd64,linux 4.4.0-31-generic。
如何在构建期间指示CMake包含它?
答案 0 :(得分:1)
根据Clang官方指南:http://clang.llvm.org/get_started.html
svn co http://llvm.org/svn/llvm-project/llvm/trunk llvm
cd llvm/tools
svn co http://llvm.org/svn/llvm-project/cfe/trunk clang
cd ../..
cd llvm/projects
# This repository is responsible for sanitizers
svn co http://llvm.org/svn/llvm-project/compiler-rt/trunk compiler-rt
cd ../..
# in-tree build is not supported
mkdir build
cd build
cmake -G"Ninja" -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=/opt/clang/ ../llvm/
ninja
您可以使用ninja
代替make
,如果您不喜欢svn
,则可以使用此Github存储库https://github.com/llvm-mirror