Skip to content
This repository has been archived by the owner on Jan 6, 2020. It is now read-only.

Build Instructions for OS X

Fraser Hutchison edited this page Aug 14, 2014 · 2 revisions

Prerequisites

  • Clang minimum version 3.4 (install Xcode from the Mac App store and include Command Line Tools)
  • git
  • CMake minimum version 2.8.12.2
  • Python minimum version 2.7
  • FUSE for OS X

Get the Source Code

It is recommended to use SSH (GitHub account required) when cloning the MaidSafe repositories. GitHub provides instructions on how to generate SSH keys.

Navigate to where you wish to create your build. If you have git version < 1.8.5, the second command will have to be executed from within the "MaidSafe" source folder, omitting the -C MaidSafe part.

git clone [email protected]:maidsafe/MaidSafe
git -C MaidSafe submodule update --init

Configure the Project

We use CMake to generate the makefiles/project solution files. There is a more detailed description of running CMake here, but the following may be enough to get you started.

We only allow out-of-source builds for our projects, which means you need to create a separate build directory from which to run CMake. So, from somewhere outside of MaidSafe root:

cmake -H<path to MaidSafe root> -Bbuild_maidsafe -DCMAKE_BUILD_TYPE=Debug

or for an Xcode project

cmake -H<path to MaidSafe root> -Bbuild_maidsafe -G"Xcode"

On the first run of CMake, some optional components are checked and can generate output such as:

...
-- Performing Test HAVE_FLAG_SANITIZE_BLACKLIST
-- Performing Test HAVE_FLAG_SANITIZE_BLACKLIST - Failed
-- Performing Test HAVE_FLAG_SANITIZE_ADDRESS
-- Performing Test HAVE_FLAG_SANITIZE_ADDRESS - Success
...

Such failures are safe to ignore. Any fatal failures should output obvious messages, and configuring will fail. If configuring succeeds, the final output from CMake should be:

...
-- Configuring done
-- Generating done
-- Build files have been written to: <path to build_maidsafe>

After the CMake command has finished, you should have a file 'build_maidsafe/CMakeCache.txt' containing (amongst other things) any variables passed on the command line. This is used on future runs of CMake, and CMake can now be targeted either at the source root (where CMakeLists.txt lives), or at the build folder where the CMakeCache.txt lives. So, from within the build folder, you can now rerun CMake by simply doing:

cmake .

Build the Targets

Your build folder should now contain a makefile or an Xcode project file.

Each submodule has an All<submodule name> target and an Exper<submodule name> target. The "All" target builds all libraries and executables (including test ones) defined in that submodule. The "Exper" target builds the "All" target, then runs all associated tests and submits the results to the public dashboard. For example, to run the Common experimental tests, just do:

make ExperCommon