Boost logo

Boost-Build :

Subject: Re: [Boost-build] <link>static is ignored
From: Ian Emmons (iemmons_at_[hidden])
Date: 2009-05-13 11:34:45


On May 12, 2009, at 2:15 PM, Vladimir Prus wrote:

> On Monday 11 May 2009 22:07:45 Ian Emmons wrote:
>> I am attempting to control whether my program links to the static or
>> shared versions of various Boost libraries, without success. Here is
>> the (simplified) Jamroot of my project:
>>
>> exe foo
>> : [ glob *.cpp ]
>> /site-config//BoostSystem/<link>static
>> : <include>.
>> ;
>>
>> In my site-config.jam file, I have this:
>>
>> searched-lib BoostSystem
>> : # no sources
>> : <variant>debug:<name>boost_system-xgcc40-mt-d
>> <variant>release:<name>boost_system-xgcc40-mt
>> <search>$(BoostDir)/darwin/stage/lib
>> : # no default build
>> : <include>$(BoostDir)
>> ;
>>
>> I have built both static and shared versions of Boost.System, and
>> they
>> both reside in the same directory, "$(BoostDir)/darwin/stage/lib".
>> In
>> spite of the "<link>static" qualifier in my Jamroot, my foo
>> executable
>> links to the shared version of Boost.System. Why is that?
>
> The darwin toolset does not allow to specify static or shared linking
> for searched libraries. Looking at darwin.jam:'actions link' I see
>
> "$(CONFIG_COMMAND)" ... -l$(FINDLIBS-SA) -l$(FINDLIBS-ST)
>
> whilst gcc.jam has:
>
> $(START-GROUP) $(FINDLIBS-ST-PFX) -l$(FINDLIBS-ST) $(FINDLIBS-SA-
> PFX) -l$(FINDLIBS-SA) CRegister $(END-GROUP)
>
> with those extra variables set in gcc.jam:init-link-flags. I imagine
> that if you adjust darwin.jam 'link'
> action, and also modify init-link-flags to set variables similar to
> 'gnu' linker type, things
> might work, but I don't have OSX machine to verify such a change
> myself.
>
> - Volodya

Thanks, Volodya. I don't have time to mess with the darwin.jam
internals, but I was able to work around the problem by putting my
static libraries in a different directory, and then replacing "<search>
$(BoostDir)/darwin/stage/lib" with the following:

     <link>shared:<search>$(BoostDir)/darwin/stage/lib
     <link>static:<search>$(BoostDir)/darwin/stage/lib-static

Not so elegant, but not so bad either.

Thanks,

Ian



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