[3915] in RedHat Linux List

home help back first fref pref prev next nref lref last post

Re: lib*.so vs. lib*.a

daemon@ATHENA.MIT.EDU (Ron Passerini)
Mon Nov 11 16:03:49 1996

Date: Mon, 11 Nov 1996 15:56:47 -0500
From: Ron Passerini <rpasseri@tiac.net>
To: redhat-list@redhat.com
Resent-From: redhat-list@redhat.com
Reply-To: redhat-list@redhat.com

Daniel M. Drucker wrote:
> 
> I am using gcc-2.7.2-9 and ld.so-1.7.14-4 under RH 4.0 with all update
> rpms applied.
> 
> I'm sure this is a FAQ, but I spent the last half hour searching for
> the answer in the mailing list archives, etc, to no avail.
> 
> % gcc -lX11 foo.c
> ld: cannot open -lX11: No such file or directory
> 
> But...
> /usr/X11R6/libX11.a exists
> /usr/X11R6/libX11.so exists
> And /usr/X11R6/lib is in /etc/ld.so.conf (and I've run ldconfig).
> 

I believe that you have to put a -L/usr/X11R6/lib on the command line so
that gcc knows where to find this lib.  gcc does not use /etc/ld.so.conf
to find libraries to link against. (No compiler does this, as far as I
know.)


> Also -- gcc NEVER finds .so libraries. In fact, the man page
> specifically says that -lfoo will ONLY look for libfoo.a, not
> libfoo.so.

I don't think that's true.  I have compiled dozens of programs under
Linux, and they have all ended up linked to shared libraries.  If it
says that in the man page, then the man page is wrong.  If I remember
correctly, if you use a -g to compile in debugging symbols, then it will
staticly link the program, but otherwise, you need to pass a special
flag to get static linking.


Ron Passerini
Pencom Systems, Inc.


--
  PLEASE read the Red Hat FAQ, Tips, Errata and the MAILING LIST ARCHIVES!
  ________________________________________________________________________
  http://www.redhat.com/RedHat-FAQ   http://www.redhat.com/RedHat-Errata
  http://www.redhat.com/RedHat-Tips  http://www.redhat.com/mailing-lists
  ------------------------------------------------------------------------
To unsubscribe: mail -s unsubscribe redhat-list-request@redhat.com < /dev/null


home help back first fref pref prev next nref lref last post