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

Build Instructions for Linux

dirvine edited this page Oct 10, 2014 · 13 revisions

Prerequisites

Ubuntu

GCC

For Ubuntu 12.10 and later, simply add g++-4.8 to the sudo apt-get install... list and skip to the CMake section.

For Ubuntu 12.04 and lower, g++-4.8 isn't in the repositories. In this case, do the following:

sudo add-apt-repository ppa:ubuntu-toolchain-r/test
sudo apt-get update
sudo apt-get install gcc-4.8
sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-4.8 50

When executing CMake later, ensure you add: -DCMAKE_C_COMPILER=gcc-4.8 -DCMAKE_CXX_COMPILER=g++-4.8

e.g.:

cmake -H -Bbuild_maidsafe -DCMAKE_BUILD_TYPE=Debug -DCMAKE_C_COMPILER=gcc-4.8 -DCMAKE_CXX_COMPILER=g++-4.8
CMake

For Ubuntu 14.04 and later, just add cmake to the sudo apt-get install... list and skip to the All Other Prerequisites section.

For Ubuntu 13.10 and lower, CMake 2.8.12.2 has to be installed manually:

git clone git://cmake.org/cmake.git
cd cmake
git checkout v2.8.12.2
./bootstrap --prefix=/usr
make
sudo make install
All Other Prerequisites

To install the remaining prerequisites in Ubuntu run

sudo apt-get update
sudo apt-get install build-essential python-psutil libfuse-dev git-all libicu-dev valgrind binutils-gold

ArchLinux

Install the prerequisites:

pacman -S base-devel python-psutil fuse git valgrind

Also required are the ICU staticlibs, which are not compiled by default. You can, however, easily install them by installing the AUR package icu-staticlibs:

yaourt -S icu-staticlibs

Raspberry Pi

Huge thanks goes to Sindoro Ali, blog can be found here

Installing Maidsafe on Rasbian is almost the same as installing on ubuntu except that rasbian does not usually have the needed gcc 4.8, by default its 4.6. so....

Upgrade Wheezy to Jessie. by using sudo leafpad /etc/apt/sources.list change wheezy to jessie (just 1 word in /etc/apt/sources.list) then run:

 sudo apt-get update
 sudo apt-get dist-upgrade
 sudo rpi-update
 reboot

During rpi-update you will be asked if you want to keep setting ie:auto login, ssh, etc

Source http://www.raspberrypi.org/forums/viewtopic.php?t=65516&p=481730

Install all needed lib

 sudo apt-get install build-essential python-psutil libfuse-dev git-all libicu-dev valgrind binutils-gold

Install Cmake

I compile from source.

 git clone git://cmake.org/cmake.git
 cd cmake
 git checkout v2.8.12.2
 ./bootstrap --prefix=/usr
 make
 sudo make install

Thats it, you will be able to join your raspberry into maidsafe network.

One more thing to consider is that memory in pi is just 512, so here is how to create swap file that i use.

 $ dd if=/dev/zero of=/path/to/swapfile bs=1M count=1024 # For 1GB swap file
 $ mkswap /path/to/swapfile
 $ swapon /path/to/swapfile

Source http://raspberrypi.stackexchange.com/questions/70/how-to-set-up-swap-space

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

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.

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