Boost logo

Boost-Build :

From: Edd Dawson (edd_at_[hidden])
Date: 2006-07-31 18:46:46


Hi all,

I'm new too Boost.build in general. I'm trying it out with some of my current
projects and getting quite excited about dumping my old makefiles and build
scripts! Many thanks to all those that have contributed to Boost.build! Well, on
with the problem.

bjam --version reports:
Boost.Build V2 (Milestone 11)
Boost.Jam 03.1.13

One of the projects I'm trying to move to BBv2 is organized as follows:

trunk (contains Jamroot)
|
|__src (leg++ library source files and Jamfile #1)
|
|__examples (contains Jamfile #2)
| |
. |__glspincard (program code, uses the library. Jamfile #3)
. |__jpeg2ppm (program code, uses the library. Jamfile #4)
.

I can get the (static) library in src to compile fine using gcc (MinGW) and MSVC
8 on Windows. Similarly the jpeg2ppm program compiles fine and links against the
library no sweat. However, building glspincard fails (using gcc only, for now).
I'm running bjam (no args) in the trunk/examples/glspincard directory, which
contains the following Jamfile (#3):

# ----- Jamfile #3 begin -----
lib opengl : : <name>opengl32 ;
lib glu : : <name>glu32 ;
lib glut : : <name>glut32 ;
exe glspincard : [ glob *.cpp ] opengl glu glut : <include>boost ;
# ----- Jamfile #3 end -----

I get compiler errors such as: glspincard.cpp:31:32: boost/shared_ptr.hpp: No
such file or directory

indicating that the boost include path wasn't added correctly. The following
command is used to compile glspincard.cpp:
"g++" -ftemplate-depth-128 -O0 -fno-inline -Wall -g -I"..\..\include"
-I"boost" -c -o "bin\gcc\debug\glspincard.o" "glspincard.cpp"

So the 'boost' alias (correct terminology?) has got wiped somewhere. I'm not
sure where or how. If I change the jam file to use the BOOST_ROOT environment
variable, the project compiles, but does not link. The opengl, glu and glut
link-related command line options aren't expanded/translated correctly; the
linker command used is:

"g++" -Wl,-R -Wl,"C:\Documents and Settings\Developer\My
Documents\projects\software\leg++\trunk\examples\glspincard\bin\gcc\debug"
-Wl,-rpath-link -Wl,"C:\Documents and Settings\Developer\My
Documents\projects\software\leg++\trunk\examples\glspincard\bin\gcc\debug"
-o "bin\gcc\debug\glspincard.exe" -Wl,--start-group "bin\gcc\debug\glspincard.o"
"bin\gcc\debug\glut.dll" "bin\gcc\debug\glu.dll"
"bin\gcc\debug\opengl.dll" "..\..\src\bin\gcc\debug\link-static\libleg++.a"
-Wl,--end-group -g

(e.g. "bin\gcc\debug\glut.dll" should be just -lglut32).

Again, I can workaround this by modifying Jamfile #3 to the following:

# ----- Jamfile #3 (hacked) begin -----
import modules ;
local BOOST_ROOT = [ modules.peek : BOOST_ROOT ] ;
exe glspincard : [ glob *.cpp ] :
     <include>$(BOOST_ROOT)
     <toolset>gcc:<linkflags>-lopengl32
     <toolset>gcc:<linkflags>-lglu32
     <toolset>gcc:<linkflags>-lglut32 ;
# ----- Jamfile #3 (hacked) end -----

Now, I can create a completely unrelated scaffolding OpenGL/GLUT application
with a single JamRoot (containing pretty much the same as my original Jamfile
#3) and the whole thing compiles and links fine. There's clearly something wrong
with some of my intermediate Jamfiles, but I can't see what. So I'm hoping that
some kind soul will examine the Jamfiles/Jamroot below to see if they can spot
my error.

# ----- Jamroot begin -----
use-project /lib/leg++ : src//leg++ ;
project : requirements
     <include>include
     <toolset>msvc:<define>_CRT_SECURE_NO_DEPRECATE ;
build-project src ;
# ----- Jamroot end -----

# ----- Jamfile #1 begin -----
lib leg++ : [ glob *.c ] [ glob *.cpp ]
           : <include>. <link>static
           ;
# ----- Jamfile #1 end -----

# ----- Jamfile #2 begin -----
project : requirements <source>/lib/leg++ ;
build-project jpeg2ppm ;
build-project glspincard ;
# ----- Jamfile #2 end -----

Jamfile #3 is as per the initial listing in this post. I assume Jamfile #4 isn't
relevant.

Apologies for the verbosity of the post. I didn't want to leave anything out.
Can anyone see what I'm doing wrong?

Kind Regards,

Edd Dawson


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