---
layout: post
title: Building HPX on the Raspberry running Raspberian
categories: blog
tags: [Building]
author: diehlpk
---

## Increase the swap

Generate the swap.imp in some folder where you have sufficient hard disk space.

{% highlight bash %}
dd if=/dev/zero of=swap.img bs=1M count=4096
mkswap swap.img
chmod 0600 swap.img 
sudo chown root:root swap.img
swapon swap.img
{% endhighlight %}

## Install requirements

{% highlight bash %}
sudo apt-get install libboost-devel cmake autoconf
{% endhighlight %}


## Compile requirements

### Gcc

{% highlight bash %}
cd ~
wget https://ftpmirror.gnu.org/gcc/gcc-8.1.0/gcc-8.1.0.tar.gz
tar xf gcc-8.1.0.tar.gz
cd gcc-8.1.0
contrib/download_prerequisites
cd ~
2 mkdir build && cd build
3 ../configure -v --enable-languages=c,c++ --prefix=/usr/local/gcc-8.1.0 --program-suffix=-8.1.0 --with-arch=armv7 --with-fpu=vfp --with-float=hard --build=arm-linux-gnueabihf --host=arm-linux-gnueabihf --target=arm-linux-gnueabihf
{% highlight bash %}

### Boost

{% highlight bash %}
wget 'http://downloads.sourceforge.net/project/boost/boost/1.68.0/boost_1_68_0.tar.bz2'
tar xf boost_1_68_0.tar.bz2
cd boost_1_68_0
./bootstrap.sh --prefix=/home/pi/data/opt/boost
./b2 -j2 install --with-atomic --with-filesystem --with-program_options --with-regex --with-system --with-chrono --with-date_time --with-thread
{% highlight bash %}

### gperftools

{% highlight bash %}
git clone https://github.com/gperftools/gperftools.git
cd gperftools 
./autogen.sh
mkdir build && cd build
../configure --enable-minimal --prefix=/home/pi/data/opt/gpfer/
make
make install
{% highlight bash %}


## Compile hpx

{% highlight bash %}
https://github.com/STEllAR-GROUP/hpx.git
cd hpx 
mkdir build && cd build
cmake -DCMAKE_INSTALL_PREFIX=/opt/hpx -DBOOST_ROOT=/home/pi/data/opt/boost \
-DTCMALLOC_INCLUDE_DIR=/home/pi/data/opt/gpfer/include/ \
-DTCMALLOC_LIBRARY=/home/pi/data/opt/gpfer/lib/libtcmalloc_minimal.so \
-DHPX_WITH_GENERIC_CONTEXT_COROUTINES=ON \
..
make
{% highlight bash %}

Note, that the compilation of hpx consums plenty of memory and therfore you should use only one core.





Add blog post for building hpx on a rpi3
Add blog post for building hpx on a rpi3
