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

Build Instructions for Linux

andrewleung1 edited this page Jul 18, 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

Instructions taken from Jonny's Blog:

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

Now, because arch doesn't provide static libraries we have to compile icu ourselves. For that we use the Arch Build System. Before we compile icu, we edit the PKGBUILD by adding the following line after depends:

options=(staticlibs)

Furthermore, we have to edit the configure command in build:

./configure --prefix=/usr --sysconfdir=/etc --mandir=/usr/share/man --sbindir=/usr/bin --enable-static

Now, to build and install icu with static libraries, just type:

makepkg -si

Raspberry Pi

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

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

  1. 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

  1. Install all needed lib

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

  1. 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 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

After the CMake command has finished, you should have a file 'build_maidsafe/CMakeCache.txt' containing these variables. 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