If gcc is invoked without an absolute path, and there is a *directory* named 'gcc' which can be found by searching $PATH before the actual gcc executable, then that location is taken as a starting point for searching for includes. As a result, standard include files such as stddef.h cannot be found. In the following example, an empty directory named /home/gdickie/gcc is created, and its parent /home/gdickie is placed into the search path. This results in an automatically-generated option "-iprefix /home/gdickie/../lib/gcc/i486-linux-gnu/4.3.2/", but this directory does not actually exist. After the failure is a demonstration with /usr/bin added the front of the path, which fixes the problem. Another way of fixing the problem is to invoke /usr/bin/gcc with a full path. src$ mkdir ~/gcc src$ PATH=~:$PATH src$ echo '#include <stddef.h>' > test.c src$ gcc -v -save-temps -c test.c Using built-in specs. Target: i486-linux-gnu Configured with: ../src/configure -v --with-pkgversion='Ubuntu 4.3.2-1ubuntu12' --with-bugurl=file:///usr/share/doc/gcc-4.3/README.Bugs --enable-languages=c,c++,fortran,objc,obj-c++ --prefix=/usr --enable-shared --with-system-zlib --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --enable-nls --with-gxx-include-dir=/usr/include/c++/4.3 --program-suffix=-4.3 --enable-clocale=gnu --enable-libstdcxx-debug --enable-objc-gc --enable-mpfr --enable-targets=all --enable-checking=release --build=i486-linux-gnu --host=i486-linux-gnu --target=i486-linux-gnu Thread model: posix gcc version 4.3.2 (Ubuntu 4.3.2-1ubuntu12) COLLECT_GCC_OPTIONS='-v' '-save-temps' '-c' '-mtune=generic' /usr/lib/gcc/i486-linux-gnu/4.3.2/cc1 -E -quiet -v -iprefix /home/gdickie/../lib/gcc/i486-linux-gnu/4.3.2/ test.c -D_FORTIFY_SOURCE=2 -mtune=generic -fpch-preprocess -o test.i ignoring nonexistent directory "/home/gdickie/../lib/gcc/i486-linux-gnu/4.3.2/include" ignoring nonexistent directory "/home/gdickie/../lib/gcc/i486-linux-gnu/4.3.2/include-fixed" ignoring nonexistent directory "/home/gdickie/../lib/gcc/i486-linux-gnu/4.3.2/../../../../i486-linux-gnu/include" ignoring nonexistent directory "/usr/local/include/i486-linux-gnu" ignoring nonexistent directory "/home/gdickie/../lib/gcc/../../lib/gcc/i486-linux-gnu/4.3.2/include" ignoring nonexistent directory "/home/gdickie/../lib/gcc/../../lib/gcc/i486-linux-gnu/4.3.2/include-fixed" ignoring nonexistent directory "/home/gdickie/../lib/gcc/../../lib/gcc/i486-linux-gnu/4.3.2/../../../../i486-linux-gnu/include" ignoring nonexistent directory "/usr/include/i486-linux-gnu" #include "..." search starts here: #include <...> search starts here: /usr/local/include /usr/include End of search list. test.c:1:20: error: stddef.h: No such file or directory src$ cat test.i # 1 "test.c" # 1 "<built-in>" # 1 "<command-line>" # 1 "test.c" src$ src$ PATH=/usr/bin:$PATH src$ gcc -v -save-temps -c test.c Using built-in specs. Target: i486-linux-gnu Configured with: ../src/configure -v --with-pkgversion='Ubuntu 4.3.2-1ubuntu12' --with-bugurl=file:///usr/share/doc/gcc-4.3/README.Bugs --enable-languages=c,c++,fortran,objc,obj-c++ --prefix=/usr --enable-shared --with-system-zlib --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --enable-nls --with-gxx-include-dir=/usr/include/c++/4.3 --program-suffix=-4.3 --enable-clocale=gnu --enable-libstdcxx-debug --enable-objc-gc --enable-mpfr --enable-targets=all --enable-checking=release --build=i486-linux-gnu --host=i486-linux-gnu --target=i486-linux-gnu Thread model: posix gcc version 4.3.2 (Ubuntu 4.3.2-1ubuntu12) COLLECT_GCC_OPTIONS='-v' '-save-temps' '-c' '-mtune=generic' /usr/lib/gcc/i486-linux-gnu/4.3.2/cc1 -E -quiet -v test.c -D_FORTIFY_SOURCE=2 -mtune=generic -fpch-preprocess -o test.i ignoring nonexistent directory "/usr/local/include/i486-linux-gnu" ignoring nonexistent directory "/usr/lib/gcc/i486-linux-gnu/4.3.2/../../../../i486-linux-gnu/include" ignoring nonexistent directory "/usr/include/i486-linux-gnu" #include "..." search starts here: #include <...> search starts here: /usr/local/include /usr/lib/gcc/i486-linux-gnu/4.3.2/include /usr/lib/gcc/i486-linux-gnu/4.3.2/include-fixed /usr/include End of search list. COLLECT_GCC_OPTIONS='-v' '-save-temps' '-c' '-mtune=generic' /usr/lib/gcc/i486-linux-gnu/4.3.2/cc1 -fpreprocessed test.i -quiet -dumpbase test.c -mtune=generic -auxbase test -version -fstack-protector -o test.s GNU C (Ubuntu 4.3.2-1ubuntu12) version 4.3.2 (i486-linux-gnu) compiled by GNU C version 4.3.2, GMP version 4.2.2, MPFR version 2.3.2. GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072 Compiler executable checksum: 9ecd6562c106044a1f3a6d56a4b5859b COLLECT_GCC_OPTIONS='-v' '-save-temps' '-c' '-mtune=generic' as -V -Qy -o test.o test.s GNU assembler version 2.18.93 (i486-linux-gnu) using BFD version (GNU Binutils for Ubuntu) 2.18.93.20081009 COMPILER_PATH=/usr/lib/gcc/i486-linux-gnu/4.3.2/:/usr/lib/gcc/i486-linux-gnu/4.3.2/:/usr/lib/gcc/i486-linux-gnu/:/usr/lib/gcc/i486-linux-gnu/4.3.2/:/usr/lib/gcc/i486-linux-gnu/:/usr/lib/gcc/i486-linux-gnu/4.3.2/:/usr/lib/gcc/i486-linux-gnu/ LIBRARY_PATH=/usr/lib/gcc/i486-linux-gnu/4.3.2/:/usr/lib/gcc/i486-linux-gnu/4.3.2/:/usr/lib/gcc/i486-linux-gnu/4.3.2/../../../../lib/:/lib/../lib/:/usr/lib/../lib/:/usr/lib/gcc/i486-linux-gnu/4.3.2/../../../:/lib/:/usr/lib/ COLLECT_GCC_OPTIONS='-v' '-save-temps' '-c' '-mtune=generic' src$
*** This bug has been marked as a duplicate of 38966 *** *** This bug has been marked as a duplicate of 38966 ***