[Scons-users] Change order of parameters in linker call

Dominic Binks dominic.binks at thebinkles.net
Wed Aug 5 12:44:16 EDT 2015


Sorry, but this is a bug.

The GNU linker specifies man page states (in the description for 
--start-group archives --end-group):

"Normally, an archive is searched only once in the order that it is 
specified on the command line. If a symbol in that archive is needed to 
resolve an undefined symbol referred to by an object in an archive that 
appears later on the command line, the linker would not be able to 
resolve that reference."

And further on explains an impact of using the option:

"Using this option has a significant performance cost.  It is best to 
use it only when there are unavoidable circular references between two 
or more archives."

Since the current SCons behaviour is implicitly relying on the 
start-group behaviour it will cause problems.

I know that the MS Linker works differently but I think SCons should be 
fixed to place the referenced libraries after the referenced objects 
(since the whole point of referenced libraries is to resolve symbols in 
the referenced objects).

Dominic

On 05/08/2015 16:03, Gary Oberbrunner wrote:
> You should be able to modify LINKCOM (and maybe SHLINKCOM) to reorder
> the link line.
>
> On Wed, Aug 5, 2015 at 10:40 AM, Viktor Dick <viktordick86 at gmail.com
> <mailto:viktordick86 at gmail.com>> wrote:
>
>
>     Hi,
>     I just now noticed that on ubuntu 14.04, the linker seems to have
>     problems with the way it is called by scons. In particular,
>
>     g++ -o test test.o -L/usr/lib/x86_64-linux-gnu -lboost_system
>
>     works while
>
>     g++ -o test -L /usr/lib/x86_64-linux-gnu -lboost_system test.o
>
>     throws linker errors. Unfortunately, the second way is the one that is
>     chosen by SCons by default when using the Program() builder.
>
>     Is there a quick fix to tell scons to change the order of the parameters
>     or do I have to write a complete builder for this?
>
>     Regards,
>     Viktor
>
>
>     _______________________________________________
>     Scons-users mailing list
>     Scons-users at scons.org <mailto:Scons-users at scons.org>
>     https://pairlist4.pair.net/mailman/listinfo/scons-users
>
>
>
>
> --
> Gary
>
>
> _______________________________________________
> Scons-users mailing list
> Scons-users at scons.org
> https://pairlist4.pair.net/mailman/listinfo/scons-users
>


More information about the Scons-users mailing list