Boost logo

Boost-Build :

From: Vladimir Prus (ghost_at_[hidden])
Date: 2006-11-25 12:40:06


On Friday 24 November 2006 21:48, Hugo Duncan wrote:
> Hi,

Hi Hugo,

> The def file seems to be no problem, but I am having a hard time coming up
> with a generator for the lib file. I always end up getting "Duplicate
> name of actual target:" errors.
>
> Obviously there is an interaction with the built in rules, but I can not
> see how to solve this. I have been trying this for some time now, so any
> help is appreciated.
>
> Hugo
>
>
> ---------------
>
> error: Duplicate name of actual target: <p..\bin.v2\gsl\msvc\debug>gsl.lib
> error: previous virtual target { msvc%msvc.link.dll-gsl.lib.IMPORT_LIB
> { libfromdll%libfromdll.libfile-gsl.lib.STATIC_LIB
> { libfromdll%libfromdll.deffile-gsl.def.DEF { gsl.dll.SHARED_LIB } } } }
> error: created from ./gsl
> error: another virtual target
> { libfromdll%libfromdll.libfile-gsl.lib.STATIC_LIB
> { libfromdll%libfromdll.deffile-gsl.def.DEF { gsl.dll.SHARED_LIB } } }

When reporting bug or problem, please always include a simple project that can
be used to reproduce the problem. It's much easier to just unpack something,
than reconstruct the project by copy-paste, especially if there's something
left out.

Also, when facing any generators problems, the --debug-generators options can
be of big help.

Here, I can make some guesses by looking at the output. You've asked
Boost.Build to produce 'lib'. One standard generator produces SHARED_LIB +
IMPORT_LIB from STATIC_LIB (and other possible types). When that generator
looks how to create STATIC_LIB, it sees our generator. So, you get the first
transformation shown above -- which involved creating STATIC_LIB using our
tool, and then IMPORT_LIB using standard tool. Both STATIC_LIB and IMPORT_LIB
have the same filename.

My suggestion would be to create a generator class, and in its 'run' method
check that the passed 'name' is not empty. If not, it means it's invoked at
the top of target building process and should call the base run to produce
something. If 'name' is empty, it means it's invoked in the middle of chain,
and should return nothing.

- Volodya

   

>
>
>
> ---------------
>
> libfromdll.jam
>
>
> import generators ;
> import type ;
>
> type.register DEF : def ;
> generators.register-standard libfromdll.deffile : SHARED_LIB : DEF :
> <toolset>msvc ;
> generators.register-standard libfromdll.libfile : DEF : STATIC_LIB ;
>
> actions deffile
> {
> CALL "C:\Program Files\Microsoft Visual Studio 8\VC\vcvarsall.bat"
> ECHO EXPORTS > $(<)
> DUMPBIN /exports $(>) | sed -nf exports.sed >> $(<)
> }
>
> actions libfile
> {
> CALL "C:\Program Files\Microsoft Visual Studio 8\VC\vcvarsall.bat"
> lib /DEF:$(>) /MACHINE:IX86 /OUT:$(<)
> }
>
>
> and then in my jamfile I can say
>
> import libfromdll ;
> def gsl.def : gsl.dll ;
> lib gsl : gsl.def ;

>
>
> _______________________________________________
> Unsubscribe & other changes:
> http://lists.boost.org/mailman/listinfo.cgi/boost-build


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