Boost logo

Boost-Build :

Subject: Re: [Boost-build] <link>static is ignored
From: Vladimir Prus (ghost_at_[hidden])
Date: 2009-05-12 14:15:42


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


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