|
Boost-Build : |
From: op_jared_oberhaus (oberhaus_at_[hidden])
Date: 2002-06-21 14:39:24
Thanks, this is super useful! I wasn't doing bjam, I was doing jam.
So, now I have everything set up as such:
- I put allyourbase.jam, boost-base.jam, etc. in my tools/build
directory.
- Set BOOST_BUILD_PATH to that directory
- Set TOP to my top directory, so $TOP/tools/build is the same as
$BOOST_BUILD_PATH
- Downloaded jam.zip from sourceforge, renamed the jam.exe inside to
bjam.exe. They are the same, right?
- set TOOLS=msvc (I have Visual Studio .NET)
- set BUILD=debug
Now I still can't do what I want to do, and here are my two jamfiles
to demonstrate the problem:
-----$TOP/src/testlib1/Jamfile:
SubDir TOP src testlib1 ;
# Build testlib1
CPP_SOURCES =
Library1
;
lib mytestlib1
: $(CPP_SOURCES).cpp
: <include>$(TOP)$(SLASH)src
<threading>multi
: debug release <runtime-link>static/dynamic
;
-----$TOP/src/testlib2/Jamfile:
SubDir TOP src testlib2 ;
# Build testlib2 library
dll mytestlib2
: <lib>../testlib1/mytestlib1
: <include>$(TOP)$(SLASH)src
<threading>multi
: debug release <runtime-link>static/dynamic
;
---------------
Now I cd into testlib1, "bjam", and it all works and makes a bunch
of stuff under directory "bin".
The I cd into testlib2, "bjam", and here's what it gives me:
C:\jared\jared-shared-laptop\tools\build\boost-base.jam:202: in Link-
DLL
*** argument error
* rule Link-action ( target implib ? : sources + : target-type ? )
* called with: ( <src!testlib2\mytestlib2.dll\msvc\debug\runtime-
link-dynamic\threading-multi>mytestlib2.dll <src!testlib2
\mytestlib2.dll\msvc\debug\runtime-link-dynamic\threading-
multi>mytestlib2.lib : : DLL )
* missing argument sources
C:\jared\jared-shared-laptop\tools\build\msvc-tools.jam:120:see
definition of rule 'Link-action' being called
C:\jared\jared-shared-laptop\tools\build\boost-base.jam:173: in main-
from-objects
C:\jared\jared-shared-laptop\tools\build\boost-base.jam:123: in dll-
files
C:\jared\jared-shared-laptop\tools\build\boost-base.jam:1652: in
subvariant-target
C:\jared\jared-shared-laptop\tools\build\boost-base.jam:1724: in
main-target
C:\jared\jared-shared-laptop\tools\build\boost-base.jam:1292: in
declare-local-target
C:\jared\jared-shared-laptop\tools\build\boost-base.jam:1744: in dll
Jamfile:9: in load-jamfiles
C:\jared\jared-shared-laptop\tools\build\bootstrap.jam:15: in boost-
build
C:\jared\jared-shared-laptop\boost-build.jam:2: in module scope
So, trying to figure this out, I decide this isn't super important,
and I modify msvc-tools.jam:120, and change "sources +" to "sources
*", since that's what it is in other places anyways. This gets me a
little further... But now when I invoke bjam in my testlib2
directory, I get this:
C:\jared\jared-shared-laptop\src\testlib2>bjam
don't know how to make <src!testlib1>Library1.cpp
...found 30 targets...
...updating 14 targets...
...can't find 1 target...
...can't make 6 targets...
MkDir1 src
MkDir1 src\testlib1
MkDir1 src\testlib1\bin
MkDir1 src\testlib1\bin\libmytestlib1.lib
MkDir1 src\testlib1\bin\libmytestlib1.lib\msvc
MkDir1 src\testlib1\bin\libmytestlib1.lib\msvc\debug
MkDir1 src\testlib1\bin\libmytestlib1.lib\msvc\debug\runtime-link-
dynamic
MkDir1 src\testlib1\bin\libmytestlib1.lib\msvc\debug\runtime-link-
dynamic\threading-multi
...skipped <src!testlib1\libmytestlib1.lib\msvc\debug\runtime-link-
dynamic\threading-multi>Library1.obj for lack of <src!
testlib1>Library1.cpp...
...skipped <src!testlib1\libmytestlib1.lib\msvc\debug\runtime-link-
dynamic\threading-multi>libmytestlib1.CMD for lack of <src!testlib1
\libmytestlib1.lib\msvc\debug\runtime-link-dynamic\threading-
multi>Library1.obj...
...skipped <src!testlib1\libmytestlib1.lib\msvc\debug\runtime-link-
dynamic\threading-multi>libmytestlib1.lib for lack of <src!testlib1
\libmytestlib1.lib\msvc\debug\runtime-link-dynamic\threading-
multi>Library1.obj...
MkDir1 bin
MkDir1 bin\mytestlib2.dll
MkDir1 bin\mytestlib2.dll\msvc
MkDir1 bin\mytestlib2.dll\msvc\debug
MkDir1 bin\mytestlib2.dll\msvc\debug\runtime-link-dynamic
MkDir1 bin\mytestlib2.dll\msvc\debug\runtime-link-dynamic\threading-
multi
...skipped <src!testlib2\mytestlib2.dll\msvc\debug\runtime-link-
dynamic\threading-multi>mytestlib2.CMD for lack of <src!testlib1
\libmytestlib1.lib\msvc\debug\runtime-link-dynamic\threading-
multi>libmytestlib1.lib...
...skipped <src!testlib2\mytestlib2.dll\msvc\debug\runtime-link-
dynamic\threading-multi>mytestlib2.lib for lack of <src!testlib1
\libmytestlib1.lib\msvc\debug\runtime-link-dynamic\threading-
multi>libmytestlib1.lib...
...skipped <src!testlib2\mytestlib2.dll\msvc\debug\runtime-link-
dynamic\threading-multi>mytestlib2.dll for lack of <src!testlib1
\libmytestlib1.lib\msvc\debug\runtime-link-dynamic\threading-
multi>libmytestlib1.lib...
...skipped 6 targets...
...updated 14 targets...
I determined that this is because it's not doing the relative path
thing correctly, ignoring my ../ and instead taking all this stuff
relative to the current directory. So I modified
my "src/testlib2/Jamfile" to reference ../testlib1/Jamfile with an
absolute path:
-----$TOP/src/testlib2/Jamfile:
SubDir TOP src testlib2 ;
# Build testlib2 library
dll mytestlib2
: <lib>$(TOP)/src/testlib1/mytestlib1
: <include>$(TOP)$(SLASH)src
<threading>multi
: debug release <runtime-link>static/dynamic
;
---------------
Now doing this seems to get me a little farther, and it seems as if
its really attempting to figure out how to link the libraries
together. But this is the output I get:
C:\jared\jared-shared-laptop\src\testlib2>bjam
C:\jared\jared-shared-laptop\tools\build\boost-base.jam:1416: in
find-compatible-subvariant
*** argument error
* rule is-link-compatible ( feature : value1 : value2 )
* called with: ( <target-type> : DLL : )
* missing argument value2
C:\jared\jared-shared-laptop\tools\build\boost-base.jam:1378:see
definition of rule 'is-link-compatible' being called
C:\jared\jared-shared-laptop\tools\build\boost-base.jam:1445: in
link-libraries
C:\jared\jared-shared-laptop\tools\build\boost-base.jam:1641: in
subvariant-target
C:\jared\jared-shared-laptop\tools\build\boost-base.jam:1724: in
main-target
C:\jared\jared-shared-laptop\tools\build\boost-base.jam:1292: in
declare-local-target
C:\jared\jared-shared-laptop\tools\build\boost-base.jam:1744: in dll
Jamfile:9: in load-jamfiles
C:\jared\jared-shared-laptop\tools\build\bootstrap.jam:15: in boost-
build
C:\jared\jared-shared-laptop\boost-build.jam:2: in module scope
As you can see, it's trying to figure out if the two libraries are
compatible to link together or something, I'm not sure. But instead
of figuring out how I couldv'e gotten into this state, I just
commented out the code that's doing the check, because it is just a
validation. So I commented out boost-base.jam:1416-1420.
And once I do that, and invoke bjam again, I get this:
C:\jared\jared-shared-laptop\src\testlib2>bjam
unknown target type for <C:!jared!jared-shared-laptop!src!
testlib1>libmytestlib1.lib
I'm not sure what this means, but how can it not know the target
type? It's just lib!
And here's where I'm stuck. I guess I'm going back to Visual Studio
for now. But I really want this to work, and I want to run these
makefiles on Unix/Windows (I'm just starting on Windows).
Thanks anyone for any help!
--- In jamboost_at_y..., Rene Rivera <grafik666_at_r...> wrote:
> [2002-06-21] op_jared_oberhaus wrote:
>
> Wow! Long email from you ;-) I'll try and point you in the right
> direction...
>
> To answer some general questions...
> * You can get a Win32 binary from the www.boost.org website.
Look in the
> "Building" page near the bottom.
> * If you are using Perforce Jamfiles invoke with "jam",
otherwise if you
> are using Boost.Build invoke with "bjam".
> * Yes it's being used for large projects. Mine is about 10,000
total
> targets, with about 20 EXEs, 10 DLLs, 15-20 LIBs. My minimal build
is 7700
> targets and growing, only debug code.
>
> Now the detailed questions...
>
> >1. I can't figure out how I should get started.
>
> I had the same problem first time ;-)
>
> >2. I can't find any good examples to write Jamfile's, either with
> >standard Perforce Jam and especially not with Boost.Build.
>
> We've been trying to improve the documentation issues with
Boost.Jam but
> alas we are all very busy. I'll try include some of my own project
files
> here so you can get some ideas.
>
> >Building a library (the one thing I can see Boost does)
> ----(snip)
> OPENCLSRC = $(OPENCL)/OpenCL-dist/src ;
>
> lib opencl
> :
> <template>t-thot-base
> $(OPENCLSRC)/adler32.cpp
> $(OPENCLSRC)/md4.cpp
> $(OPENCLSRC)/md5.cpp
> :
> :
> <suppress>true
> ;
> ----(snip)
> >Building a dll and linking in other libraries
> >Building an exe and linking in other libraries
> ----(full)
> subproject utilities/dll_test ;
>
> dll test
> :
> TestImp.cpp
> ThingImp.cpp
> <lib>../../boost
> <lib>../../libraries
> :
> :
> thot-debug
> ;
>
> exe test_dll
> :
> test_dll.cpp
> <dll>test
> :
> :
> thot-debug
> ;
>
> stage bin-stage
> :
> <dll>test
> <exe>test_dll
> :
> :
> thot-debug
> <suppress>true
> ;
> ----(full)
> >Building multiple exe's and running unit tests with them
>
> I don't use the unit test rules.
>
> >When I try something like this in my Jamfile:
> >
> >dll mydll
> > : <lib>../otherlib/compiledlib
> > : blahblah
> > : blahblah
> >
> >It cannot find the actual compiled "compiledlib" that's a target
> >in "../otherlib/Jamfile". The exact same variants are being built
> >when running the Jamfile for the dll and compiling "compiledlib".
It
> >claims it's looking in "../otherlib/compiledlib/....." when it
> >really should be looking in "../otherlib/bin/compiledlib/....".
And
> >when I copy the entire directory so there is the correct path, it
> >looks for "../otherlib/bin/compiledlib/...../compiledlib" and
> >totally ignores the
> >file "../otherlib/bin/compiledlib/...../compiledlib.lib" which is
> >the file I want to link with!
>
> Some specifics from you here would be helpfull. Could you provide
the
> Jamfiles and some of the actuall output from the build?
>
>
> >The claim that Jam/FTJam is easy to use is irrelevant, because
they
> >are useless without large and complex rule files. That is why I
> >turned to Boost.build, but as you can see I'm having trouble
> >figuring out how to get it to work...
>
> Agreed, same reasons I use Boost.Build instead of Perforce-Jam,
and why I've
> contributed as much as I can to it ;-)
>
>
> -- grafik - Don't Assume Anything
> -- rrivera_at_a... - grafik_at_r...
> -- 102708583_at_icq - Grafik666_at_AIM - Grafik_at_j...
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