Boost logo

Boost-Build :

Subject: Re: [Boost-build] specifying libraries on the link line, was "incorrect library names embedded on hp-ux ia64"
From: Jim Gallagher (jim_at_[hidden])
Date: 2009-06-11 14:15:41


>> OK, I have learned more over at the HP IT Resource Center. On hp-ux, a
>> dependent shared lib supplied to the linker by a path will have the
>> supplied path embedded as the dependent library name
>> (<http://docs.hp.com/en/9482/linkertasks.htm#notrecordinglinktime>).
>> This would appear to be a good thing only if you are linking against
>> libraries that are in their final installed location and you supply
>> the full path. Do other unix variants work the same?
>
>Usual unix variants have a special option to make a shared library
>contain 'soname'. If a executable is linking to a shared library,
>it will reference it via 'soname', not the name specified on the link
>line. Can you figure of HPUX has something like that>

Yes, I did run across that. On hp-ux it is +h<internal name>. However,
it doesn't seem to work when multiple libs are involved. For example,
if I have three libs, foo, bar and baz, bar depends on foo and baz depends
on bar, and I add appropriate build requirements using +h:
   <toolset>acc:<linkflags>-Wl,+h,libfoo.so

Libbar links fine, but libbaz does not:

$ for DIR in foo bar baz; do^Jcd $DIR^Jbjam clean^Jbjam -d+2^Jcd ..^Jdone
...found 1 target...
...updating 1 target...
common.Clean clean
...updated 1 target...
acc.compile.c bin/acc/debug/foo.o

    aCC -Ae -c +d +Z -g -o "bin/acc/debug/foo.o" "foo.c"

acc.link.dll bin/acc/debug/libfoo.so

    aCC -AA -b -g -Wl,+h,libfoo.so -o "bin/acc/debug/libfoo.so"
"bin/acc/debug/foo.o"

...found 1 target...
...updating 1 target...
common.Clean clean
...updated 1 target...
acc.compile.c bin/acc/debug/bar.o

    aCC -Ae -c +d +Z -g -I"../foo" -o "bin/acc/debug/bar.o" "bar.c"

acc.link.dll bin/acc/debug/libbar.so

    aCC -AA -b -g -Wl,+h,libbar.so -o "bin/acc/debug/libbar.so"
"bin/acc/debug/bar.o" "../foo/bin/acc/debug/libfoo.so"

...found 1 target...
...updating 1 target...
common.Clean clean
...updated 1 target...
acc.compile.c bin/acc/debug/baz.o

    aCC -Ae -c +d +Z -g -I"../bar" -I"../foo" -o
"bin/acc/debug/baz.o" "baz.c"

acc.link.dll bin/acc/debug/libbaz.so

    aCC -AA -b -g -Wl,+h,libbaz.so -o "bin/acc/debug/libbaz.so"
"bin/acc/debug/baz.o" "../bar/bin/acc/debug/libbar.so"
"../foo/bin/acc/debug/libfoo.so"

ld: Can't find dependent library "libfoo.so"
Fatal error.
...failed updating 1 target...

Yet, both libfoo.so and libbar.so appear to have the correct
dependencies and embedded names:
$ elfdump -L foo/bin/acc/debug/libfoo.so

foo/bin/acc/debug/libfoo.so:

                *** DYNAMIC Section ***

.dynamic:

Index Tag Value

0 Soname libfoo.so
1 Runpath /usr/lib/hpux32:/opt/langtools/lib/hpux32
2 Flags 0x0
3 HP Flags 0x0
4 Link tab 0x40010010
5 Hash 0x40002e8
6 Dynstr 0x4000278
7 Dynsym 0x4000218
8 PltRsrv 0x40010000
9 GSTHshVl 0x4000368
10 GSTVersn 0x1
11 HPTime Thu Jun 11 11:06:53 2009
12 HPChksum 0xf6566078
13 HPSyCksm 0x509b87c5
14 Strsz 0x6f
15 Syment 0x10

$ elfdump -L bar/bin/acc/debug/libbar.so

bar/bin/acc/debug/libbar.so:

                *** DYNAMIC Section ***

.dynamic:

Index Tag Value

0 Needed libfoo.so
1 Soname libbar.so
2 Runpath /usr/lib/hpux32:/opt/langtools/lib/hpux32
3 Flags 0x0
4 HP Flags 0x0
5 Link tab 0x40010018
6 Hash 0x4000340
7 Dynstr 0x40002c0
8 Dynsym 0x4000250
9 PltRsrv 0x40010010
10 GSTHshVl 0x40003d8
11 GSTVersn 0x1
12 HPTime Thu Jun 11 11:06:55 2009
13 HPChksum 0xcea03a5d
14 HPSyCksm 0xa65c4ebe
15 Rela 0x4000368
16 Relasz 0xc
17 Pltrel 0x7
18 Jmprel 0x4000368
19 Pltrelsz 0xc
20 Relaent 0xc
21 Strsz 0x7d
22 Syment 0x10

I think it should work, but it doesn't.

>
>>
>> So, how can I make boost-build tell the linker about dependent libs
>> the normal unix way, using -L<search dir> -l<lib name>?
>
>It's not possible now. I can change to do it this way, but please check
>if some soname equivalent is available.
>
>- Volodya

Thanks,
Jim


Boost-Build list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk