Boost logo

Boost-Build :

From: Puverle, Tomas (IT) (Tomas.Puverle_at_[hidden])
Date: 2004-09-20 12:18:03


> Hi Puverle,

It's Tom :)

> > In our environment, we build all shared objects with all external
> > references unresolved, so that a .so A never depends on a shared
> > library B.
> Why?

Without getting into too much detail, it helps us with library
versioning and debugging of code.


> What are "additional libraries"?

Our STL and a few others.

> > So the Jam link rule will perform something like this:
> >
> > ld ... <executable> <stl and support libs> <libboost_*>
> >
> > when what we really need is this:
> >
> > ld ... <executable> <libboost_*> <stl and support libs>
> >
> > That way, we end up with unresolved symbols to our STL and others.
> I'm completely lost. Unless there are some static libraries,
> the above two command like should be exactly equivalent. The
> linker will just add an entry for each library into the
> final binary (either library or exe). The order will differ,
> but that only matters if the same symbol is defined in
> several libraries.

That is not correct:

<man ld>

Add archive file archive to the list of files to link.
This option may be used any number of times. `ld'
will search its path-list for occurrences of
`libarchive.a' for every archive specified.

On systems which support shared libraries, `ld' may
also search for libraries with extensions other than
`.a'. Specifically, on ELF and SunOS systems, `ld'
will search a directory for a library with an exten-
sion of `.so' before searching for one with an exten-
sion of `.a'. By convention, a `.so' extension indi-
cates a shared library.

The linker will search an archive only once, at the
location where it is specified on the command line.
If the archive defines a symbol which was undefined in
some object which appeared before the archive on the
command line, the linker will include the appropriate
file(s) from the archive. However, an undefined sym-
bol in an object appearing later on the command line
will not cause the linker to search the archive again.

See the `-(' option for a way to force the linker to
search archives multiple times.

You may list the same archive multiple times on the
command line.

This type of archive searching is standard for Unix
linkers. However, if you are using `ld' on AIX, note
that it is different from the behaviour of the AIX
</man ld>

So what that means is that if I have a command line like this:

ld exec libA libB

and libB references libA, you will get unresolved symbol errors, however

ld exec libB libA

will link.

> I think you need to clarify what you want.

Does that make sense?

Thanks for you help!

NOTICE: If received in error, please destroy and notify sender. Sender does not waive confidentiality or privilege, and use is prohibited.


Boost-Build list run by bdawes at, david.abrahams at, gregod at, cpdaniel at, john at