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]

GCC Behaves Differently for Different User?


Hi there,

I've got a really strange problem using gcc - I've absolutely no idea
how this could happen so I hope someone out there is able to help!

Under a new user (created for a pet project) I got a compiler error
saying the header <stddef.h> was not found. However, when compiling as
my "usual" username (john) gcc was able to find the header.

I ran gcc with a simple test program (just #include <stddef.h> and
provide an empty main()) with -v and see the following at the start of
the output from the new user:

--------
Using built-in specs.
Target: i686-linux-gnu
Configured with: ../src/configure -v --with-pkgversion='Ubuntu/Linaro
4.4.4-14ubuntu5'
--with-bugurl=file:///usr/share/doc/gcc-4.4/README.Bugs
--enable-languages=c,c++,fortran,objc,obj-c++ --prefix=/usr
--program-suffix=-4.4 --enable-shared --enable-multiarch
--enable-linker-build-id --with-system-zlib --libexecdir=/usr/lib
--without-included-gettext --enable-threads=posix
--with-gxx-include-dir=/usr/include/c++/4.4 --libdir=/usr/lib
--enable-nls --with-sysroot=/ --enable-clocale=gnu
--enable-libstdcxx-debug --enable-objc-gc --enable-targets=all
--disable-werror --with-arch-32=i686 --with-tune=generic
--enable-checking=release --build=i686-linux-gnu --host=i686-linux-gnu
--target=i686-linux-gnu
Thread model: posix
gcc version 4.4.5 (Ubuntu/Linaro 4.4.4-14ubuntu5)
COLLECT_GCC_OPTIONS='-v' '-mtune=generic' '-march=i686'
 /usr/lib/gcc/i686-linux-gnu/4.4.5/cc1 -quiet -v -iprefix
../lib/gcc/i686-linux-gnu/4.4.5/ prog.c -D_FORTIFY_SOURCE=2 -quiet
-dumpbase prog.c -mtune=generic -march=i686 -auxbase prog -version
-fstack-protector -o /tmp/ccOnPNZU.s
ignoring nonexistent directory "../lib/gcc/i686-linux-gnu/4.4.5/include"
ignoring nonexistent directory "../lib/gcc/i686-linux-gnu/4.4.5/include-fixed"
ignoring nonexistent directory
"../lib/gcc/i686-linux-gnu/4.4.5/../../../../i686-linux-gnu/include"
ignoring nonexistent directory "/usr/local/include/i686-linux-gnu"
ignoring nonexistent directory "../lib/../lib/gcc/i686-linux-gnu/4.4.5/include"
ignoring nonexistent directory
"../lib/../lib/gcc/i686-linux-gnu/4.4.5/include-fixed"
ignoring nonexistent directory
"../lib/../lib/gcc/i686-linux-gnu/4.4.5/../../../../i686-linux-gnu/include"
ignoring nonexistent directory "/usr/include/i686-linux-gnu"
#include "..." search starts here:
#include <...> search starts here:
 /usr/local/include
 /usr/include
End of search list.
--------

and the following for the old user:

--------Using built-in specs.
Target: i686-linux-gnu
Configured with: ../src/configure -v --with-pkgversion='Ubuntu/Linaro
4.4.4-14ubuntu5'
--with-bugurl=file:///usr/share/doc/gcc-4.4/README.Bugs
--enable-languages=c,c++,fortran,objc,obj-c++ --prefix=/usr
--program-suffix=-4.4 --enable-shared --enable-multiarch
--enable-linker-build-id --with-system-zlib --libexecdir=/usr/lib
--without-included-gettext --enable-threads=posix
--with-gxx-include-dir=/usr/include/c++/4.4 --libdir=/usr/lib
--enable-nls --with-sysroot=/ --enable-clocale=gnu
--enable-libstdcxx-debug --enable-objc-gc --enable-targets=all
--disable-werror --with-arch-32=i686 --with-tune=generic
--enable-checking=release --build=i686-linux-gnu --host=i686-linux-gnu
--target=i686-linux-gnu
Thread model: posix
gcc version 4.4.5 (Ubuntu/Linaro 4.4.4-14ubuntu5)
COLLECT_GCC_OPTIONS='-v' '-mtune=generic' '-march=i686'
 /usr/lib/gcc/i686-linux-gnu/4.4.5/cc1 -quiet -v prog.c
-D_FORTIFY_SOURCE=2 -quiet -dumpbase prog.c -mtune=generic -march=i686
-auxbase prog -version -fstack-protector -o /tmp/ccCRR4GE.s
ignoring nonexistent directory "/usr/local/include/i686-linux-gnu"
ignoring nonexistent directory
"/usr/lib/gcc/i686-linux-gnu/4.4.5/../../../../i686-linux-gnu/include"
ignoring nonexistent directory "/usr/include/i686-linux-gnu"
#include "..." search starts here:
#include <...> search starts here:
 /usr/local/include
 /usr/lib/gcc/i686-linux-gnu/4.4.5/include
 /usr/lib/gcc/i686-linux-gnu/4.4.5/include-fixed
 /usr/include
End of search list.
--------

Apparently, the new user tries to look in
../lib/gcc/i686-linux-gnu/4.4.5/include instead of
/usr/lib/gcc/i686-linux-gnu/4.4.5/include, and so cannot find
stddef.h, which is there. Curiously, although *most* search
directories for the new user are prefixed with ../lib/, there's still
one with the correct /usr/lib/. I also notice that cc1 is run with
different options for the old and new user, but I don't see why that
should be.

Any idea what would cause gcc to do this?

Many thanks,

John G


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