Reputation: 576
I built clang-4.0 from the source. When I tried to use the "Undefined Behaviour" sanitizer, I got the following output.
$ 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)
Using Ubuntu 14.04.5 amd64, linux 4.4.0-31-generic.
How can I indicate CMake to include it during build ?
Upvotes: 0
Views: 276
Reputation: 134
According to official Clang guideline: 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
Instead of ninja
you can of course use make
, and if you don't like svn
you can use this Github repository https://github.com/llvm-mirror
Upvotes: 1