Boost logo

Boost-Build :

From: Florian Stöhr (florian.stoehr_at_[hidden])
Date: 2003-01-21 04:33:19


Hi,

I wrote a tutorial on compiling boost under NetBSD.

This describes various "dirty" patches to gcc-tools.jam.

Could someone please have a look at this and tell me what can be done in a "cleaner" way ... or can someone edit the gcc-tools.jam
for upcoming releases to support NetBSD by default?

Thank you
Flo

------------------------------------------------------------------------------------------

This document descripes the installation of boost-1.29 under NetBSD-i386 1.6 (should work in
a similar way for other ports).

Note that this refers to NON-STLPORT with GCC 2.95.3, which comes by default with
NetBSD 1.6!

If you want to build the THREADS library, you need to enable threading support for
NetBSD.

Get the GNU PTHREADS package (pth-1.4.1nb2.tgz for NetBSD 1.6) and install it.

This will install several files under /usr/pkg/include and /usr/pkg/lib.

Now edit /etc/profile (e.g.) and add the include/lib paths:

# Add these lines (bash only)
CPPFLAGS=-I/usr/pkg/include; export CPPFLAGS
LDFLAGS=-L/usr/pkg/lib; export LDFLAGS

CLOSE THE TERMINAL and log in again (to reread the /etc/profile).

This will enable the configure script of boost to find your pthread files.

Now get the boost-1.29.0.tar.gz from www.boost.org und unpack it, e.g.

root_at_flo [/usr] # tar -xvzf /home/flo/downloads/boost-1.29.0.tar.gz

I will refer to (boost) as the root directory of boost, e.g. /usr/boost_1_29_0.

First of all, you need the build the make-replacement "bjam" of boost. Notethat
this is NOT the traditional bjam! It's in the tools/build/jam_src directory. Invoke
make on it.

root_at_flo [/usr/boost_1_29_0/tools/build/jam_src] # make

The bjam executable now resides in ./bin.netbsdx86. If you don't have traditional
bjam installed on your system (hope so!), just copy the bjam into a directory in
the path

root_at_flo [/usr/boost_1_29_0/tools/build/jam_src/bin.netbsdx86] # cp bjam /usr/bin

Now BEFORE you try to build boost, you have to edit the jamfile
(boost)/tools/build/gcc-tools.jam due to a bug in the gcc (?) that comes with NetBSD 1.6

Open the file and replace every occurrence of

-isystem

by

-I

Now replace every occurence of

-pthread

by

-lpthread

Unfortunately, this is not yet enough, since the build process itself doesn't seem to
use the CPPFLAGS and LDFLAGS environment variables.

So search for "actions gcc-Cc-action" in the file. Insert "-I/usr/pkg/include" and
"-L/usr/pkg/lib" into the gcc-call, perhaps just before the "-I$(SPACE)".

Then do the same once again for the "actions gcc-C++-action" block, insert our
dirs before the '-I"$(HDRS)"'.

Before making boost, be sure to invoke the configure script.

root_at_flo [/usr/boost_1_29_0/libs/config] # ./configure

Now open the file USER.HPP and add the line

#define BOOST_HAS_THREADS

Your final step will now be to copy this file USER.HPP from libs config dir
to the boost config dir:

root_at_flo [/usr/boost_1_29_0/libs/config] # cp user.hpp ../../boost/config

Then, you can change to the boost root directory and simple invoke make with the
gcc-option:

root_at_flo [/usr/boost_1_29_0] # bjam "-sTOOLS=gcc"

Enjoy boost!
 ------=_NextPart_000_00A9_01C2C138.840A92D0 Content-Type: text/html;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=Content-Type content="text/html; charset=iso-8859-1">
<META content="MSHTML 6.00.2716.2200" name=GENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY bgColor=#ffffff>
<DIV><FONT face=Arial size=2>Hi,</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT>&nbsp;</DIV>
<DIV><FONT face=Arial size=2>I wrote a tutorial on compiling boost under NetBSD.
</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT>&nbsp;</DIV>
<DIV><FONT face=Arial size=2>This describes various "dirty" patches&nbsp;to
gcc-tools.jam.</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT>&nbsp;</DIV>
<DIV><FONT face=Arial size=2>Could someone please have a look at this
</FONT><FONT face=Arial size=2>and tell me what can be done in a "cleaner" way
... or can&nbsp; someone edit the gcc-tools.jam</FONT></DIV>
<DIV><FONT face=Arial size=2>for upcoming releases to support NetBSD by
default?</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT>&nbsp;</DIV>
<DIV><FONT face=Arial size=2>Thank you</FONT></DIV>
<DIV><FONT face=Arial size=2>Flo</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT>&nbsp;</DIV>
<DIV><FONT face=Arial
size=2>------------------------------------------------------------------------------------------</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT>&nbsp;</DIV>
<DIV><FONT face=Arial size=2>This document descripes the installation of
boost-1.29 under NetBSD-i386 1.6 (should work in<BR>a similar way for other
ports).</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT>&nbsp;</DIV>
<DIV><FONT face=Arial size=2>Note that this refers to NON-STLPORT with GCC
2.95.3, which comes by default with<BR>NetBSD 1.6!</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT>&nbsp;</DIV>
<DIV><FONT face=Arial size=2>If you want to build the THREADS library, you need
to enable threading support for<BR>NetBSD.</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT face=Arial size=2>Get the GNU PTHREADS package (pth-1.4.1nb2.tgz for
NetBSD 1.6) and install it.</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT face=Arial size=2>This will install several files under
/usr/pkg/include and /usr/pkg/lib.</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT face=Arial size=2>Now edit /etc/profile (e.g.) and add the
include/lib paths:</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT face=Arial size=2># Add these lines (bash
only)<BR>CPPFLAGS=-I/usr/pkg/include; export CPPFLAGS<BR>LDFLAGS=-L/usr/pkg/lib;
export LDFLAGS</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT face=Arial size=2>CLOSE THE TERMINAL and log in again (to reread the
/etc/profile).</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT face=Arial size=2>This will enable the configure script of boost to
find your pthread files.</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT face=Arial size=2>Now get the boost-1.29.0.tar.gz from <A
href="http://www.boost.org">www.boost.org</A> und unpack it, e.g.</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT face=Arial size=2><A href="mailto:root_at_flo">root_at_flo</A> [/usr] # tar
-xvzf /home/flo/downloads/boost-1.29.0.tar.gz</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT face=Arial size=2>I will refer to (boost) as the root directory of
boost, e.g. /usr/boost_1_29_0.</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT face=Arial size=2>First of all, you need the build the
make-replacement "bjam" of boost. Note that<BR>this is NOT the traditional bjam!
It's in the tools/build/jam_src directory. Invoke<BR>make on it.</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT face=Arial size=2><A href="mailto:root_at_flo">root_at_flo</A>
[/usr/boost_1_29_0/tools/build/jam_src] # make</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT face=Arial size=2>The bjam executable now resides in ./bin.netbsdx86.
If you don't have traditional<BR>bjam installed on your system (hope so!), just
copy the bjam into a directory in<BR>the path</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT face=Arial size=2><A href="mailto:root_at_flo">root_at_flo</A>
[/usr/boost_1_29_0/tools/build/jam_src/bin.netbsdx86] # cp bjam
/usr/bin</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT face=Arial size=2>Now BEFORE you try to build boost, you have to edit
the jamfile<BR>(boost)/tools/build/gcc-tools.jam due to a bug in the gcc (?)
that comes with NetBSD 1.6</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT face=Arial size=2>Open the file and replace every occurrence
of</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT face=Arial size=2>-isystem</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT face=Arial size=2>by</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT face=Arial size=2>-I</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT face=Arial size=2>Now replace every occurence of</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT face=Arial size=2>-pthread</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT face=Arial size=2>by</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT face=Arial size=2>-lpthread</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT face=Arial size=2>Unfortunately, this is not yet enough, since the
build process itself doesn't seem to<BR>use the CPPFLAGS and LDFLAGS environment
variables.</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT face=Arial size=2>So search for "actions gcc-Cc-action" in the file.
Insert "-I/usr/pkg/include" and<BR>"-L/usr/pkg/lib" into the gcc-call, perhaps
just before the "-I$(SPACE)".</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT face=Arial size=2>Then do the same once again for the "actions
gcc-C++-action" block, insert our<BR>dirs before the '-I"$(HDRS)"'.</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT face=Arial size=2>Before making boost, be sure to invoke the
configure script.</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT face=Arial size=2><A href="mailto:root_at_flo">root_at_flo</A>
[/usr/boost_1_29_0/libs/config] # ./configure</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT face=Arial size=2>Now open the file USER.HPP and add the
line</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT face=Arial size=2>#define BOOST_HAS_THREADS</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT face=Arial size=2>Your final step will now be to copy this file
USER.HPP from libs config dir<BR>to the boost config dir:</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT face=Arial size=2><A href="mailto:root_at_flo">root_at_flo</A>
[/usr/boost_1_29_0/libs/config] # cp user.hpp ../../boost/config</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT face=Arial size=2>Then, you can change to the boost root directory
and simple invoke make with the<BR>gcc-option:</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT face=Arial size=2><A href="mailto:root_at_flo">root_at_flo</A>
[/usr/boost_1_29_0] # bjam "-sTOOLS=gcc"</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT face=Arial size=2>Enjoy boost!</FONT></DIV></BODY></HTML>
 ------=_NextPart_000_00A9_01C2C138.840A92D0--


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