Can't seem to fix `undefined reference to `stat'' and `undefined reference to `atexit''

Can't seem to fix `undefined reference to `stat'' and `undefined reference to `atexit''

Post by Mael_Io » Fri, 10 Aug 2001 21:40:09


gcc-2.95.3     (have also tried gcc-
openssl-0.9.6b (have also tried openssl-0.9.6a)

I've been getting a load of errors compiling many different software
packages. Particularly software that uses libcrypto, or an associated
OpenSSL library. The main error has been:

`undefined reference to `atexit''

I read of a a patch for gcc that is supposed to fix this problem. I
then applied the patch and compiled gcc-2.95.3 with the new patch.
However, now I'm getting this while compiling gcc:

`undefined reference to `stat''

The glibc manual/FAQ mentions this problem and how to fix it. It says
to check /usr/lib/, and make sure it points to libc_nonshared.a
and The text file is set just the way the FAQ says it is
supposed to be.

I then tried gcc again, same error. I recompiled glibc, then tried
gcc, but same error.

If anyone can help me with this I'll be greatly appreciated.


Can't seem to fix `undefined reference to `stat'' and `undefined reference to `atexit''

Post by Mael_Io » Sun, 12 Aug 2001 12:54:34

I've fixed most of my problems by compiling gcc-2.95.3 statically.
That enabled me to compile many others safely. What I had to do was
recompile openssl with the static gcc. Everything seemed to work fine,
but then a program failed to compile when one of the X11 libraries
gave the "undefined reference to atexit".

     Recompiling X11 seemed to be in order, but then it failed
complaining with "undefined reference to atexit". So I
recompiled zlib, and that fixed it. But now I've got a somewhat new
error on `make install` of X11:

gcc -o xdpyinfo -fno-strength-reduce -pipe -ldl -O3 -Wall
-L../../exports/lib xdpyinfo.o -lXtst  -lXi -lXIE -lXxf86vm -lXxf86dga
-lXxf86misc -lXext -lX11   -lm -Wl,-rpath-link,../../exports/lib

../../exports/lib/libXxf86dga.a(XF86DGA.o): In function

XF86DGA.o(.text+0xa9c): undefined reference to `atexit'

collect2: ld returned 1 exit status

Now I'm just totally confused. If anyone can help me out, I'll be in
your debt.