[Freeciv-Dev] Re: Failing to link with a QPE client -- any hints?
[Top] [All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
Jason Dorje Short wrote:
It's a problem in the linking stage.
I've run into this before, and I don't know why it happens. The order
of the list of .a files seems to matter, so one .a file must come before
another so that its functions may be used by that object file (or
perhaps vice versa). You can see I don't really understand the problem
:-).
The workaround is generally to list these .a files twice. This is
already done for some .a files, but not all (this is done for civserver
as well as civclient).
...
Perhaps someone can find some documentation on this somewhere? How is
it supposed to be done?
I don't have any documentation to the matter handy, but this is gcc
feature (not bug, I remember reading this some years back from some
mailing list where gcc maintainers claimed it to be intentional, or at
very least accepted side effect of great concept). While linking static
libraries, it does not collect all symbols, but only those it already
knows it needs. So, if library A is linked before B, and all calls to
certain function in A is from B, it is not collected. When we give A
second time after B, symbol is collected - and it may depend on some
not-yet-collected symbol in B...
I have worked with project where all libraries had to be given four!
times. Well, probably it could have been avoided by carefully
reorganizing their order, but as there were lots of small libraries it
was easier to just make it "$(PROG_LIBS) $(PROG_LIBS) $(PROG_LIBS)
$(PROG_LIBS)"...
While I'm at it, I'll mention another related problem I had hard time
tracking time a while back. For certain project above mentioned 'list
libraries twice' trick did not work in new environment. I found out that
new versions of libtool require option '--preserve-dup-deps' or linking
is performaed as if libraries were give only once. To make it worse,
older versions of libtool, where this work by default, have no such
option at all, so one can't just blindly use it. Actually I found that
this behaviour differs between libtool 'versions' with exactly same
version number. So it's time to implement some configure checks.
But hey, this is not actually freeciv related as libtool is not used
here at all. I forgot.
- Caz
[Freeciv-Dev] Re: Failing to link with a QPE client -- any hints?, Raimar Falke, 2004/04/19
[Freeciv-Dev] Re: Failing to link with a QPE client -- any hints?, Jason Dorje Short, 2004/04/19
- [Freeciv-Dev] Re: Failing to link with a QPE client -- any hints?,
Marko Lindqvist <=
|
|