TPCCLIB development using C in macOS

This page gives instructions on setting up the necessary tools for compiling TPCCLIB in the macOS platform.

Install the tools for compiling

By default, macOS does not contain the tools to compile C libraries and programs, but the required tools are free to install. First, you have to install Xcode from the App Store; you must register yourself as Apple Developer (registration is free). The Xcode package is several gigabytes in size and will take awhile to install; then you need to launch Xcode and sign in; after that you can exit Xcode, because building will be done in Terminal window. Xcode should include the Command Line Tools, but if not, you can install them yourself:

xcode-select --install

Xcode and its Command Line Tools contain AppleClang, which can be used to compile TPCCLIB.

CMake is an open-source, cross-platform tool which is required to build, test, and package the TPCCLIB software. Download CMake binary package for Mac OS X, and install it on your computer.

Open Terminal window and verify that CMake and Clang are available:

cmake --version
clang --version

If CMake is not found, then you need to add its binary path to the PATH environment variable. MacOS Catalina uses zsh as the default shell instead of bash which used in previous macOS versions. Depending on the shell, the PATH must be set in different configuration file, .zshrc and .bash_profile for zsh and bash, respectively. Configuration files are located in your home folder, or if one does not exist, it can be created in there. In the Terminal, move into your home directory and edit or create the configuration file:

cd
nano .bash_profile

and edit or write the PATH setting to contain the CMake binary folder, for example:

export PATH="/Applications/CMake.app/Contents/bin:$PATH"

While at it, you should also add path to the folder where the TPCCLIB binaries will be built.

Then save the file in nano by clicking control+o and confirm the name of the file by hitting return. Exit nano with control+x.

Compiling TPCCLIB

Documentation for TPCCLIB gives instructions for setting up the folders for source codes and building, cloning TPCCLIB source codes, and building and testing the TPCCLIB libraries and executables.


While TPCCLIB is by default built using Xcode and its Command Line Tools, OpenMP is not supported for AppleClang by Apple. If you need OpenMP or latest build systems, then you should install [homebrew](https://brew.sh), and via it, install the compilers and build systems that you need, and modify CMakeLists.txt in TPCCLIB source root folder accordingly.


See also:



Tags: , , , ,


Updated at: 2020-04-15
Created at: 2014-08-26
Written by: Vesa Oikonen