Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

Table of Contents

This page documents the requirements and special instructions for building Traffic Server on Mac OS X platforms. Please let us know if you had to install additional packages on your installations.

Leopard (Version 10.5)

macOS.

To build Traffic Server, you will need gcc 4.2+, pcre, and either sqlite3 or berkeley db. Your Mac OS X system may not have all of the required software installed so you will have to to retrieve yourself a copy of PCRE, libtool, and automake. You can get it yourself from the source or elsewhere like macports or Homebrew.

Traffic Server only builds with clang on macOS We do not support building with gcc on this platform. You will need to install the latest version of Xcode.

Building Traffic Server with Homebrew

First, visit http://brew.sh to install the Homebrew package manager.

Next, install the build dependencies:

Code Block
$ brew install automake autoconf libtool pcre openssl

On certain versions of macOS / OS X and Xcode, you will also have to install libxml2:

Code Block
$ brew install libxml2
$ brew link --force libxml2

After you have PCRE development libraries installed on your systemAfter you have the required software, you should get the Traffic Server code with with git or subversion.

Code Block
langnone

$ svngit checkout \
  httpclone https://svngithub.apache.org/repos/asf/trafficserver/traffic/trunk \
  traffic-trunk.svncom/apache/trafficserver.git

Run autoreconf to generate the configure script:

Code Block
langnone

$ cd traffic-trunk.svn trafficserver   # enter the new checkout directory
$ autoreconf -f -i

Make yourself a build directory so you can do a VPATH build.

Code Block
langnone

$ mkdir releasei      # generate the configure script

From the build checkout directory, run configure `configure` to generate the Makefile files. You will likely may need to override the C and C++ compiler to use since they may be a non-standard filename:specify the base path where the development files (headers and libraries) for PCRE are installed, e.g. if you installed pcre with MacPorts, you will need to specify the directory '/opt/local'. When building against Homebrew, specify the openssl library with --with-openssl=/usr/local/opt/openssl

Code Block
langnone

$ cd release
$ ../configure --with-prefixopenssl=/usr/local/opt/ats \
               --with-sqlite3=/path/to/sqlite3 \
               --with-pcre=/path/to/pcre \
               CC=/usr/bin/gcc-4.2 \
               CXX=/usr/bin/g++-4.2
openssl

Now you can make and install:

Code Block
langnone
$ make
$ sudo make install

Generates a compilation database for clang tooling with Bear

JSON Compilation Database ( compile_commands.json ) is used by clang based tools.   For autotools based project (like Traffic Server), Bear is a tool that generates a compilation database.

On macOS or Fedora there is a know issue that bear generates empty compilation database because of SIP. Below is instruction to avoid the issue. Assuming above instruction is done. (automake autoconf libtool are already installed).

In short, all building tool chain should not be under certain directories which is protected by SIP. 

Code Block
langnone
$ cp /bin/sh /usr/loca/bin/
$ brew install bear llvm make
$ which clang clang++ gmake
/usr/local/opt/llvm/bin/clang
/usr/local/opt/llvm/bin/clang++
/usr/local/bin/gmake
$ CONFIG_SHELL=/usr/local/bin/sh CC=clang CXX=clang++ ./configure --ADD-OPTIONS-YOU-WANT
$ bear gmake 
  • Mac Ports - package retrieval and installation system.
  • Homebrew - package retrieval and installation system.
  • Xcode - if you want to use the latest version of GCC from Apple. Requires free registration to get to the download page.
  • PCRE - required software for building Traffic Server from the source.Mac Ports