Boost logo

Boost-Build :

From: Philipp Frauenfelder (pfrauenf_at_[hidden])
Date: 2004-07-07 03:46:33


Dear Volodya

On Tue, Jul 06, 2004 at 05:43:58PM +0400, Vladimir Prus wrote:
> > if <have-pardiso>yes {
>
> I think you've a problem here. This "if" will compare the *string*
> <have-pardiso>yes with empty string, and it always gives you true value.

[ ... ]

> if ! [ GLOB /path/to_pardiso : pardiso.a ]
> {
> feature.set-default <have-pardiso> : no ;
> alias pardiso ;
> }
> else
> {
> }
>
> In other word, it's necessary to somehow detect if the library is installed --
> by asking user, searching for some file, and so on. And if you detected
> library presence you can use that in "if". No need to first set
> <have-pardiso> to "no" and then check the value.

Initially, I intended to ask the user. But the GLOB trick is even
nicer. Thanks. I now have this stuff in site-config.jam:
----8<----8<----8<----8<----8<----8<----8<----
feature.feature have-pardiso : yes no ;
PARDISO_PATH = /scratch/pfrauenf/pardiso_example ;
PARDISO_LIB = pardiso32 ;
if ! [ GLOB $(PARDISO_PATH) : lib$(PARDISO_LIB)* ] {
Echo * Direct solver Pardiso not installed. ;
feature.set-default <have-pardiso> : no ;
alias pardiso ;
} else {
Echo * Activating support for direct solver Pardiso. ;
feature.set-default <have-pardiso> : yes ;
lib pardiso : : <name>$(PARDISO_LIB) <search>$(PARDISO_PATH) :
: <include>$(PARDISO_PATH) <define>HAS_PARDISO ;
}
----8<----8<----8<----8<----8<----8<----8<----

In the subproject Jamfile, I have the following things:
----8<----8<----8<----8<----8<----8<----8<----
project concepts-2/operator
: requirements <library>/concepts-2/sparseqr//libconceptssparseqr
<have-pardiso>yes:<library>/site-config//pardiso
<have-pardiso>yes:<use>/site-config//pardiso
<library>/site-config//lapack ;

SOURCES = [ ... ];

lib libconceptsoperator : $(SOURCES) : <have-pardiso>yes:<source>pardiso.cc ;
----8<----8<----8<----8<----8<----8<----8<----

[ ... ]

> I'm sure I've added some code to prevent duplicate sources.
> Would you mind sending me the complete Jamfiles and
> site-config.jam, so that I can reproduce the problem?

OK, here is the output:
----8<----8<----8<----8<----8<----8<----8<----
boost-cvs/multiple-linking> ../tools/build/jam_src/bin.linuxx86/bjam -d2 --v2 -a
...found 18 targets...
...updating 6 targets...
MkDir1 ../bin.v2

mkdir "../bin.v2"

MkDir1 ../bin.v2/multiple-linking

mkdir "../bin.v2/multiple-linking"

MkDir1 ../bin.v2/multiple-linking/gcc

mkdir "../bin.v2/multiple-linking/gcc"

MkDir1 ../bin.v2/multiple-linking/gcc/debug

mkdir "../bin.v2/multiple-linking/gcc/debug"

gcc.compile.c++ ../bin.v2/multiple-linking/gcc/debug/debug.o

"g++" -Wall -ftemplate-depth-100 -O0 -fno-inline -g -I"/scratch/pfrauenf/boost-cvs" -c -o "../bin.v2/multiple-linking/gcc/debug/debug.o" "../multiple-linking/debug.cc"

gcc.link.dll ../bin.v2/multiple-linking/gcc/debug/libmultiple-linking.so

"g++" -g -L"/usr/lib/atlas/sse" -o "../bin.v2/multiple-linking/gcc/debug/libmultiple-linking.so" -Wl,-h -Wl,libmultiple-linking.so -shared "../bin.v2/multiple-linking/gcc/debug/debug.o" -Wl,-Bdynamic -lg2c -lblas -llapack -Wl,-Bstatic -Wl,-Bdynamic -lg2c -lblas -llapack -Wl,-Bstatic -Wl,-Bdynamic

...updated 6 targets...
----8<----8<----8<----8<----8<----8<----8<----
As you can see, the libraries '-lg2c -lblas -llapack' are linked
twice.

The changes relative to the CVS checkout of yesterday can be found in
http://www.math.ethz.ch/~pfrauenf/test/multiple-linking.zip
The zip archive containts:
----8<----8<----8<----8<----8<----8<----8<----
boost-cvs> zip multiple-linking Jamfile.v2 project-root.jam multiple-linking/* tools/build/v2/site-config.jam
updating: Jamfile.v2 (deflated 54%)
updating: project-root.jam (deflated 17%)
updating: tools/build/v2/site-config.jam (deflated 44%)
adding: multiple-linking/debug.cc (deflated 47%)
adding: multiple-linking/debug.hh (deflated 60%)
adding: multiple-linking/Jamfile.v2 (deflated 16%)
----8<----8<----8<----8<----8<----8<----8<----

I just did a 'cvs update' from sf.net and redid the test above
and the result stays the same: the libraries are linked twice.

Thanks for your help. Regards

-- 
Philipp | work: pfrauenf_at_[hidden] +41 44 632 60 38
Frauenfelder | home: pfrauenf_at_[hidden] +41 44 862 73 14
[PGP] | http://www.math.ethz.ch/~pfrauenf/
Proudly running Debian GNU/Linux. See http://www.debian.org/
 

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