<div dir="ltr">Hello,<br><br>I'm trying to build clang 3.4 to use libstdc++ from an installation of GCC 4.8.1, but I haven't been able to get clang to correctly locate the headers.  I've tried configuring both using the '--with-gcc-toolchain' option and the '--with-cxx-include-root' option, but in both cases the resulting clang toolchain doesn't find the C++ headers.  I suspect this is because GCC was configured with a non-standard layout (--with-gxx-include-dir=$PREFIX/include/g++ rather than $PREFIX/include/c++).  I've included the output of compiling an empty C++ program with -fsyntax only for gcc (slightly modified by replacing identifying information in the actual output with the string 'VENDOR') [1] and both variants of clang [2,3] at the end of the email.<br>
<br>Are there other configure options I should try?  Am I going to need to patch the driver (lib/Driver/ToolChains.cpp) to get this working?  Any suggestions would be greatly appreciated.<br><br>Steven Vormwald<br><br><br>
[1] GCC 4.8.1:<br><br>$ g++ -fsyntax-only -v t.c<br>Using built-in specs.<br>COLLECT_GCC=/opt/gcc/4.8.1/bin/../snos/bin/g++<br>COLLECT_LTO_WRAPPER=/opt/gcc/4.8.1/snos/libexec/gcc/x86_64-suse-linux/4.8.1/lto-wrapper<br>Target: x86_64-suse-linux<br>
Configured with: ../VENDOR-gcc-4.8.1/configure --prefix=/opt/gcc/4.8.1/snos --disable-nls --libdir=/opt/gcc/4.8.1/snos/lib --enable-languages=c,c++,fortran --with-gxx-include-dir=/opt/gcc/4.8.1/snos/include/g++ --with-slibdir=/opt/gcc/4.8.1/snos/lib --with-system-zlib --enable-shared --enable-__cxa_atexit --build=x86_64-suse-linux --with-mpc=/opt/gcc/mpc/0.8.1 --with-mpfr=/opt/gcc/mpfr/2.4.2 --with-gmp=/opt/gcc/gmp/4.3.2<br>
Thread model: posix<br>gcc version 4.8.1 20130531 (VENDOR) (GCC)<br>COLLECT_GCC_OPTIONS='-fsyntax-only' '-v' '-shared-libgcc' '-mtune=generic' '-march=x86-64'<br> /opt/gcc/4.8.1/snos/libexec/gcc/x86_64-suse-linux/4.8.1/cc1plus -quiet -v -D_GNU_SOURCE t.c -quiet -dumpbase t.c -mtune=generic -march=x86-64 -auxbase t -version -fsyntax-only -o /dev/null<br>
GNU C++ (GCC) version 4.8.1 20130531 (VENDOR) (x86_64-suse-linux)<br>        compiled by GNU C version 4.8.1 20130531 (VENDOR), GMP version 4.3.2, MPFR version 2.4.2, MPC version 0.8.1<br>GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072<br>
ignoring nonexistent directory "/opt/gcc/4.8.1/snos/lib/gcc/x86_64-suse-linux/4.8.1/../../../../x86_64-suse-linux/include"<br>#include "..." search starts here:<br>#include <...> search starts here:<br>
 /opt/gcc/4.8.1/snos/include/g++<br> /opt/gcc/4.8.1/snos/include/g++/x86_64-suse-linux<br> /opt/gcc/4.8.1/snos/include/g++/backward<br> /opt/gcc/4.8.1/snos/lib/gcc/x86_64-suse-linux/4.8.1/include<br> /usr/local/include<br>
 /opt/gcc/4.8.1/snos/include<br> /opt/gcc/4.8.1/snos/lib/gcc/x86_64-suse-linux/4.8.1/include-fixed<br> /usr/include<br>End of search list.<br>GNU C++ (GCC) version 4.8.1 20130531 (VENDOR) (x86_64-suse-linux)<br>        compiled by GNU C version 4.8.1 20130531 (VENDOR), GMP version 4.3.2, MPFR version 2.4.2, MPC version 0.8.1<br>
GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072<br>Compiler executable checksum: 179a0f2be046b98875cb1f704d81fcba<br>COMPILER_PATH=/opt/gcc/4.8.1/snos/libexec/gcc/x86_64-suse-linux/4.8.1/:/opt/gcc/4.8.1/snos/libexec/gcc/x86_64-suse-linux/4.8.1/:/opt/gcc/4.8.1/snos/libexec/gcc/x86_64-suse-linux/:/opt/gcc/4.8.1/snos/lib/gcc/x86_64-suse-linux/4.8.1/:/opt/gcc/4.8.1/snos/lib/gcc/x86_64-suse-linux/<br>
LIBRARY_PATH=/opt/gcc/4.8.1/snos/lib/gcc/x86_64-suse-linux/4.8.1/:/opt/gcc/4.8.1/snos/lib/gcc/x86_64-suse-linux/4.8.1/../../../../lib64/:/lib/../lib64/:/usr/lib/../lib64/:/opt/gcc/4.8.1/snos/lib/gcc/x86_64-suse-linux/4.8.1/../../../:/lib/:/usr/lib/<br>
COLLECT_GCC_OPTIONS='-fsyntax-only' '-v' '-shared-libgcc' '-mtune=generic' '-march=x86-64'<br>...<br><br>[2] Clang/LLVM 3.4 configured with '--prefix=/ptmp/sdvormwa/clang/3.4-gcc-toolchain --enable-optimized --enable-targets=all --with-gcc-toolchain=/opt/gcc/4.8.1/snos --enable-cxx11':<br>
$ /ptmp/sdvormwa/clang/3.4-gcc-toolchain/bin/clang++ -fsyntax-only -v t.c<br><br>clang version 3.4 (tags/RELEASE_34/final)<br>Target: x86_64-unknown-linux-gnu<br>Thread model: posix<br>Found candidate GCC installation: /opt/gcc/4.8.1/snos/lib/gcc/x86_64-suse-linux/4.8.1<br>
Selected GCC installation: /opt/gcc/4.8.1/snos/lib/gcc/x86_64-suse-linux/4.8.1<br>"/ptmp/sdvormwa/clang/3.4-gcc-toolchain/bin/clang" -cc1 -triple x86_64-unknown-linux-gnu -fsyntax-only -disable-free -main-file-name t.c -mrelocation-model static -mdisable-fp-elim -fmath-errno -masm-verbose -mconstructor-aliases -munwind-tables -fuse-init-array -target-cpu x86-64 -target-linker-version 11 -v -resource-dir /ptmp/sdvormwa/clang/3.4-gcc-toolchain/bin/../lib/clang/3.4 -internal-isystem /usr/local/include -internal-isystem /ptmp/sdvormwa/clang/3.4-gcc-toolchain/bin/../lib/clang/3.4/include -internal-externc-isystem /include -internal-externc-isystem /usr/include -fdeprecated-macro -fdebug-compilation-dir /home/sdvormwa -ferror-limit 19 -fmessage-length 157 -mstackrealign -fobjc-runtime=gcc -fcxx-exceptions -fexceptions -fdiagnostics-show-option -fcolor-diagnostics -vectorize-slp -x c++ t.c<br>
clang -cc1 version 3.4 based upon LLVM 3.4 default target x86_64-unknown-linux-gnu<br>ignoring nonexistent directory "/include"<br>#include "..." search starts here:<br>#include <...> search starts here:<br>
/usr/local/include<br>/ptmp/sdvormwa/clang/3.4-gcc-toolchain/bin/../lib/clang/3.4/include<br>/usr/include<br>End of search list.<br>...<br><br>[3] Clang/LLVM 3.4 configured with '--prefix=/ptmp/sdvormwa/clang/3.4-cxx-include --enable-optimized --enable-targets=all --enable-cxx11 --with-c-include-dirs=/opt/gcc/4.8.1/snos/lib/gcc/x86_64-suse-linux/4.8.1/include:/usr/include --with-cxx-include-32bit-dir=32 --with-cxx-include-root=/opt/gcc/4.8.1/snos/include/g++ --with-cxx-include-arch=x86_64-suse-linux':<br>
<br>$ /ptmp/sdvormwa/clang/3.4-cxx-include/bin/clang++ -fsyntax-only -v t.c<br>clang version 3.4 (tags/RELEASE_34/final)<br>Target: x86_64-unknown-linux-gnu<br>Thread model: posix<br>Found candidate GCC installation: /opt/gcc/4.8.1/snos/lib/gcc/x86_64-suse-linux/4.8.1<br>
Selected GCC installation: /opt/gcc/4.8.1/snos/lib/gcc/x86_64-suse-linux/4.8.1<br>clang: warning: treating 'c' input as 'c++' when in C++ mode, this behavior is deprecated<br>"/ptmp/sdvormwa/clang/3.4-cxx-include/bin/clang" -cc1 -triple x86_64-unknown-linux-gnu -fsyntax-only -disable-free -main-file-name t.c -mrelocation-model static -mdisable-fp-elim -fmath-errno -masm-verbose -mconstructor-aliases -munwind-tables -fuse-init-array -target-cpu x86-64 -target-linker-version 11 -v -resource-dir /ptmp/sdvormwa/clang/3.4-cxx-include/bin/../lib/clang/3.4 -internal-isystem /usr/local/include -internal-isystem /ptmp/sdvormwa/clang/3.4-cxx-include/bin/../lib/clang/3.4/include -internal-externc-isystem /opt/gcc/4.8.1/snos/lib/gcc/x86_64-suse-linux/4.8.1/include -internal-externc-isystem /usr/include -fdeprecated-macro -fdebug-compilation-dir /home/sdvormwa -ferror-limit 19 -fmessage-length 157 -mstackrealign -fobjc-runtime=gcc -fcxx-exceptions -fexceptions -fdiagnostics-show-option -fcolor-diagnostics -vectorize-slp -x c++ t.c<br>
clang -cc1 version 3.4 based upon LLVM 3.4 default target x86_64-unknown-linux-gnu<br>#include "..." search starts here:<br>#include <...> search starts here:<br>/usr/local/include<br>/ptmp/sdvormwa/clang/3.4-cxx-include/bin/../lib/clang/3.4/include<br>
/opt/gcc/4.8.1/snos/lib/gcc/x86_64-suse-linux/4.8.1/include<br>/usr/include<br>End of search list.<br>...<br></div>