Subject: programming questions.

From: "James A. Robinson" <[email-masked]>
Date: Tue, 09 Jul 1996 04:53:43 -0400

I would like to make netpbm shared before I pass it on.  Can somebody
tell me if there is a foolproof way to turn a lib???.a library into a
shared library (how do I version it, .so name it, etc?).  Also, is
there a way to _force_ the compiler to link to a library shared? (-l
doesn't seem to always work -- it sometimes seems to like the static
one...)

Jim

---

From: Guy Maor <[email-masked]>
Date: Wed, 10 Jul 1996 10:54:02 -0500 (CDT)

On Tue, 9 Jul 1996, James A. Robinson wrote:

> shared library (how do I version it, .so name it, etc?).

Look at the debian.rules for some other debian shared lib package.

Guy

---

From: [email-masked] (J.H.M.Dassen)
Date: Wed, 10 Jul 1996 13:53:54 +0200 (MDT)

> shared library (how do I version it, .so name it, etc?).

I don't know of a foolproof way; I do know one that is me-proof :-)
Read H.J. Lu's "ELF: from the programmer's perspective" near
http://www.debian.org/Documentation/ or from ftp://tsx-11.mit.edu

The basics are as follows:
- make sure that all .o files that go into the shared lib are compiled
  -fPIC for Position Independent Code
- copy the "magic" gcc line from the document (it passes the version
  number to ld).

If you want to be fancy:
- compile everything twice (using make's VDIR directive): once with -fPIC
  (for the dynamic lib) and once without (PIC needs one register and is
  unnecessary for the static version).

For the version number: there is no official list of .so version. 
Determining the .so version is done via a magic recipe involving
- the Linux list of shared libraries at or near 
  http://users.ox.ac.uk/~jo95004/liblist.html
- documentation in the source code
- the version numbers from other linux distributions
- common sense.

> Also, is

When it links the static one you may have an old version of the library
package.  In the newest binutils, ld requires a link from 
libfoo.so (no version number) to libfoo.so.x.y.z to link dynamically.

Hope this helps,
Ray
-- 
POPULATION EXPLOSION  Unique in human experience, an event which happened 
yesterday but which everyone swears won't happen until tomorrow.  
- The Hipcrime Vocab by Chad C. Mulligan

---

From: Juergen Menden <[email-masked]>
Date: Wed, 10 Jul 1996 19:12:49 +0200 (MET DST)

On Tue, 9 Jul 1996, James A. Robinson wrote:

> Can somebody

read the ELF howto.

> Also, is
> there a way to _force_ the compiler to link to a library shared? 

yes. provide a shared lib. :-)

> (-l doesn't seem to always work -- it sometimes seems to like the 
> static one...)

many possible reasons:
 - you haved linked with -N, which implies static libs
 - you doesn't have provided a shared lib. for the linker
   run you must have a libXXX.so, the ld.so (which runs at the 
   start of the binary) needs a libXXX.so.<so-version>, you generally
   provide a libXXX.so.<so-version>.<revision>. ldconfig
   looks which so-version the libXXX.so.<so-version>.<rev> files
   have (by inspecting the file, not the name of course!) and
   generates a link libXXX.so.<so-version> to libXXX.so.<so-version>.<rev>.
   you need to manually (or by providing it in the .deb file) 
   make a link from libXXX.so to libXXX.so.<so-version>.<rev>
 - many possible other reasons. you should tell us more.

jjm

-- 
Juergen Menden                   | Disclaimer: The opinions expressed by me, 
tel:    +49 (89) 289 - 22387     +-----------+ are (usually) not the opinions 
e-mail: [email-masked]     | of anyone else on this planet.

Hi! I'm a .signature virus!  Add me to your .signature and join in the fun!