|
Boost-Build : |
From: David Deakins (ddeakins_at_[hidden])
Date: 2007-08-13 18:10:35
Robert Ramey wrote:
> One more thing, The tests which fail to link do so with the message:
>
> LINK : fatal error LNK1181: cannot open input file 'stlportstld.5.lib'
>
>
> Robert Ramey wrote:
>> Robert Ramey wrote:
>>> However, I'm quite surprised to see the bin.v2 directory look like
>>> the following:
>>>
>>> bin.v2/libs/serialization/test/test_const_fail1.test/msvc-7.1/debug/stlport-5.0/stlport-5.0/threading-multi
>> whoops - above should read:
>>
>> bin.v2/libs/serialization/test/test_const_fail1.test/msvc-7.1/debug/stdlib-stlport-5.0/stdlib-stlport-5.0/threading-multi>>
>> Note that the repetition of stlport-5.0 is not a typo - it appears>
>> twice in the path.
>
Hi Robert,
I ran into both of these issues with BBv2 stlport.jam file as well as a
couple others. I spent some time debugging this a while back
(http://lists.boost.org/boost-build/2006/09/15036.php), but it looks
like I was negligent in submitting a full-blown path. Attached is the
version of the tools/build/v2/tools/stlport.jam that I have been using,
along with a patch against the current rev of the file. I'm not sure if
I solved these issues in the ideal manner, but it seems to work for my
installation.
-Dave
# Copyright Gennadiy Rozental
# Copyright 2006 Rene Rivera
# Copyright 2003, 2004, 2006 Vladimir Prus
# Distributed under the Boost Software License, Version 1.0.
# (See accompanying file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt)
# The STLPort is usable by means of 'stdlib' feature. When
# stdlib=stlport is specified, default version of STLPort will be used,
# while stdlib=stlport-4.5 will use specific version.
# The subfeature value 'hostios' means to use host compiler's iostreams.
#
# The specific version of stlport is selected by features:
# The <link> feature selects between static and shared library
# The <runtime-debugging>on selects STLPort with debug symbols
# and stl debugging.
# There's no way to use STLPort with debug symbols but without
# stl debugging.
# TODO: must implement selection of different STLPort installations based
# on used toolset.
# Also, finish various flags:
#
# This is copied from V1 toolset, "+" means "implemented"
#+flags $(CURR_TOOLSET) DEFINES <stlport-iostream>off : _STLP_NO_OWN_IOSTREAMS=1 _STLP_HAS_NO_NEW_IOSTREAMS=1 ;
#+flags $(CURR_TOOLSET) DEFINES <stlport-extensions>off : _STLP_NO_EXTENSIONS=1 ;
# flags $(CURR_TOOLSET) DEFINES <stlport-anachronisms>off : _STLP_NO_ANACHRONISMS=1 ;
# flags $(CURR_TOOLSET) DEFINES <stlport-cstd-namespace>global : _STLP_VENDOR_GLOBAL_CSTD=1 ;
# flags $(CURR_TOOLSET) DEFINES <exception-handling>off : _STLP_NO_EXCEPTIONS=1 ;
# flags $(CURR_TOOLSET) DEFINES <stlport-debug-alloc>on : _STLP_DEBUG_ALLOC=1 ;
#+flags $(CURR_TOOLSET) DEFINES <runtime-build>debug : _STLP_DEBUG=1 _STLP_DEBUG_UNINITIALIZED=1 ;
#+flags $(CURR_TOOLSET) DEFINES <runtime-link>dynamic : _STLP_USE_DYNAMIC_LIB=1 ;
import feature : feature subfeature ;
import project ;
import "class" : new ;
import targets ;
import property-set ;
import common ;
import type ;
# Make this module into a project.
project.initialize $(__name__) ;
project stlport ;
# The problem: how to request to use host compiler's iostreams?
#
# Solution 1: Global 'stlport-iostream' feature.
# That's ugly. Subfeature make more sense for stlport-specific thing.
# Solution 2: Use subfeature with two values, one of which ("use STLPort iostream")
# is default.
# The problem is that such subfeature will appear in target paths, and that's ugly
# Solution 3: Use optional subfeature with only one value.
feature.extend stdlib : stlport ;
feature.compose <stdlib>stlport : <library>/stlport//stlport ;
# STLport iostreams or native iostreams
subfeature stdlib stlport : iostream : hostios : optional propagated ;
# STLport extensions
subfeature stdlib stlport : extensions : noext : optional propagated ;
# STLport anachronisms -- NOT YET SUPPORTED
# subfeature stdlib stlport : anachronisms : on off ;
# STLport debug allocation -- NOT YET SUPPORTED
#subfeature stdlib stlport : debug-alloc : off on ;
# Declare a special target class to handle the creation of search-lib-target
# instances for STLport. We need a special class, because otherwise we'll have
# - declare prebuilt targets for all possible toolsets. And by the time 'init'
# is called we don't even know the list of toolsets that are registered
# - when host iostreams are used, we really should produce nothing. It would
# be hard/impossible to achieve this using prebuilt targets.
class stlport-target-class : basic-target
{
import feature project type errors generators ;
import set : difference ;
rule __init__ ( project : headers ? : libraries * : version ? )
{
basic-target.__init__ stlport : $(project) ;
self.headers = $(headers) ;
self.libraries = $(libraries) ;
self.version = $(version) ;
self.version.5 = [ MATCH "^(5[.][0123456789]+).*" : $(version) ] ;
local requirements ;
requirements += <stdlib-stlport:version>$(self.version) ;
self.requirements = [ property-set.create $(requirements) ] ;
}
rule generate ( property-set )
{
# Since this target is built with <stdlib>stlport, it will also
# have <library>/stlport//stlport in requirements, which will
# cause a loop in main target references. Remove that property
# manually.
property-set = [ property-set.create
[ difference
[ $(property-set).raw ] :
<library>/stlport//stlport
<stdlib>stlport
]
] ;
return [ basic-target.generate $(property-set) ] ;
}
rule construct ( name : source-targets * : property-set )
{
# Deduce the name of stlport library, based on toolset and
# debug setting.
local raw = [ $(property-set).raw ] ;
local hostios = [ feature.get-values <stdlib-stlport:iostream> : $(raw) ] ;
local toolset = [ feature.get-values <toolset> : $(raw) ] ;
if $(self.version.5)
{
# Version 5.x
# STLport host IO streams no longer supported. So we always
# need libraries.
# name: stlport(stl)?[dg]?(_static)?.M.R
local name = stlport ;
if [ feature.get-values <runtime-debugging> : $(raw) ] = "on"
{
name += stl ;
switch $(toolset)
{
case gcc* : name += g ;
case darwin* : name += g ;
case * : name += d ;
}
}
if [ feature.get-values <link> : $(raw) ] = "static"
{
name += _static ;
}
name += .$(self.version.5) ;
name = $(name:J=) ;
if [ feature.get-values <install-dependencies> : $(raw) ] = "on"
{
#~ Allow explicitly asking to install the STLport lib by
#~ refering to it directly: /stlport//stlport/<install-dependencies>on
#~ This allows for install packaging of all libs one might need for
#~ a standalone distribution.
import path : make : path-make ;
local runtime-link
= [ feature.get-values <runtime-link> : $(raw) ] ;
local lib-file.props
= [ property-set.create $(raw) <link>$(runtime-link) ] ;
local lib-file.prefix
= [ type.generated-target-prefix $(runtime-link:U)_LIB : $(lib-file.props) ] ;
local lib-file.suffix
= [ type.generated-target-suffix $(runtime-link:U)_LIB : $(lib-file.props) ] ;
lib-file.prefix
?= "" "lib" ;
lib-file.suffix
?= "" ;
local lib-file
= [ GLOB $(self.libraries) [ modules.peek : PATH ] :
$(lib-file.prefix)$(name).$(lib-file.suffix) ] ;
lib-file
= [ new file-reference [ path-make $(lib-file[1]) ] : $(self.project) ] ;
lib-file
= [ $(lib-file).generate "" ] ;
local lib-file.requirements
= [ targets.main-target-requirements
[ $(lib-file.props).raw ] <file>$(lib-file[-1])
: $(self.project) ] ;
return [ generators.construct $(self.project) $(name) : LIB : $(lib-file.requirements) : : LIB ] ;
}
else
{
# Add the lib file suffix because some of the compiler jamfiles (msvc) expect
# it to be there. If no suffix is present, when they use :S= they will strip
# off anything following the last . in the name.
local lib-file.suffix ;
if [ feature.get-values <link> : $(raw) ] = "static"
{
lib-file.suffix = [ type.generated-target-suffix STATIC_LIB : $(property-set) ] ;
}
else
{
lib-file.suffix = [ type.generated-target-suffix IMPORT_LIB : $(property-set) ] ;
}
#~ Otherwise, it's just a regular usage of the library.
return [ generators.construct
$(self.project) $(name).$(lib-file.suffix) : SEARCHED_LIB : $(property-set) ] ;
}
}
else if ! $(hostios) && $(toolset) != msvc
{
# We don't need libraries if host istreams are used. For
# msvc, automatic library selection will be used.
# name: stlport_<toolset>(_stldebug)?
local name = stlport ;
name = $(name)_$(toolset) ;
if [ feature.get-values <runtime-debugging> : $(raw) ] = "on"
{
name = $(name)_stldebug ;
}
# Add the lib file suffix because some of the compiler jamfiles (msvc) expect
# it to be there. If no suffix is present, when they use :S= they will strip
# off anything following the last . in the name.
local lib-file.suffix ;
if [ feature.get-values <link> : $(raw) ] = "static"
{
lib-file.suffix = [ type.generated-target-suffix STATIC_LIB : $(property-set) ] ;
}
else
{
lib-file.suffix = [ type.generated-target-suffix IMPORT_LIB : $(property-set) ] ;
}
return [ generators.construct
$(self.project) $(name).$(lib-file.suffix) : SEARCHED_LIB : $(property-set) ] ;
}
else
{
return [ property-set.empty ] ;
}
}
rule compute-usage-requirements ( subvariant )
{
local usage-requirements =
<include>$(self.headers)
<dll-path>$(self.libraries)
<library-path>$(self.libraries)
;
local rproperties = [ $(subvariant).build-properties ] ;
# CONSIDER: should this "if" sequence be replaced with
# some use of 'property-map' class?
if [ $(rproperties).get <runtime-debugging> ] = "on"
{
usage-requirements +=
<define>_STLP_DEBUG=1
<define>_STLP_DEBUG_UNINITIALIZED=1 ;
}
if [ $(rproperties).get <link> ] = "shared"
{
usage-requirements +=
<define>_STLP_USE_DYNAMIC_LIB=1 ;
}
if [ $(rproperties).get <stdlib-stlport:extensions> ] = noext
{
usage-requirements +=
<define>_STLP_NO_EXTENSIONS=1 ;
}
if [ $(rproperties).get <stdlib-stlport:iostream> ] = hostios
{
usage-requirements +=
<define>_STLP_NO_OWN_IOSTREAMS=1
<define>_STLP_HAS_NO_NEW_IOSTREAMS=1 ;
}
if $(self.version.5)
{
# Version 5.x
if [ $(rproperties).get <threading> ] = "single"
{
# Since STLport5 doesn't normally support single-thread
# we force STLport5 into the multi-thread mode. Hence
# getting what other libs provide of single-thread code
# linking against a multi-thread lib.
usage-requirements +=
<define>_STLP_THREADS=1 ;
}
}
#~ Allow setting up to use STLport by only using the library target
#~ /stlport//stlport.
#~ TODO: Make it possible to use /stlport//stlport/<version>5.0 to select
#~ a specific configured version.
if $(self.version)
{
usage-requirements +=
<stdlib>stlport <stdlib-stlport:version>$(self.version) ;
}
else
{
usage-requirements +=
<stdlib>stlport ;
}
return [ property-set.create $(usage-requirements) ] ;
}
}
rule stlport-target ( headers ? : libraries * : version ? )
{
local project = [ project.current ] ;
targets.main-target-alternative
[ new stlport-target-class $(project) : $(headers) : $(libraries)
: $(version)
] ;
}
local .version-subfeature-defined ;
# Initialize stlport support.
rule init (
version ? :
headers # Location of header files
libraries * # Location of libraries, lib and bin subdirs of STLport.
)
{
# FIXME: need to use common.check-init-parameters here.
# At the moment, that rule always tries to define subfeature
# of the 'toolset' feature, while we need to define subfeature
# of <stdlib>stlport, so tweaks to check-init-parameters are needed.
if $(version)
{
if ! $(.version-subfeature-defined)
{
feature.subfeature stdlib stlport : version : : propagated ;
.version-subfeature-defined = true ;
}
feature.extend-subfeature stdlib stlport : version : $(version) ;
}
# Declare the main target for this STLPort version.
stlport-target $(headers) : $(libraries) : $(version) ;
}
Index: stlport.jam
===================================================================
--- stlport.jam (revision 38586)
+++ stlport.jam (working copy)
@@ -124,7 +124,7 @@
# STLport host IO streams no longer supported. So we always
# need libraries.
- # name: stlport(stl)?[dg]?.M.R
+ # name: stlport(stl)?[dg]?(_static)?.M.R
local name = stlport ;
if [ feature.get-values <runtime-debugging> : $(raw) ] = "on"
{
@@ -136,6 +136,12 @@
case * : name += d ;
}
}
+
+ if [ feature.get-values <link> : $(raw) ] = "static"
+ {
+ name += _static ;
+ }
+
name += .$(self.version.5) ;
name = $(name:J=) ;
@@ -156,6 +162,7 @@
= [ type.generated-target-suffix $(runtime-link:U)_LIB : $(lib-file.props) ] ;
lib-file.prefix
?= "" "lib" ;
+
lib-file.suffix
?= "" ;
local lib-file
@@ -169,13 +176,26 @@
= [ targets.main-target-requirements
[ $(lib-file.props).raw ] <file>$(lib-file[-1])
: $(self.project) ] ;
- return [ generators.construct $(self.project) $(name) : LIB : $(lib-file.requirements) ] ;
+ return [ generators.construct $(self.project) $(name) : LIB : $(lib-file.requirements) : : LIB ] ;
}
else
{
+ # Add the lib file suffix because some of the compiler jamfiles (msvc) expect
+ # it to be there. If no suffix is present, when they use :S= they will strip
+ # off anything following the last . in the name.
+ local lib-file.suffix ;
+ if [ feature.get-values <link> : $(raw) ] = "static"
+ {
+ lib-file.suffix = [ type.generated-target-suffix STATIC_LIB : $(property-set) ] ;
+ }
+ else
+ {
+ lib-file.suffix = [ type.generated-target-suffix IMPORT_LIB : $(property-set) ] ;
+ }
+
#~ Otherwise, it's just a regular usage of the library.
return [ generators.construct
- $(self.project) $(name) : SEARCHED_LIB : $(property-set) ] ;
+ $(self.project) $(name).$(lib-file.suffix) : SEARCHED_LIB : $(property-set) ] ;
}
}
else if ! $(hostios) && $(toolset) != msvc
@@ -191,8 +211,21 @@
name = $(name)_stldebug ;
}
+ # Add the lib file suffix because some of the compiler jamfiles (msvc) expect
+ # it to be there. If no suffix is present, when they use :S= they will strip
+ # off anything following the last . in the name.
+ local lib-file.suffix ;
+ if [ feature.get-values <link> : $(raw) ] = "static"
+ {
+ lib-file.suffix = [ type.generated-target-suffix STATIC_LIB : $(property-set) ] ;
+ }
+ else
+ {
+ lib-file.suffix = [ type.generated-target-suffix IMPORT_LIB : $(property-set) ] ;
+ }
+
return [ generators.construct
- $(self.project) $(name) : SEARCHED_LIB : $(property-set) ] ;
+ $(self.project) $(name).$(lib-file.suffix) : SEARCHED_LIB : $(property-set) ] ;
}
else
{
@@ -217,7 +250,7 @@
<define>_STLP_DEBUG=1
<define>_STLP_DEBUG_UNINITIALIZED=1 ;
}
- if [ $(rproperties).get <runtime-debugging> ] = "on"
+ if [ $(rproperties).get <link> ] = "shared"
{
usage-requirements +=
<define>_STLP_USE_DYNAMIC_LIB=1 ;
@@ -254,7 +287,7 @@
if $(self.version)
{
usage-requirements +=
- <stdlib>stlport-$(self.version) ;
+ <stdlib>stlport <stdlib-stlport:version>$(self.version) ;
}
else
{
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