You are not logged in.

#1 2016-05-23 15:01:10

zasdfgbnm
Member
From: China
Registered: 2011-11-26
Posts: 38
Website

gcc-multilib 6.1.1-1 don't work well with C standard libraries on C++

A simple code can trigger problem.

Code is

#include <cstdlib>

Problem is:

$ g++ test.cpp
In file included from test.cpp:1:0:
/usr/include/c++/6.1.1/cstdlib:75:25: fatal error: stdlib.h: No such file or directory
 #include_next <stdlib.h>
                         ^
compilation terminated.

Offline

#2 2016-05-23 15:04:07

Scimmia
Bug Wrangler
Registered: 2012-09-01
Posts: 7,633

Re: gcc-multilib 6.1.1-1 don't work well with C standard libraries on C++

This happens when you screw up the search path. I'm guessing you've set CPLUS_INCLUDE_PATH or you've got some strange CXXFLAGS or something?

Last edited by Scimmia (2016-05-23 15:11:08)

Online

#3 2016-05-23 15:04:52

zasdfgbnm
Member
From: China
Registered: 2011-11-26
Posts: 38
Website

Re: gcc-multilib 6.1.1-1 don't work well with C standard libraries on C++

by the way:

$ find / -type f -name stdlib.h 2>/dev/null
/usr/include/bits/stdlib.h
/usr/include/bsd/stdlib.h
/usr/include/wine/msvcrt/stdlib.h
/usr/include/c++/6.1.1/tr1/stdlib.h
/usr/include/c++/6.1.1/stdlib.h
/usr/include/stdlib.h

Offline

#4 2016-05-23 15:06:31

zasdfgbnm
Member
From: China
Registered: 2011-11-26
Posts: 38
Website

Re: gcc-multilib 6.1.1-1 don't work well with C standard libraries on C++

$ export|grep CPLUS_INCLUDE_PATH
CPLUS_INCLUDE_PATH=:/usr/include:/usr/include/rdkit
$ gcc -xc++ -E -v -
Using built-in specs.
COLLECT_GCC=gcc
Target: x86_64-pc-linux-gnu
Configured with: /build/gcc-multilib/src/gcc/configure --prefix=/usr --libdir=/usr/lib --libexecdir=/usr/lib --mandir=/usr/share/man --infodir=/usr/share/info --with-bugurl=https://bugs.archlinux.org/ --enable-languages=c,c++,ada,fortran,go,lto,objc,obj-c++ --enable-shared --enable-threads=posix --enable-libmpx --with-system-zlib --with-isl --enable-__cxa_atexit --disable-libunwind-exceptions --enable-clocale=gnu --disable-libstdcxx-pch --disable-libssp --enable-gnu-unique-object --enable-linker-build-id --enable-lto --enable-plugin --enable-install-libiberty --with-linker-hash-style=gnu --enable-gnu-indirect-function --enable-multilib --disable-werror --enable-checking=release
Thread model: posix
gcc version 6.1.1 20160501 (GCC) 
COLLECT_GCC_OPTIONS='-E' '-v' '-mtune=generic' '-march=x86-64'
 /usr/lib/gcc/x86_64-pc-linux-gnu/6.1.1/cc1plus -E -quiet -v -D_GNU_SOURCE - -mtune=generic -march=x86-64
ignoring nonexistent directory "/usr/lib/gcc/x86_64-pc-linux-gnu/6.1.1/../../../../x86_64-pc-linux-gnu/include"
ignoring duplicate directory "/usr/include"
#include "..." search starts here:
#include <...> search starts here:
 .
 /usr/include
 /usr/include/rdkit
 /usr/lib/gcc/x86_64-pc-linux-gnu/6.1.1/../../../../include/c++/6.1.1
 /usr/lib/gcc/x86_64-pc-linux-gnu/6.1.1/../../../../include/c++/6.1.1/x86_64-pc-linux-gnu
 /usr/lib/gcc/x86_64-pc-linux-gnu/6.1.1/../../../../include/c++/6.1.1/backward
 /usr/lib/gcc/x86_64-pc-linux-gnu/6.1.1/include
 /usr/local/include
 /usr/lib/gcc/x86_64-pc-linux-gnu/6.1.1/include-fixed
End of search list.

Offline

#5 2016-05-23 15:07:16

Scimmia
Bug Wrangler
Registered: 2012-09-01
Posts: 7,633

Re: gcc-multilib 6.1.1-1 don't work well with C standard libraries on C++

zasdfgbnm wrote:
$ export|grep CPLUS_INCLUDE_PATH
CPLUS_INCLUDE_PATH=:/usr/include:/usr/include/rdkit

Yep, don't do that.

Online

#6 2016-05-23 15:19:22

zasdfgbnm
Member
From: China
Registered: 2011-11-26
Posts: 38
Website

Re: gcc-multilib 6.1.1-1 don't work well with C standard libraries on C++

Scimmia wrote:
zasdfgbnm wrote:
$ export|grep CPLUS_INCLUDE_PATH
CPLUS_INCLUDE_PATH=:/usr/include:/usr/include/rdkit

Yep, don't do that.

OK, I removed the /usr/include from my CPLUS_INCLUDE_PATH and it works now. Thanks!

Offline

Board footer

Powered by FluxBB