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-12 13:01:12


Volodya,

>Can you try the attached patch? (If it does not apply for some reason,
>both actions are modified by adding:
>
> -L"$(RPATH_LINK)"
>
>and there's a new flag setting.
>
>At the same time, can you lookup two things in docs:
>
>1. Is there an option to set rpath encoded in the libraries --
>that is the path there libraries will be searched at runtime.
>I notice your dump of binaries include it, so it must be
>possible to specify it as well.
>
>2. Is there an option to separately control where linker looks
>for dependency shared libraries. It's called "rpath-link" in
>Linux, maybe same for ACC.
>
>Thanks,
>Volodya

The patch works well, thank very much, it's a life saver.

I changed
-Wl,+h$(SPACE)-Wl,$(<[-1]:D=) to
-Wl,+h$(<[-1]:D=).
Looks a little cleaner and works the same.

Here is the output from the build:

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

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

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

        aCC -AA -b -g -o "bin/acc/debug/libfoo.so" -Wl,+hlibfoo.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 -g -I"../foo" -o "bin/acc/debug/bar.o" "bar.c"

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

        aCC -AA -b -g -o "bin/acc/debug/libbar.so"
-L"/home/tce/ul081b/foo/bin/acc/debug" -Wl,+hlibbar.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 -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 -o "bin/acc/debug/libbaz.so"
-L"/home/tce/ul081b/bar/bin/acc/debug"
-L"/home/tce/ul081b/foo/bin/acc/debug" -Wl,+hlibbaz.so
"bin/acc/debug/baz.o" "../bar/bin/acc/debug/libbar.so"
"../foo/bin/acc/debug/libfoo.so"

And the internals of libbaz.so:
$ elfdump -L baz/bin/acc/debug/libbaz.so

baz/bin/acc/debug/libbaz.so:

                *** DYNAMIC Section ***

.dynamic:

Index Tag Value

0 Needed libbar.so
1 Needed libfoo.so
2 Soname libbaz.so
3 Runpath
/home/tce/ul081b/bar/bin/acc/debug:/home/tce/ul081b/foo/bin/acc/debug:/usr/lib/hpux32:/opt/langtools/lib/hpux32
4 Flags 0x0
5 HP Flags 0x0
6 Link tab 0x40010018
7 Hash 0x4000398
8 Dynstr 0x40002c8
9 Dynsym 0x4000258
10 PltRsrv 0x40010010
11 GSTHshVl 0x4000430
12 GSTVersn 0x1
13 HPTime Fri Jun 12 09:36:08 2009
14 HPChksum 0x78065ff5
15 HPSyCksm 0x2014100c
16 Rela 0x40003c0
17 Relasz 0xc
18 Pltrel 0x7
19 Jmprel 0x40003c0
20 Pltrelsz 0xc
21 Relaent 0xc
22 Strsz 0xcd
23 Syment 0x10

So, everything looks good. For my case, I will probably add
+nodefaultrpath, which will
prevent the embedding of the paths supplied with -L. Those paths are
needed at link time,
but they are not appropriate for our runtime configuration.

To shift gears a bit, I have been following the mailing list for a
while, and I agree
with your (the maintainers) philosophy, that boost-build should not
surprise users
and should do what is usually the right thing. I think this is a case
that, at least
for HP-UX and Linux systems, and maybe for Unix in general, that
boost-build is doing
something that is surprising and not what most developers would want.
I suggest that
the default boost-build link lines for Unix systems should use the -L
and -l path
and lib specifiers.

Thanks again,

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