From: Kirill Lapshin (klapshin_at_[hidden])
Date: 2003-12-30 20:57:36
Happy New Year! I hope you'll get a little snow for the holidays. I've
heard it is kind of warm these days in Moscow...
>>lib a : a.cpp foo ;
> Actually, the first declaration says that if you use 'a', you also need to use
> 'foo'. But it does not say that 'a' uses symbols from 'foo' -- so it's not
> clear that there are any restriction on relative order on command line.
Well, I see what you mean, but why else would you want to make client to
link with foo? To be able later on to load some symbols dynamically
(in case of shared library)? Seems to me if we actually decide to
implement correct ordering of libraries, build system should try, if at
all possible, to fulfill this kind of dependency as well, but give them
a lower priority and, probably, do not error out in case of circular
dependencies within usage requirements.
>>I'll try to do an experiment tonight, measure ld performance in all 3
>>cases -- libraries in right order, libraries put two times on command
>>line and -( -). Unfortunately my project is not too big and it might be
>>hard to see the difference. Any volunteers out there to do similar thing
>>on their projects?
> I'd be interested to know your result. I'll also ask on binutils mailing list.
Ok, I performed a quick experiment. I created 3 one line shell scripts,
first linking almost as bjam currently wants, i.e. all libraries listed
twice. Almost, because exact command bjam issues, fails for me, so I
rearranged libraries _a little_, and only rearranged second series of
libraries. Second shell scripts uses -( -) trick, one set of libraries.
And thirds shell script is a single series of libraries in correct
order. I measured them with time command, and added user and systime
times together. I ran every one of them 5 times, running them in
following order 1,2,3 1,2,3 and so on 5 times. Average time in seconds is
6.862, 6.482, 6.246
I.e. current approach the slowest, -( -) is faster, correct order a
little more faster.
Observed times were vary stable, variation about 0.1-0.2 second.
All measurements were performed on WindowsXP laptop, under CygWin.
Unfortunately I can't try it under Linux at the moment, since relevant
parts of the project have not been ported to linux yet.
I am linking about a dozen of libraries, two of them are really big C
style libraries -- LAPACK and BLAS. So it might be that my use case is
not really representative, it might be that majority of the time linker
spends looking through humongous LAPACK libraries.
>From numbers I observe I would say it does not worth implementing
correct ordering of libraries. However remember John's point about non
GNU linkers. If they are one-pass linkers as well, we might need to have
a correct order.
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