Skip to content

Building for Linux and FreeBSD

Johan Sköld edited this page Nov 4, 2016 · 3 revisions

General build steps to build for your current system:

mkdir build
cd build
cmake ..
make

All build-related files will go into the newly created build folder.

32-bit

If you are building with a 64-bit compiler, but want to generate a 32-bit binary, please define SC_FORCE_32BIT on the cmake command line:

cmake -D SC_FORCE_32BIT=1 ..

This will cause the build to generate 32-bit binaries regardless of if you are using a 64-bit compiler. In order for this to work, please make sure you have a multilib version of the compiler and standard libraries. For GCC in Ubuntu, this may be achieved through:

sudo apt-get install gcc-multilib g++-multilib

Cross-compiling

To cross-compile for a system other than your own, you would pass an appropriate toolchain file to the cmake command line. As an example, linux-arm.cmake is a toolchain file that was once used to build for arm in this project's travis builds. To tell cmake which toolchain file to use, you pass CMAKE_TOOLCHAIN_FILE to the cmake command:

cmake -D CMAKE_TOOLCHAIN_FILE=<path> ..