This is the mail archive of the
gcc-help@gcc.gnu.org
mailing list for the GCC project.
Problems linking with libc6
- To: help-gcc at gnu dot org
- Subject: Problems linking with libc6
- From: Vincent Stemen <vstemen at crel dot com>
- Date: Thu, 30 Dec 1999 16:14:25 GMT
- Newsgroups: gnu.gcc.help,comp.os.linux.development,linux.dev.gcc
- Organization: @Home Network
- Xref: wodc7nx0 gnu.gcc.help:2317
Please help. When trying to compile gcc with libc6. I get
undefined reference to `fstat'
and
undefined reference to `stat'
I get similar errors when attempting to compile gcc-2.95.2 and egcs-1.1.1.
I have tried with glibc-2.1.1 and glibc-2.1.2 and I have tried
compiling with gcc-2.95 and gcc-2.7.2.3.
The only combination that I have successfully compiled gcc-2.95.2 with
is egcs-1.1.1 with native libc-5.4.23.
Here are the errors I get compiling gcc-2.95.2 with gcc-2.95 and native
glibc-2.1.2
------------------------------------------------------------------------
gcc -c -DIN_GCC -g -DHAVE_CONFIG_H -I. -I../../gcc-2.95.2/gcc -I../../gcc-2.95.2/gcc/config -I../../gcc-2.95.2/gcc/../include obstack.c
gcc -DIN_GCC -g -DHAVE_CONFIG_H -o cccp cccp.o cexp.o intl.o prefix.o version.o mbchar.o obstack.o ../libiberty/libiberty.a
cccp.o: In function `main':
/u1/g2/pkg/prep/src/gcc-2.95.2.build/gcc/../../gcc-2.95.2/gcc/cccp.c:2064: undefined reference to `fstat'
cccp.o: In function `do_include':
/u1/g2/pkg/prep/src/gcc-2.95.2.build/gcc/../../gcc-2.95.2/gcc/cccp.c:4705: undefined reference to `fstat'
cccp.o: In function `open_include_file':
/u1/g2/pkg/prep/src/gcc-2.95.2.build/gcc/../../gcc-2.95.2/gcc/cccp.c:5093: undefined reference to `fstat'
cccp.o: In function `new_include_prefix':
/u1/g2/pkg/prep/src/gcc-2.95.2.build/gcc/../../gcc-2.95.2/gcc/cccp.c:10440: undefined reference to `stat'
collect2: ld returned 1 exit status
make[2]: *** [cccp] Error 1
make[2]: Leaving directory `/u1/g2/pkg/prep/src/gcc-2.95.2.build/gcc'
make[1]: *** [bootstrap] Error 2
make[1]: Leaving directory `/u1/g2/pkg/prep/src/gcc-2.95.2.build/gcc'
make: *** [bootstrap] Error 2
------------------------------------------------------------------------
I used the basic configure options,
configure --enable-shared --prefix=/usr
I am running Linux on an ix86 and compiling with kernel source headers
from linux-2.2.12.
I finally found the following in the glibc FAQ:
==============
{RM} Believe it or not, stat and lstat (and fstat, and mknod) are supposed
to be undefined references in libc.so.6! Your problem is probably a missing
or incorrect /usr/lib/libc.so file; note that this is a small text file now,
not a symlink to libc.so.6. It should look something like this:
GROUP ( libc.so.6 libc_nonshared.a )
==============
but my /usr/lib/libc.so is a text file. It contains the following
(exactly the way "make install" for glibc installed it.
/* GNU ld script
Use the shared library, but some functions are only in
the static library, so try that secondarily. */
GROUP ( /lib/libc.so.6 /usr/lib/libc_nonshared.a )
Does anybody know what else could be causing this problem? I was able
to compile and run major packages such as emacs and Xfree86 with glibc
but I cannot get the development packages to compile. I get various
other failures compiling such packages as binutils, and libg++ in
addition to the errors above with gcc.
I have posted about this problem to gnu.glibc.bug but have gotten no
response so far.
Thanks in advance.
Vincent