(original) (raw)
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@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 sanitzer\_suppressions.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/sanitizer\_common/tests/sanitizer\_suppressions\_test.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.
gcc\_version=7.4.0
wget https://ftp.gnu.org/gnu/gcc/gcc-${gcc\_version}/gcc-${gcc\_version}.tar.gz
wget https://ftp.gnu.org/gnu/gcc/gcc-${gcc\_version}/gcc-${gcc\_version}.tar.gz.sig
wget https://ftp.gnu.org/gnu/gnu-keyring.gpg
signature\_invalid=\`gpg --verify --no-default-keyring --keyring
./gnu-keyring.gpg gcc-${gcc\_version}.tar.gz.sig\`
if \[ $signature\_invalid \]; then echo "Invalid signature" ; exit 1 ; fi
tar -xvzf gcc-${gcc\_version}.tar.gz
cd gcc-${gcc\_version}
./contrib/download\_prerequisites
cd ..
mkdir gcc-${gcc\_version}-build
cd gcc-${gcc\_version}-build
mkdir -p $HOME/toolchains
PWD/../gcc−PWD/../gcc-PWD/../gcc−{gcc\_version}/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
\-DCMAKE\_CXX\_LINK\_FLAGS="-Wl,-rpath,$HOME/toolchains/lib64
\-L$HOME/toolchains/lib64"
\-DLLVM\_ENABLE\_PROJECTS='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/ASAN\_NOINST\_TEST\_OBJECTS.asan\_noinst\_test.cc.x86\_64-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
\-DGTEST\_NO\_LLVM\_RAW\_OSTREAM=1 -DGTEST\_HAS\_RTTI=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/sanitizer\_common/tests
\-fno-rtti -O2 -Wno-format -Werror=sign-compare -Wno-non-virtual-dtor
\-Wno-variadic-macros -gline-tables-only -DASAN\_HAS\_BLACKLIST=1
\-DASAN\_HAS\_EXCEPTIONS=1 -DASAN\_UAR=0 -m64 -c -o
ASAN\_NOINST\_TEST\_OBJECTS.asan\_noinst\_test.cc.x86\_64-inline.o
/usr/local/google/home/jacobsa/clients/llvm-project/compiler-rt/lib/asan/tests/asan\_noinst\_test.cc
In file included from
/usr/local/google/home/jacobsa/clients/llvm-project/compiler-rt/lib/asan/tests/asan\_noinst\_test.cc:17:
In file included from
/usr/local/google/home/jacobsa/clients/llvm-project/compiler-rt/lib/asan/tests/asan\_test\_utils.h🔞
/usr/local/google/home/jacobsa/clients/llvm-project/compiler-rt/lib/asan/tests/asan\_test\_config.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@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev