Boost logo

Boost-Build :

From: Vladimir Prus (ghost_at_[hidden])
Date: 2004-10-08 03:35:22

Hi Alain,

> Hi,
> Sorry for the long post, but I have to explain this in detail.
> I am trying to create a toolset called icc for the ImageCraft
> compiler, so I am basing it on boost-build/tools/gcc.jam
> My biggest problem is the linker.


> My compiler needs to see something like -los to find the library
> libos.a in its search path (which is currently hard-coded as
> c:\icc\lib). I am getting on the command line something like:
> icc12w -o {path}main.exe {path}file1.o file2.o ........ -los -lc12 c12p
> which is good, but still missing: -lbqueue -lcrc -lnvm
> The manual says we can use the <name> feature for pre-built libraries
> (which is what I did for os, c12, c12p), however, the other libraries
> (bqueue, crc, nvm) are being passed in the LIBRARIES variable as:
> ../../../generic/libs/crc/bin/icc/debug/link-static/libcrc.a
> ../../../generic/libs/nvm/bin/icc/debug/link-static/libnvm.a
> ../../../generic/libs/bqueue/bin/icc/debug/link-static/libbqueue.a
> so, I cannot use -l$(LIBRARIES) because the linker appends the prefix
> 'lib' and the suffix '.a' to the above filenames.

So your linker does not allow to specify input library names? That's bad :-(

I need to clarify one question. It seems the above libraries must be pasded
via the "-l" switch. But you say that the search path for that switch is
hardcoded, so I don't understand how the linker will find a library
in ../../../generic/libs/crc/bin/icc/debug/link-static

Anyway, supposing you just want to strip ".a" and "lib" from targets. I
think you'd need to customize the linking generator. To begin with:

class icc-linking-generator : unix-linking-generator
rule generated-targets ( sources + : property-set : project name ? )
return [ unix-linking-generator.generated-targets
$(sources) : $(property-set) : $(property-set) $(name) ] ;

generators.register [ new icc-linking-generator : OBJ : EXE :
<toolset>icc ] ;

Now, you'd need to traverse elements of 'sources', and find all the
libraries. For libraries, you'd need to add relevant <find-static-library>

local sources2 ;
local properties ;
for local s in $(sources)
if [ [ $(s).type ] LIB ]
local name = [ $(s).name ] ;
# Process the 'name' as needed
properties += <find-shared-library>$(name) ;
sources2 += $(s) ;

Then, you remove libraries from sources and add needed properties.

sources = $(sources2) ;
property-set = [ $(property-set).add-raw $(properties) ] ;

I haven't tested the above, but the basic approach should work. You might
need to add additional <search> properties too, but that depends on the
answer to my question.



Boost-Build list run by bdawes at, david.abrahams at, gregod at, cpdaniel at, john at