Advertisement

ld returned 1 exit status?

Started by October 16, 2003 09:41 PM
3 comments, last by cyanide 21 years ago
I just got myself a new server (RH9 Linux - 2.4.20-20.9) and so I was trying to install qmail on it. But every time I run the 'make' command I get this error and everything aborts (it happens for all the programs):

...
./load envdir unix.a byte.a
envdir.o(.text+0x127): In function `main':
: undefined reference to `errno'
envdir.o(.text+0x282): In function `main':
: undefined reference to `errno'
unix.a(openreadclose.o)(.text+0x47): In function `openreadclose':
: undefined reference to `errno'
unix.a(pathexec_run.o)(.text+0x122): In function `pathexec_run':
: undefined reference to `errno'
unix.a(pathexec_run.o)(.text+0x163): In function `pathexec_run':
: undefined reference to `errno'
unix.a(readclose.o)(.text+0x67): more undefined references to `errno' follow
collect2: ld returned 1 exit status
make: *** [envdir] Error 1
  
I've searched the net but I don't see any solution to this. I even upgraded my gcc version to 3.3.1 but still nothing happens. I have another server running gcc 2.96 and this same code compiles without any problem on that. Does anyone know what’s happening here or what do I need to change? Edit: BTW from what I could figure is if I add -static flag when linking the problem goes away.. but still I want to know why the above is happening with this new server? Any help will be appreciated! [edited by - cyanide on October 16, 2003 10:49:21 PM]
[size="1"]----#!/usr/bin/perlprint length "The answer to life,universe and everything";
Change all the places that have "extern int errno;" (envdir.c, openreadclose.c, pathexec_run.c and readclose.c unless they all include some common header) to have "#include <errno.h>" instead. errno is allowed to be a macro (the C standard defines it as "a modifiable lvalue that has type int" and in modern glibcs, it is in fact a #define for something like (*__errno_location()).
Advertisement
A ld error just means that something went wrong while trying to compile it. To find out what actually went wrong, you have to look at the lines above (i.e. undefined references to errno).
As to the solution to your problem, I have no idea, could be the AP is right.
Zorx (a Puzzle Bobble clone)Discontinuity (an animation system for POV-Ray)
The change to errno in the latest glibc versions break qmail. There''s a patch to fix qmail; it contains the changes described by the AP.
hey thanks so much to all you nice people finally got it working.. It was indeed what AP said.. had to replace all exclude errno with #include <errno.h> and it works like a charm now!

thanks so much once again for the suggestions!!
[size="1"]----#!/usr/bin/perlprint length "The answer to life,universe and everything";

This topic is closed to new replies.

Advertisement