🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: gnu.gcc.help
Article #939

Re: .so problem and crossreferences between libraries in C, Linux

#939
From: joe durusau
Date: Tue, 08 Oct 2002 10:34
71 lines
3408 bytes

Peter Van Osta wrote:

> Hi,
>
> I am having serious trouble with linking shared objects (.so files) and
> crossreferencing between libraries. If you could respond by email
> (remove _NOSPAM from address) ?
>
> Shared object problem:
> ----------------------
> Creating qaz...
> /home/mcube/lib/Linux/libqwe.so: file not recognized: File format not
> recognized
> collect2: ld returned 1 exit status
> make: *** [qaz] Error 1
>
> I compile the libraries to ".a" files and use these files at the momnet
> as I cannot use the ".so" files. Using the ".a" files works. The only
> information i ahve is that there isa difference in the fact that our new
> ".so" files are "stripped":
>
> ".so" files of our software:
> libqwe.so: ELF 32-bit LSB shared object, Intel 80386, version 1,
> stripped
> libcbpim21.so: ELF 32-bit LSB shared object, Intel 80386, version 1, not
> stripped
>
> Version information:
> ld -v geeft:
> GNU ld version 2.11.90.0.8 (with BFD 2.11.90.0.8)
>
> gcc -v gives:
> gcc version 2.96 20000731 (Red Hat Linux 7.1 2.96-98)
>
> ranlib -v gives:
> GNU ranlib 2.11.90.0.8
>
> uname -a gives:
> Linux linux-1 2.4.7-10 #1 Thu Sep 6 17:27:27 EDT 2001 i686 unknown
>
> Crossreferencing between libraries:
> -----------------------------------
>
> I have some libraries that depend on functions in other libraries, so
> they are not "self-contained". I tried to follow the advce to change the
> order in which they are linked, but that doens't seem to work. What can
> I do to solve this problem ?
>
> Info:
>
> /home/abc/lib/Linux/libsrty.so: undefined reference to `test_dir'
> /home/abc/lib/Linux/libsrty.so: undefined reference to `make_dir'
> collect2: ld returned 1 exit status
> make: *** [qaz_02] Error 1
>
> Thanks in advance,
>
> Peter
>
> http://ourworld.compuserve.com/homepages/pvosta/

The best solution is to remove all non-selfcontained functions/libs.
It is a terrible idea to have libfoo use something in libbar, while
libbar also uses something in libfoo.  See the ld docs if you really
can't  find a way to reprogram around this situation.

Speaking only for myself,

Joe Durusau
Technical Details
Message-ID: <3DA2B49B.E5137CC0@bellsouth.net>
Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!newsfeed.stanford.edu!cyclone.bc.net!snoopy.risq.qc.ca!ps01-chi1!newsfeeds-atl2!newsfeeds-atl1.usenetserver.com!news.webusenet.com!pc01.webusenet.com!e3500-atl1.usenetserver.com.POSTED!not-for-mail
References: <3DA2A98C.AE660049@unionbio-eu.com>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: 11318c,de93be6f09f4e16b
X-Google-Attributes: gid11318c,public
X-Google-Thread: fcea4,de93be6f09f4e16b
X-Google-Attributes: gidfcea4,public
X-Google-ArrivalTime: 2002-10-08 03:35:15 PST
Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!newsfeed.stanford.edu!cyclone.bc.net!snoopy.risq.qc.ca!ps01-chi1!newsfeeds-atl2!newsfeeds-atl1.usenetserver.com!news.webusenet.com!pc01.webusenet.com!e3500-atl1.usenetserver.com.POSTED!not-for-mail
Message-ID: <3DA2B49B.E5137CC0@bellsouth.net>
From: joe durusau <durusau@bellsouth.net>
X-Mailer: Mozilla 4.78 [en] (Win98; U)
X-Accept-Language: en
MIME-Version: 1.0
Newsgroups: gnu.gcc.help,be.comp.programming
Subject: Re: .so problem and crossreferences between libraries in C, Linux
References: <3DA2A98C.AE660049@unionbio-eu.com>
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Lines: 73
X-Complaints-To: abuse@usenetserver.com
X-Abuse-Info: Please be sure to forward a copy of ALL headers
X-Abuse-Info: Otherwise we will be unable to process your complaint properly.
NNTP-Posting-Date: Tue, 08 Oct 2002 06:20:30 EDT
Organization: WEBUSENET.com
Date: Tue, 08 Oct 2002 06:34:03 -0400