wiki:SystemNotesMacOSXMountainLion

This system notes describe a process to build BIND 10 on MacOS X 10.8 (Mountain Lion).

These notes are quite dated. Keep in mind that many things have changed since they were created. In particular, Kea does not require python3 or SQLite. It can also use either OpenSSL or Botan, so Botan is no longer a strict dependency. More recent build instructions for OS X 10.9.

I'll first describe the process for "normal" users who only need to install and use a release version of BIND 10; for developers who need to build (and possibly modify) a development version, I'll add specific process and notes at the end of this memo.

0. Install necessary tools.

Unless this is your first time to build an application on OS X by hand, it's quite likely that you've already done (something like) this process. But I'm briefly summarizing this phase just in case.

BIND 10 depends on several external packages, and you'll need to install a packaging system for OS X in addition to Xcode. I've been using HomeBrew for quite some time, and this page assumes HomeBrew as the packaging system. I used to use MacPorts to build BIND 10 on earlier versions of OS X. It may still work today.

  • Install Xcode Command Line Tools. The specific procedure may differ based on the version of Xcode available at the time of your installation. In my case (version 4.6; 4.5.2 is believed to work too), I installed Xcode from App Store (it's free), invoke it, and install Command Line Tools from its "Downloads" preference panel.
  • (Make sure you have write permission on and under /usr/local; Otherwise there will be various troubles with HomeBrew)
  • Install HomeBrew as shown in its top web page:
    % ruby -e "$(curl -fsSkL raw.github.com/mxcl/homebrew/go)"
    

1. Shortcut: install BIND 10 from HomeBrew formula.

The easiest (in terms of the number of commands you need to type) way to install BIND 10 would be to use the experimental HomeBrew formula I've created. You'll only need to invoke one command (and wait for a while):

% brew install https://raw.github.com/jinmei/homebrew/bind10/Library/Formula/bind10.rb

If this succeeds, you're all set; go to Section 4 below to run BIND 10.

Some additional notes in case you are interested or need trouble shooting:

  • Previous versions of HomeBrew had an issue in its python3 formula that caused a run time failure for BIND 10; the latest version as of February 23, 2013 does not have this issue. To confirm, perform the following simple check:
    % python3 -c 'import sqlite3'
    
    If this succeeds (without any output), your python3 does not have this issue and should work for BIND 10. If it fails with an error message about _sqlite3.so, you'll need to update HomeBrew and reinstall python3.
  • Likewise, previous versions of HomeBrew required X11 to build python3; it's not the case any more. If you fail to install python3 for this reason, make sure you install a sufficiently new version of HomeBrew.

2. Install necessary dependencies.

All of the required dependencies are available in HomeBrew packages, so their installation is *theoretically* easy; there are some tricky parts, though. Still, this is basically a copy-and-paste-and-run process:

% brew install python3
% brew install boost
% brew install botan
% brew install log4cplus

Notes:

  • Same notes as those listed in the previous section (except the one specific to the bind10 formula) also apply here.
  • You don't have to install sqlite: it's installed as a side effect of installing python3.

3. Download, build, and install BIND 10.

This is a complete process to download and build BIND 10 1.0.0 released in February 2013. I believe it works for most of the recently released snapshot versions (and hopefully for future released versions):

% ftp -a ftp://ftp.isc.org/isc/bind10/1.0.0/bind10-1.0.0.tar.gz
% tar zxf bind10-1.0.0.tar.gz
(apply patch: see below)
% SQLITE_CFLAGS=-I/usr/local/opt/sqlite/include SQLITE_LIBS='-L/usr/local/opt/sqlite/lib -lsqlite3' ./configure --prefix=/opt/bind10
% make
% sudo make install

The installation prefix doesn't have to be /opt/bind10; it's just an example. Also, depending on where to install it and whether you have write permission in the install destination, you may or may not need sudo at the final step.

Like the dependency installation phase, there are a couple of tricky points (you don't have to read this unless you want to know why we need to do some unusual setup in the above example):

  • HomeBrew does not install sqlite3 in publicly visible directories because Mountain Lion has its own sqlite (this is a basic policy of HomeBrew). So we need to specify some environment variables to tell the ./configure script where to search for sqlite header files and libraries.
  • The latest version of HomeBrew as of this writing (February 23, 2013) installs Boost 1.53.0. Unfortunately, it doesn't work with the release version of BIND 10 as reported in: http://bind10.isc.org/ticket/2764 Until this ticket is resolved, you'll need to apply the proposed patch by hand before building BIND 10:
    % cd bind10-1.0.0
    % curl -o - http://bind10.isc.org/raw-attachment/ticket/2764/base_n.diff | patch -p1
    
    Alternatively, you could use an older version of Boost by downloading from http://www.boost.org/ and extracting it somewhere. You'll need to specify the path to your local Boost header files using the --with-boost-include ./configure option.

4. Run BIND10!

Congratulations, you are now ready to run BIND10!

Run the BIND10 system in one console:

% sudo /opt/bind10/sbin/bind10

(Note: if you are here directly from Section 1, the path to bind10 should be /usr/local/sbin/bind10)

Next, create an account for bindctl:

% cd /opt/bind10/etc/bind10
% sudo /opt/bind10/sbin/b10-cmdctl-usermgr
% sudo chmod 600 cmdctl-accounts.csv

(or /usr/local/sbin/b10-cmdctl-usermgr if you are here directly from Section 1).

And start configuring it from the other console:

% /opt/bind10/bin/bindctl

(or /usr/local/bin/bindctl if you are here directly from Section 1).

5. For Developers

Build/Install dependencies for developers

To build BIND 10 on a cloned git repository, you'll need some other external packages. They can be installed via HomeBrew:

% brew install automake
% brew install libtool

In addition, as a developer you'd also need to make googletest available. This is not absolutely necessary if you only need to build BIND 10, but for serious development it's crucial. It cannot be "installed" via HomeBrew anymore; you need to fetch a source archive and extract it by hand:

% curl -o gtest-1.6.0.zip  http://googletest.googlecode.com/files/gtest-1.6.0.zip
% unzip gtest-1.6.0.zip

Where to extract it doesn't matter. For specific examples below, we assume it's extracted under /opt/src. Note also that there is no need to build it (i.e., no need to do ./configure or make); just extracting the archive is sufficient.

Finally, to run system (integration) tests you may also want to install lettuce. It's a Python application running on Python 2 (available on Mountain Lion by default) and can be installed as follows:

% sudo easy_install pip
% sudo pip install lettuce

Clone BIND 10 git repository and build it

The following are a common process for getting and building the latest development version of BIND 10, enabling all unit tests.

% git clone git://git.bind10.isc.org/bind10
% cd bind10
(maybe apply patch: see notes of Section 3)
% autoreconf -i
% SQLITE_CFLAGS=-I/usr/local/opt/sqlite/include SQLITE_LIBS='-L/usr/local/opt/sqlite/lib -lsqlite3' ./configure --prefix=/opt/bind10 --with-gtest-source=/opt/src/gtest/gtest-1.6.0
% make

Of course, once you clone the repository the first step can be replaced with git pull under the bind10 directory. Specifying the --with-gtest-source is the only difference for the ./configure script than the example for building the release version shown above.

Run tests

When build is completed, you can run unit tests as follows:

% make check

Note: as of this writing, some of Python unit tests fail due to the use of Python 3.3. There are bug tickets about this, and hopefully they'll be fixed soon.

You can also run lettuce systems tests as follows:

% cd tests/lettuce
% ./run_lettuce.sh

and run BIND 10 in the source tree (i.e., without installing it, which is useful for developers):

% cd src/bin/bind10
% ./run_bind10.sh
Last modified 3 years ago Last modified on Jan 12, 2015, 12:25:56 PM