[llvm-dev] How do I run llvm's asan tests? (original) (raw)

Reid Kleckner via llvm-dev llvm-dev at lists.llvm.org
Wed Feb 20 14:45:18 PST 2019


clang can't find your STL headers, I guess. You probably have some GCC libraries installed in /usr/lib for some recent version of GCC (8.N), but no headers for that same version. Clang's GCC installation detection logic will find the libraries, and use the corresponding version to calculate standard library include paths.

The easiest fix is probably to run sudo apt-get install libstdc++-8-dev, assuming you have some libraries for libstdc++8 but no headers.

On Tue, Feb 19, 2019 at 5:58 PM Aaron Jacobs via llvm-dev < llvm-dev at lists.llvm.org> wrote:

Hi llvm-dev,

I'm trying to figure out how to contribute to LLVM, in particular a followup to kcc's commit 6bde702a in sanitzersuppressions.cc. However I can't find a way to get the tests to run before I even change anything. The relevant unit test is compiler-rt/lib/sanitizercommon/tests/sanitizersuppressionstest.cc, so I expect I want ninja check-asan (right?). Here's what I tried, on my Debian machine, following (and adjusting) the outdated llvm documentation about setting up a GCC toolchain: # Install the GCC toolchain. # See http://llvm.org/docs/GettingStarted.html#getting-a-modern-host-c-toolchain # Adjusted for GCC 7.4.0, which doesn't ship in a bzip2 archive. gccversion=7.4.0 wget https://ftp.gnu.org/gnu/gcc/gcc-${gccversion}/gcc-${gccversion}.tar.gz wget https://ftp.gnu.org/gnu/gcc/gcc-${gccversion}/gcc-${gccversion}.tar.gz.sig wget https://ftp.gnu.org/gnu/gnu-keyring.gpg signatureinvalid=gpg --verify --no-default-keyring --keyring_ _./gnu-keyring.gpg gcc-${gccversion}.tar.gz.sig if [ $signatureinvalid ]; then echo "Invalid signature" ; exit 1 ; fi tar -xvzf gcc-${gccversion}.tar.gz cd gcc-${gccversion} ./contrib/downloadprerequisites cd .. mkdir gcc-${gccversion}-build cd gcc-${gccversion}-build mkdir -p $HOME/toolchains $PWD/../gcc-${gccversion}/configure --prefix=$HOME/toolchains --enable-languages=c,c++ make -j$(nproc) make install # Clone llvm and try to test it. mkdir -p ~/clients cd ~/clients git clone https://github.com/llvm/llvm-project.git # Get a coffee cd llvm-project mkdir build cd build _CC=$HOME/toolchains/bin/gcc CXX=$HOME/toolchains/bin/g++ _ cmake -G Ninja -DCMAKECXXLINKFLAGS="-Wl,-rpath,$HOME/toolchains/lib64 -L$HOME/toolchains/lib64" -DLLVMENABLEPROJECTS='clang;compiler-rt;libcxx;libcxxabi' ../llvm ninja check-asan # Get another coffee After about 30 minutes, the ninja command fails with an error about how the string header isn't found: FAILED: projects/compiler-rt/lib/asan/tests/ASANNOINSTTEST OBJECTS.asannoinsttest.cc.x8664-inline.o cd /usr/local/google/home/jacobsa/clients/llvm-project/build/projects/compiler-rt/lib/asan/tests && /usr/local/google/home/jacobsa/clients/llvm-project/build/./bin/clang -fPIC -fvisibility-inlines-hidden -Werror=date-time -std=c++11 -Wall -Wextra -Wno-unused-parameter -Wwrite-strings -Wcast-qual -Wno-missing-field-initializers -pedantic -Wno-long-long -Wimplicit-fallthrough -Wno-maybe-uninitialized -Wno-noexcept-type -Wdelete-non-virtual-dtor -Wno-comment -fdiagnostics-color -Wall -std=c++11 -Wno-unused-parameter -Wno-unknown-warning-option -DGTESTNOLLVMRAWOSTREAM=1 -DGTESTHASRTTI=0 -I/usr/local/google/home/jacobsa/clients/llvm-project/llvm/utils/unittest/googletest/include -I/usr/local/google/home/jacobsa/clients/llvm-project/llvm/utils/unittest/googletest -I/usr/local/google/home/jacobsa/clients/llvm-project/compiler-rt/include -I/usr/local/google/home/jacobsa/clients/llvm-project/compiler-rt/lib -I/usr/local/google/home/jacobsa/clients/llvm-project/compiler-rt/lib/asan -I/usr/local/google/home/jacobsa/clients/llvm-project/compiler-rt/lib/sanitizercommon/tests -fno-rtti -O2 -Wno-format -Werror=sign-compare -Wno-non-virtual-dtor -Wno-variadic-macros -gline-tables-only -DASANHASBLACKLIST=1 -DASANHASEXCEPTIONS=1 -DASANUAR=0 -m64 -c -o ASANNOINSTTESTOBJECTS.asannoinsttest.cc.x8664-inline.o /usr/local/google/home/jacobsa/clients/llvm-project/compiler-rt/lib/asan/tests/asannoinsttest.cc In file included from /usr/local/google/home/jacobsa/clients/llvm-project/compiler-rt/lib/asan/tests/asannoinsttest.cc:17: In file included from /usr/local/google/home/jacobsa/clients/llvm-project/compiler-rt/lib/asan/tests/asantestutils.h🔞 /usr/local/google/home/jacobsa/clients/llvm-project/compiler-rt/lib/asan/tests/asantestconfig.h:19:10: fatal error: 'string' file not found #include ^~~~~~~~ 1 error generated. This doesn't happen for ninja check-all (but despite its name that target doesn't seem to run the test), so I wonder if it's a hermeticism issue in the asan tests? It's also very possible I've just done it wrong. Help? Thanks, Aaron


LLVM Developers mailing list llvm-dev at lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20190220/caed33f3/attachment.html>



More information about the llvm-dev mailing list