Boost logo

Boost-Build :

Subject: Re: [Boost-build] Difficulty with pre-built lib declaration
From: Ian Emmons (iemmons_at_[hidden])
Date: 2009-01-05 13:17:59


Volodya,

Now that I'm back from vacation, I've had a chance to work on this a
bit more, and I think I've localized the problem somewhat. If I make
the <search> feature conditional on only the address model, then the
declaration works fine, like so:

path-constant BdbDir : D:/dev/KB/lib/bdb ;
constant BdbVersion : 47 ;
searched-lib BerkeleyDB
    : # no sources
    : <variant>debug:<name>libdb$(BdbVersion)d
       <variant>release:<name>libdb$(BdbVersion)
       <address-model>64:<search>"$(BdbDir)/lib/x64-vs2008"
       <address-model>32:<search>"$(BdbDir)/lib/Win32-vs2008"
    : # no default build
    : <include>"$(BdbDir)/include"
    ;

However, if I make the <search> feature conditional on only the
toolset, then the problem recurs:

path-constant BdbDir : D:/dev/KB/lib/bdb ;
constant BdbVersion : 47 ;
searched-lib BerkeleyDB
    : # no sources
    : <variant>debug:<name>libdb$(BdbVersion)d
       <variant>release:<name>libdb$(BdbVersion)
       <toolset>msvc-9.0:<search>"$(BdbDir)/lib/Win32-vs2008"
       <toolset>msvc-8.0:<search>"$(BdbDir)/lib/Win32-vs2005"
       <toolset>msvc-7.1:<search>"$(BdbDir)/lib/Win32-vs2003"
    : # no default build
    : <include>"$(BdbDir)/include"
    ;

So the problem appears to be that making a feature conditional on the
toolset is a problem. Does this give you any ideas about how to solve
this problem?

Thanks,

Ian

On Dec 19, 2008, at 3:54 PM, Ian Emmons wrote:

> Volodya, thanks for the quick response. Switching to searched-lib
> definitely helps, but it doesn't completely solve the problem. It
> appears that this change allows bjam to get the library name
> correct, but the <search> feature isn't being processed correctly.
> In particular, bjam issues the linker command with the correct
> library name, but it doesn't add the <search> value to the /LIBPATH
> option (which is entirely missing), and so the compiler complains
> that it can't find the library:
>
> LINK : fatal error LNK1181: cannot open input file 'libdb47d.lib'
>
> BTW, I am explicitly specifying the <toolset>, <address-model>, and
> <variant> features on the bjam command line:
>
> bjam toolset=msvc-8.0 address-model=32 variant=debug
>
> If I change the searched-lib declaration so that the <name> is
> conditional, but the <search> is not, like so:
>
> path-constant BdbDir : D:/dev/KB/lib/bdb ;
> constant BdbVersion : 47 ;
> searched-lib BerkeleyDB
> : # no sources
> : <search>"$(BdbDir)/lib/Win32-vs2005"
> <variant>debug:<name>libdb$(BdbVersion)d
> <variant>release:<name>libdb$(BdbVersion)
> : # no default build
> : <include>"$(BdbDir)/include"
> ;
>
> then the link does work (as long as I choose the correct path for
> the <search> value).
>
> Any further suggestions?
>
> Thanks,
>
> Ian
>
>
> On Dec 19, 2008, at 3:22 PM, Vladimir Prus wrote:
>
> On Friday 19 December 2008 23:00:02 Ian Emmons wrote:
>
>> I would like to
>> define the library target this way:
>>
>> path-constant BdbDir : D:/dev/KB/lib/bdb ;
>> constant BdbVersion : 47 ;
>> lib BerkeleyDB
>> : # no sources
>> : <variant>debug:<name>libdb$(BdbVersion)d
> ...
>> However, this definition causes bjam to output the following error:
>>
>> D:/bin/boost-build/kernel\class.jam:93: in new
>> *** argument error
>> * rule object(searched-lib-target)@196.__init__ ( name : project :
>> shared ? : search * : action )
>> * called with: ( BerkeleyDB libdb47d : object(project-target)@10 :
>
> Hi Ian,
>
> can you please use 'searched-lib' target type, not 'lib'? It appears
> that use of <name> inside conditional requirements confuses 'lib'.
>
> - 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