[cfe-dev] clang confused by GCC 8

Csaba Raduly via cfe-dev cfe-dev at lists.llvm.org
Wed Dec 6 02:30:14 PST 2017


Why would this be necessary for GCC8, when it wasn't necessary for
previous versions ?

On Mon, Dec 4, 2017 at 11:14 PM, Dmitry Babokin <babokin at gmail.com> wrote:
> I build with --gcc-toolchain set to directory with gcc8 installation and it
> works well for me.
>
> On Tue, Nov 28, 2017 at 1:27 AM, Csaba Raduly via cfe-dev
> <cfe-dev at lists.llvm.org> wrote:
>>
>> Hi all,
>>
>> After building and installing GCC trunk (GCC 8), clang doesn't find
>> the Standard C++ Library any more:
>>
>> /tmp$ cat > strm.cpp
>> #include <iostream>
>> ^D
>>
>> /tmp$ /usr/local/bin/clang++ -v strm.cpp
>> clang version 6.0.0 (trunk 319018)
>> Target: x86_64-unknown-linux-gnu
>> Thread model: posix
>> InstalledDir: /usr/local/bin
>> Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/4.8
>> Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/4.8.5
>> Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/7
>> Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/7.2.0
>> Found candidate GCC installation:
>> /usr/local/bin/../lib/gcc/x86_64-pc-linux-gnu/8.0.0
>> Selected GCC installation:
>> /usr/local/bin/../lib/gcc/x86_64-pc-linux-gnu/8.0.0
>> Candidate multilib: .;@m64
>> Candidate multilib: 32;@m32
>> Selected multilib: .;@m64
>>  "/usr/local/bin/clang-6.0" -cc1 -triple x86_64-unknown-linux-gnu
>> -emit-obj -mrelax-all -disable-free -main-file-name strm.cpp
>> -mrelocation-model static -mthread-model posix -mdisable-fp-elim
>> -fmath-errno -masm-verbose -mconstructor-aliases -munwind-tables
>> -fuse-init-array -target-cpu x86-64 -dwarf-column-info
>> -debugger-tuning=gdb -v -resource-dir /usr/local/lib/clang/6.0.0
>> -internal-isystem /usr/local/include -internal-isystem
>> /usr/local/lib/clang/6.0.0/include -internal-externc-isystem
>> /usr/include/x86_64-linux-gnu -internal-externc-isystem /include
>> -internal-externc-isystem /usr/include -fdeprecated-macro
>> -fdebug-compilation-dir /tmp -ferror-limit 19 -fmessage-length 271
>> -fobjc-runtime=gcc -fcxx-exceptions -fexceptions
>> -fdiagnostics-show-option -fcolor-diagnostics -o /tmp/strm-ba92aa.o -x
>> c++ strm.cpp
>> clang -cc1 version 6.0.0 based upon LLVM 6.0.0svn default target
>> x86_64-unknown-linux-gnu
>> ignoring nonexistent directory "/include"
>> #include "..." search starts here:
>> #include <...> search starts here:
>>  /usr/local/include
>>  /usr/local/lib/clang/6.0.0/include
>>  /usr/include/x86_64-linux-gnu
>>  /usr/include
>> End of search list.
>> strm.cpp:1:10: fatal error: 'iostream' file not found
>> #include <iostream>
>>          ^~~~~~~~~~
>>
>> For some reason, GCC8's include directories are not used, despite
>> "Selected GCC installation:
>> /usr/local/bin/../lib/gcc/x86_64-pc-linux-gnu/8.0.0". Not even
>> ``ignoring nonexistent directory`` is printed (unless the ``ignoring
>> nonexistent directory "/include" `` was clang's attempt to use the
>> GCC8 installation).
>>
>> $ find /usr/local/lib/gcc/x86_64-pc-linux-gnu/8.0.0/ -name iostream
>> /usr/local/lib/gcc/x86_64-pc-linux-gnu/8.0.0/include/c++/iostream
>>
>>
>> If I hide /usr/local/lib/gcc/x86_64-pc-linux-gnu/8.0.0 (to simulate
>> the state before I built and installed GCC 8), then it works:
>>
>> /tmp$ /usr/local/bin/clang++ -v strm.cpp
>> clang version 6.0.0 (trunk 319018)
>> Target: x86_64-unknown-linux-gnu
>> Thread model: posix
>> InstalledDir: /usr/local/bin
>> Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/4.8
>> Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/4.8.5
>> Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/7
>> Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/7.2.0
>> Selected GCC installation: /usr/lib/gcc/x86_64-linux-gnu/7.2.0
>> Candidate multilib: .;@m64
>> Candidate multilib: 32;@m32
>> Candidate multilib: x32;@mx32
>> Selected multilib: .;@m64
>>  "/usr/local/bin/clang-6.0" -cc1 -triple x86_64-unknown-linux-gnu
>> -emit-obj -mrelax-all -disable-free -main-file-name strm.cpp
>> -mrelocation-model static -mthread-model posix -mdisable-fp-elim
>> -fmath-errno -masm-verbose -mconstructor-aliases -munwind-tables
>> -fuse-init-array -target-cpu x86-64 -dwarf-column-info
>> -debugger-tuning=gdb -v -resource-dir /usr/local/lib/clang/6.0.0
>> -internal-isystem
>> /usr/lib/gcc/x86_64-linux-gnu/7.2.0/../../../../include/c++/7.2.0
>> -internal-isystem
>>
>> /usr/lib/gcc/x86_64-linux-gnu/7.2.0/../../../../include/x86_64-linux-gnu/c++/7.2.0
>> -internal-isystem
>>
>> /usr/lib/gcc/x86_64-linux-gnu/7.2.0/../../../../include/x86_64-linux-gnu/c++/7.2.0
>> -internal-isystem
>> /usr/lib/gcc/x86_64-linux-gnu/7.2.0/../../../../include/c++/7.2.0/backward
>> -internal-isystem /usr/local/include -internal-isystem
>> /usr/local/lib/clang/6.0.0/include -internal-externc-isystem
>> /usr/include/x86_64-linux-gnu -internal-externc-isystem /include
>> -internal-externc-isystem /usr/include -fdeprecated-macro
>> -fdebug-compilation-dir /tmp -ferror-limit 19 -fmessage-length 271
>> -fobjc-runtime=gcc -fcxx-exceptions -fexceptions
>> -fdiagnostics-show-option -fcolor-diagnostics -o /tmp/strm-c79a25.o -x
>> c++ strm.cpp
>> clang -cc1 version 6.0.0 based upon LLVM 6.0.0svn default target
>> x86_64-unknown-linux-gnu
>> ignoring nonexistent directory "/include"
>> ignoring duplicate directory
>>
>> "/usr/lib/gcc/x86_64-linux-gnu/7.2.0/../../../../include/x86_64-linux-gnu/c++/7.2.0"
>> #include "..." search starts here:
>> #include <...> search starts here:
>>  /usr/lib/gcc/x86_64-linux-gnu/7.2.0/../../../../include/c++/7.2.0
>>
>> /usr/lib/gcc/x86_64-linux-gnu/7.2.0/../../../../include/x86_64-linux-gnu/c++/7.2.0
>>
>> /usr/lib/gcc/x86_64-linux-gnu/7.2.0/../../../../include/c++/7.2.0/backward
>>  /usr/local/include
>>  /usr/local/lib/clang/6.0.0/include
>>  /usr/include/x86_64-linux-gnu
>>  /usr/include
>> End of search list.
>> (success)
>>
>>
>> I tried passing --gcc-toolchain set to the directory selected in the
>> absence of GCC 8, but it didn't work. The only effect seems to be to
>> stop searching for GCC installations :
>>
>> /tmp$ /usr/local/bin/clang++
>> --gcc-toolchain=/usr/lib/gcc/x86_64-linux-gnu/7.2.0 -v strm.cpp
>> clang version 6.0.0 (trunk 319018)
>> Target: x86_64-unknown-linux-gnu
>> Thread model: posix
>> InstalledDir: /usr/local/bin
>>  "/usr/local/bin/clang-6.0" -cc1 -triple x86_64-unknown-linux-gnu
>> -emit-obj -mrelax-all -disable-free -main-file-name strm.cpp
>> -mrelocation-model static -mthread-model posix -mdisable-fp-elim
>> -fmath-errno -masm-verbose -mconstructor-aliases -munwind-tables
>> -fuse-init-array -target-cpu x86-64 -dwarf-column-info
>> -debugger-tuning=gdb -v -resource-dir /usr/local/lib/clang/6.0.0
>> -internal-isystem /usr/local/include -internal-isystem
>> /usr/local/lib/clang/6.0.0/include -internal-externc-isystem
>> /usr/include/x86_64-linux-gnu -internal-externc-isystem /include
>> -internal-externc-isystem /usr/include -fdeprecated-macro
>> -fdebug-compilation-dir /tmp -ferror-limit 19 -fmessage-length 271
>> -fobjc-runtime=gcc -fcxx-exceptions -fexceptions
>> -fdiagnostics-show-option -fcolor-diagnostics -o /tmp/strm-241a36.o -x
>> c++ strm.cpp
>> clang -cc1 version 6.0.0 based upon LLVM 6.0.0svn default target
>> x86_64-unknown-linux-gnu
>> ignoring nonexistent directory "/include"
>> #include "..." search starts here:
>> #include <...> search starts here:
>>  /usr/local/include
>>  /usr/local/lib/clang/6.0.0/include
>>  /usr/include/x86_64-linux-gnu
>>  /usr/include
>> End of search list.
>> strm.cpp:1:10: fatal error: 'iostream' file not found
>> #include <iostream>
>>          ^~~~~~~~~~
>>
>>
>> This is an Ubuntu 17.10 machine whose system compiler is GCC 7.2:
>>
>> /tmp$ g++ -v
>> Using built-in specs.
>> COLLECT_GCC=g++
>> COLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-linux-gnu/7/lto-wrapper
>> OFFLOAD_TARGET_NAMES=nvptx-none
>> OFFLOAD_TARGET_DEFAULT=1
>> Target: x86_64-linux-gnu
>> Configured with: ../src/configure -v --with-pkgversion='Ubuntu
>> 7.2.0-8ubuntu3' --with-bugurl=file:///usr/share/doc/gcc-7/README.Bugs
>> --enable-languages=c,ada,c++,go,brig,d,fortran,objc,obj-c++
>> --prefix=/usr --with-gcc-major-version-only --program-suffix=-7
>> --program-prefix=x86_64-linux-gnu- --enable-shared
>> --enable-linker-build-id --libexecdir=/usr/lib
>> --without-included-gettext --enable-threads=posix --libdir=/usr/lib
>> --enable-nls --with-sysroot=/ --enable-clocale=gnu
>> --enable-libstdcxx-debug --enable-libstdcxx-time=yes
>> --with-default-libstdcxx-abi=new --enable-gnu-unique-object
>> --disable-vtable-verify --enable-libmpx --enable-plugin
>> --enable-default-pie --with-system-zlib --with-target-system-zlib
>> --enable-objc-gc=auto --enable-multiarch --disable-werror
>> --with-arch-32=i686 --with-abi=m64 --with-multilib-list=m32,m64,mx32
>> --enable-multilib --with-tune=generic
>> --enable-offload-targets=nvptx-none --without-cuda-driver
>> --enable-checking=release --build=x86_64-linux-gnu
>> --host=x86_64-linux-gnu --target=x86_64-linux-gnu
>> Thread model: posix
>> gcc version 7.2.0 (Ubuntu 7.2.0-8ubuntu3)
>>
>>
>> This is how GCC 8 was configured:
>>
>> /tmp$ g++-8 -v
>> Using built-in specs.
>> COLLECT_GCC=g++-8
>>
>> COLLECT_LTO_WRAPPER=/usr/local/libexec/gcc/x86_64-pc-linux-gnu/8.0.0/lto-wrapper
>> Target: x86_64-pc-linux-gnu
>> Configured with: ../trunk/configure --program-suffix=-8
>> --enable-version-specific-runtime-libs --enable-languages=c,c++,lto :
>> (reconfigured) ../trunk/configure --program-suffix=-8
>> --enable-version-specific-runtime-libs --enable-languages=c,c++,lto
>> Thread model: posix
>> gcc version 8.0.0 20171124 (experimental) (GCC)
>>
>> Any ideas?
>>
>> Csaba
>> --
>> GCS a+ e++ d- C++ ULS$ L+$ !E- W++ P+++$ w++$ tv+ b++ DI D++ 5++
>> The Tao of math: The numbers you can count are not the real numbers.
>> Life is complex, with real and imaginary parts.
>> "Ok, it boots. Which means it must be bug-free and perfect. " -- Linus
>> Torvalds
>> "People disagree with me. I just ignore them." -- Linus Torvalds
>> _______________________________________________
>> cfe-dev mailing list
>> cfe-dev at lists.llvm.org
>> http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev
>
>



-- 
GCS a+ e++ d- C++ ULS$ L+$ !E- W++ P+++$ w++$ tv+ b++ DI D++ 5++
The Tao of math: The numbers you can count are not the real numbers.
Life is complex, with real and imaginary parts.
"Ok, it boots. Which means it must be bug-free and perfect. " -- Linus Torvalds
"People disagree with me. I just ignore them." -- Linus Torvalds



More information about the cfe-dev mailing list