[bind10-dev] how to build boost libraries on FreeBSD and MacOS X

JINMEI Tatuya / 神明達哉 jinmei at isc.org
Tue Mar 23 06:34:35 UTC 2010


The latest BIND10 package requires a couple of Boost libraries (not
just header files) for full features:
- for complete TCP transport, Boost.Asio is necessary
- for the python binding (xfrin uses this), Boost.Python is necessary

Last week I spent a certain amount of time to figure out how to build
these libraries on FreeBSD (7.2-RELEASE) and Mac OS X (10.6.2).  It
was not a straightforward process, so I think it would be good to
share what I did.

- FreeBSD
  Installing Boost.Asio is easy.  You can simply build and install
  devel/boost-libs from FreeBSD ports.
  For Boost.Python, you can also use boost-python-libs, but if there
  are multiple versions of python installed in the system (one common
  case is both 2.x and 3.y are installed), you should specify the
  python version (3.1 for the purpose of BIND10) as follows:
  + Add the following line to /etc/make.conf:
    PYTHON_VERSION=3.1
  + Create ~/user-config.jam (assuming if it doesn't exist) with the
    following line:
    using python : 3.1 ;
  Without the latter, FreeBSD ports can still build the library and
  will install it as if it's for python 3.1, but it can be built with
  symbols that are only available in older versions of python.

  Once these setting is completed, the usual process of 'make install'
  should just work.

- Mac OS X
  I used macports to install boost, and it was fine for Boost.Asio.

  But as far as I can see, it's not possible to build/install
  Boost.Python for python3.1 using macports, so I decided to build
  both by hand and install them under a personal directory.  I also
  installed the latest version of Boost (1.42) because google told me
  that previous versions of Boost had some portability problems with
  Mac OS 10.6 (but I didn't try the older versions, so I don't know if
  it's true).

  To build the boost libraries (both Asio and Python) with header
  files under ${HOME}/opt, I did:
  - (unpack the boost archive and go to boost_1_42_0/)
  % ./bootstrap.sh --prefix=${HOME}/opt --with-python-version=3.1 --with-python-root=/opt/local/Library/Frameworks/Python.framework/Versions/3.1 --with-python=python3.1
  % ./bjam --with-system --with-thread --with-date_time --with-regex --with-serialization --with-python stage
  % ./bjam --with-system --with-thread --with-date_time --with-regex --with-serialization --with-python install

  Notes: some of the option specifications may be redundant, and the
  "stage" process can probably be omitted.  I'm not sure if all of the
  specified libraries are really necessary if only Asio (in
  boost::system) and Python are needed, but I specified them just
  as shown in the installation page of Boost.Asio.  This was still
  much more lightweight than building everything.

Hope these helps.

---
JINMEI, Tatuya



More information about the bind10-dev mailing list