Installing a Library

  • Follow


I'm porting my OSS stuff to HPUX. I've managed to produce what I think
is a shared library and I'd like to install it. From looking in /usr/lib
the file structure looks like:

-r--r--r-- libfoo.a
-r-xr-xr-x libfoo.1
lrwxr-xr-x libfoo.sl -> ./libfoo.1

So it looks like I just name the lib libxyz.sl and add a link but what
is the '1' for? Is that just an arbirary number used for versioning? If
so, how does one specify the backwards compatible version number while
linking the sl?

I tried and failed to find anything remotely interesting on HPs site. Is
there any reference material online somewhere?

Thanks,
Mike
0
Reply Michael 3/26/2005 10:53:14 PM

Michael B Allen wrote:
> I'm porting my OSS stuff to HPUX. I've managed to produce what I
think
> is a shared library and I'd like to install it. From looking in
/usr/lib
> the file structure looks like:
>
> -r--r--r-- libfoo.a
> -r-xr-xr-x libfoo.1
> lrwxr-xr-x libfoo.sl -> ./libfoo.1
>
> So it looks like I just name the lib libxyz.sl and add a link but
what
> is the '1' for? Is that just an arbirary number used for versioning?
If
> so, how does one specify the backwards compatible version number
while
> linking the sl?
>
> I tried and failed to find anything remotely interesting on HPs site.
Is
> there any reference material online somewhere?
>
> Thanks,
> Mike

the .1 is for implementing shared library versioning, for which you
would
use the -soname option with gcc.

you can take a look at this:
http://docs.hp.com/en/B2355-90655/ch05s08.html

0
Reply ranga 3/27/2005 7:27:57 AM


On Sun, 27 Mar 2005 02:27:57 -0500, ranga wrote:

> the .1 is for implementing shared library versioning, for which you
> would use the -soname option with gcc.

Then I have a more elaborate question. I am writing a little cc wrapper
that normalizes arguments but emits the proper arguments for the compiler
so that I can use one Makefile for all platforms. Meaning if I do:

  ccwrap -c -shared -libname foo -version 1.2.3 -lutil -lc f1.o f2.o f3.o

this would build a new command that differs depending on the C
environment. For example using gnuc on Linux it will emit:

  gcc -shared -Wl,-soname,libfoo.so.1.2 \
      -lutil -lc f1.o f2.o f3.o -o libfoo.so.1.2.3

whereas on OSX it would be more like:

  gcc -dynamic -current_version 1.2.3 -install_name libfoo.1.2.dylib \
      -lutil -lc f1.o f2.o f3.o -o libfoo.1.2.3.dylib

But for HPUX (and I think BSD is the same) I'm wondering how to
parameterize the major version number. Should I simply take the second
number like:

  cc -b +h libfoo.2 -lutil -lc f1.o f2.o f3.o -o libfoo.2.sl

This will be a problem if someone actually has 1.2 and 2.2 installed
together.

Mike
0
Reply Michael 3/30/2005 7:37:20 PM

Michael B Allen <mba2000@ioplex.com> writes:

> On Sun, 27 Mar 2005 02:27:57 -0500, ranga wrote:
> 
> > the .1 is for implementing shared library versioning, for which you
> > would use the -soname option with gcc.
> 
> Then I have a more elaborate question. I am writing a little cc wrapper
> that normalizes arguments but emits the proper arguments for the compiler
> so that I can use one Makefile for all platforms. Meaning if I do:
> 
>   ccwrap -c -shared -libname foo -version 1.2.3 -lutil -lc f1.o f2.o f3.o
> 
> this would build a new command that differs depending on the C
> environment. For example using gnuc on Linux it will emit:
> 
>   gcc -shared -Wl,-soname,libfoo.so.1.2 \
>       -lutil -lc f1.o f2.o f3.o -o libfoo.so.1.2.3
> 
> whereas on OSX it would be more like:
> 
>   gcc -dynamic -current_version 1.2.3 -install_name libfoo.1.2.dylib \
>       -lutil -lc f1.o f2.o f3.o -o libfoo.1.2.3.dylib
> 
> But for HPUX (and I think BSD is the same) I'm wondering how to
> parameterize the major version number. Should I simply take the second
> number like:
> 
>   cc -b +h libfoo.2 -lutil -lc f1.o f2.o f3.o -o libfoo.2.sl
> 
> This will be a problem if someone actually has 1.2 and 2.2 installed
> together.
> 
> Mike

you can simply use the whole version number in the internal name :

  cc -b -Wl,+h,libfoo.1.2 ...

if someone builds a shared library or application using this library
in the link line, the linker records this internal name as dependency
in the target. at load time the loader will look for the library by
that name (and the name can be whatever you like).

(all this is about the hp linker, not gnu)

-- 
ranga
0
Reply ranganath 4/6/2005 7:43:38 AM

3 Replies
85 Views

(page loaded in 0.065 seconds)

Similiar Articles:













7/20/2012 3:16:26 AM


Reply: