[cfe-dev] Clang isn't finding C++ include dir on Ubuntu

Robert Dailey via cfe-dev cfe-dev at lists.llvm.org
Thu Jul 19 08:48:45 PDT 2018


I configured a project via CMake using clang with the -m32 option. I
have Ubuntu 18.04 64 bit installed. I need to compile a library to 32
bit on this platform. Based on the settings I provided to CMake, this
is the command line it is invoking:

/usr/bin/clang++ -m32   -I/home/jamesa/uri/src
-I/home/jamesa/uri/include
-I/home/jamesa/uri/deps/googletest/googletest/include -std=c++11
-stdlib=libc++ -Wall -Werror -MD -MT
test/CMakeFiles/uri_test.dir/uri_test.cpp.o -MF
test/CMakeFiles/uri_test.dir/uri_test.cpp.o.d -o
test/CMakeFiles/uri_test.dir/uri_test.cpp.o -c
/home/jamesa/uri/test/uri_test.cpp


I added the `-v` option at the end to see the system include dirs it
is using (results will be posted at the bottom since it's rather
long). The compilation fails because it can't find <cxxabi.h>, which
on my install of Ubuntu is located here:

$ find /usr/include/ -name cxxabi.h
/usr/include/c++/8/cxxabi.h
/usr/include/c++/7/cxxabi.h

The path `/usr/include/c++/8` is not being added to the system include
paths used by Clang. I'm not sure why. The complete -v output is
below. Can anyone help me figure out what I'm missing? I have the
`gcc-8-multilib:i386` package properly installed on my system.


clang version 6.0.0-1ubuntu2 (tags/RELEASE_600/final)
Target: i386-pc-linux-gnu
Thread model: posix
InstalledDir: /usr/bin
Found candidate GCC installation: /usr/bin/../lib/gcc/i686-linux-gnu/8
Found candidate GCC installation: /usr/bin/../lib/gcc/x86_64-linux-gnu/7
Found candidate GCC installation: /usr/bin/../lib/gcc/x86_64-linux-gnu/7.3.0
Found candidate GCC installation: /usr/bin/../lib/gcc/x86_64-linux-gnu/8
Found candidate GCC installation: /usr/lib/gcc/i686-linux-gnu/8
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/7
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/7.3.0
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/8
Selected GCC installation: /usr/bin/../lib/gcc/x86_64-linux-gnu/8
Candidate multilib: .;@m64
Candidate multilib: 32;@m32
Candidate multilib: x32;@mx32
Selected multilib: 32;@m32
 "/usr/lib/llvm-6.0/bin/clang" -cc1 -triple i386-pc-linux-gnu
-emit-obj -mrelax-all -disable-free -disable-llvm-verifier
-discard-value-names -main-file-name uri_test.cpp -mrelocation-model
static -mthread-model posix -mdisable-fp-elim -fmath-errno
-masm-verbose -mconstructor-aliases -fuse-init-array -target-cpu
pentium4 -dwarf-column-info -debugger-tuning=gdb -v
-coverage-notes-file
/home/jamesa/uri_build/test/CMakeFiles/uri_test.dir/uri_test.cpp.gcno
-resource-dir /usr/lib/llvm-6.0/lib/clang/6.0.0 -dependency-file
test/CMakeFiles/uri_test.dir/uri_test.cpp.o.d -sys-header-deps -MT
test/CMakeFiles/uri_test.dir/uri_test.cpp.o -I /home/jamesa/uri/src -I
/home/jamesa/uri/include -I
/home/jamesa/uri/deps/googletest/googletest/include -internal-isystem
/usr/include/c++/v1 -internal-isystem
/usr/include/clang/6.0.0/include/ -internal-isystem /usr/local/include
-internal-isystem /usr/lib/llvm-6.0/lib/clang/6.0.0/include
-internal-externc-isystem /usr/include/i386-linux-gnu
-internal-externc-isystem /include -internal-externc-isystem
/usr/include -Wall -Werror -std=c++11 -fdeprecated-macro
-fdebug-compilation-dir /home/jamesa/uri_build -ferror-limit 19
-fmessage-length 152 -fobjc-runtime=gcc -fcxx-exceptions -fexceptions
-fdiagnostics-show-option -fcolor-diagnostics -o
test/CMakeFiles/uri_test.dir/uri_test.cpp.o -x c++
/home/jamesa/uri/test/uri_test.cpp
clang -cc1 version 6.0.0 based upon LLVM 6.0.0 default target
x86_64-pc-linux-gnu
ignoring nonexistent directory "/include"
ignoring duplicate directory "/usr/include/clang/6.0.0/include"
#include "..." search starts here:
#include <...> search starts here:
 /home/jamesa/uri/src
 /home/jamesa/uri/include
 /home/jamesa/uri/deps/googletest/googletest/include
 /usr/include/c++/v1
 /usr/include/clang/6.0.0/include
 /usr/local/include
 /usr/include/i386-linux-gnu
 /usr/include
End of search list.
In file included from /home/jamesa/uri/test/uri_test.cpp:8:
In file included from
/home/jamesa/uri/deps/googletest/googletest/include/gtest/gtest.h:58:
In file included from
/home/jamesa/uri/deps/googletest/googletest/include/gtest/internal/gtest-internal.h:66:
/home/jamesa/uri/deps/googletest/googletest/include/gtest/internal/gtest-type-util.h:52:12:
fatal error: 'cxxabi.h' file not found
#  include <cxxabi.h>
           ^~~~~~~~~~
1 error generated.


More information about the cfe-dev mailing list