List:General Discussion« Previous MessageNext Message »
From:Sasha Pachev Date:April 11 1999 6:56am
Subject:Re: Compilation Error
View as plain text  
Darren Ward wrote:
> 
> I can't seem to compile 3.22.21 with errors at:
> 
> readline.o: undefined reference to '__sigsetjmp'
> 
> I have just compiled glibc 2.0.6 with crypt, linuxthreads and localedata
> modules built in including the total-patch off www.tcx.se
> and I still get this error.
> 
> Advice would be greatly appreciated, especially where this reference
> should actually reside so I can ensure it is visible.
> 
> Darren

This is a generic answer meant to help everyone deal with library
linkage problems. Undefine reference means that you forgot to include a
library with a -lsomelibrary switch. Sometimes it is not clear with
library it is. Different systems have their quirks. For example, while
connect() on Linux is in libc inlcuded by default when you compile C
programs, you need to do -lsocket on SunOS. Here is how you can find out
( tested on Linux with Bash, other systems/shells will might need some
tweaking which library a certain function is in, if the library is
installed in some reasonable location on your system: (this examples
finds where connect() is located)

for f in /lib/* /usr/lib/* ; do nm $f 2>/dev/null | (grep T.*connect 2>
/dev/null && echo $f); done;

You will see some interesting output, and what your are looking for is
the filename below the name of the function . That is where it lives!
Now just replace lib with -l, get rid of the filename extenstion (.so or
.a) and stick the result into your library switches. Works great. I've
compiled a lot of sources that way without digging very much through the
installation manuals.

If you install packages on weird systems often, you may want to write a
more elegant version of my one-liner.
 
-- 
Sasha Pachev
http://www.sashanet.com
Thread
Compilation ErrorDarren Ward11 Apr
  • Re: Compilation ErrorSasha Pachev11 Apr