This is the mail archive of the gcc-help@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: gcc 7.2.0 failed with cstdlib:75:15: fatal error: stdlib.h: No such file or directory on a hello-world program


No, I do have stdlib.h in the path. Here's the output of echo "" | gcc -E -x
c - -v (*note that /home/linuxbrew is just a symlink to /scratch*):

...
#include "..." search starts here:
#include <...> search starts here:
 /home/linuxbrew/.linuxbrew/include

/scratch/.linuxbrew/Cellar/gcc/7.2.0/bin/../lib/gcc/x86_64-pc-linux-gnu/7.2.0/include

/scratch/.linuxbrew/Cellar/gcc/7.2.0/bin/../lib/gcc/x86_64-pc-linux-gnu/7.2.0/include-fixed
 /scratch/.linuxbrew/Cellar/gcc/7.2.0/bin/../lib/gcc/../../include
...

and ls -l /home/linuxbrew/.linuxbrew/include/stdlib.h shows:
lrwxrwxrwx 1 Tim users 37 Oct 23 12:27
/home/linuxbrew/.linuxbrew/include/stdlib.h ->
../Cellar/glibc/2.23/include/stdlib.h

and ls -l /home/linuxbrew/.linuxbrew/Cellar/glibc/2.23/include/stdlib.h:
-rw-r--r-- 1 Tim users 33K Feb 18  2016
/home/linuxbrew/.linuxbrew/Cellar/glibc/2.23/include/stdlib.h

The situation here is that the tool chain I'm using comes from Linuxbrew but
I can confirm all of them works with the Linuxbrew-provided gcc (version
5.5.0) but not the version (gcc 7.2.0) I compiled my self. For comparison,
I'm posting the 
same output from the linuxbrew-provided gcc:

...
#include "..." search starts here:
#include <...> search starts here:
 /scratch/.linuxbrew/include

/scratch/.linuxbrew/Cellar/gcc/5.5.0_1/bin/../lib/gcc/x86_64-unknown-linux-gnu/5.5.0/include

/scratch/.linuxbrew/Cellar/gcc/5.5.0_1/bin/../lib/gcc/x86_64-unknown-linux-gnu/5.5.0/include-fixed
 /usr/local/include
 /scratch/.linuxbrew/Cellar/gcc/5.5.0_1/bin/../lib/gcc/../../include
 /usr/include
...

It looks like the difference is the Linuxbrew-provided gcc seeks
/usr/include for header and I can confirm that it's using the
/usr/include/stdlib.h instead of the  /scratch/.linuxbrew/include/stdlib.h
(or equivalently /home/linuxbrew/.linuxbrew/include/stdlib.h). The question
is: why gcc is not using the  /scratch/.linuxbrew/include path for header?



--
Sent from: http://gcc.1065356.n8.nabble.com/gcc-Help-f629689.html


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]