Skip to content

Build on RaspberryPI

Sébastien Gallou edited this page May 1, 2017 · 37 revisions

❗ Not fully tested ❗

Ensure your SD card is at least 16GB or you'll can't build yadoms.

Make sure you have g++ installed (4.7 minimum). This page assumes you use a Raspian distribution. Refer to the How to build from sources page to get official versions of dependancies.

Install g++ (not necessary on debian Jessie)

The debian wheezy comes with an older g++ version, so you probably need to install a new one

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

Boost

Download boost_1_62_0.tar.bz2 on http://www.boost.org/users/download/ Extract it

    wget http://downloads.sourceforge.net/project/boost/boost/1.62.0/boost_1_62_0.tar.bz2
	tar xjf boost_1_62_0.tar.bz2

Create bootstrap

	cd boost_1_62_0
	./bootstrap.sh

Build boost

For Debian Jessie (using g++ >= v4.9)

   ./b2 --with-atomic --with-chrono --with-date_time --with-filesystem --with-regex --with-thread --with-system link=static cxxflags=-fPIC

For raspbian Wheezy or other distros on which you have installed g++ v4.8, then build boost specifying g++ version

	./b2 toolset=gcc-4.8 --with-atomic --with-chrono --with-date_time --with-filesystem --with-regex --with-thread --with-system link=static

OpenSSL

Download the latest openssl version (be carefull, openssl 1.1.x and greaters are compatible with poco 1.7.7 and greater) Extract

   wget https://www.openssl.org/source/openssl-1.1.0d.tar.gz
   tar xzf openssl-1.1.0d.tar.gz

Configure for static build

   cd openssl-OpenSSL_1_1_0d
   ./config no-shared --prefix=/path/to/any/folder/openssl

Build

   make
   make install

Poco

Download Poco (complete edition) on http://pocoproject.org/download Extract it

   wget http://pocoproject.org/releases/poco-1.7.7/poco-1.7.7-all.tar.gz
   tar xzvf poco-1.7.7-all.tar.gz

Edit file build/config/Linux and append '-fPIC' to STATICOPT_CC and STATICOPT_CXX lines If those lines are not empty, append ' -fPIC' to end of line

STATICOPT_CC = -fPIC
STATICOPT_CXX = -fPIC

Build Poco :

   cd poco-1.7.7-all
   ./configure --static --omit=CppUnit,CppUnit/WinTestRunner,Data,Data/SQLite,Data/ODBCData/MySQL,MongoDB,PageCompiler,PageCompiler/File2Page --no-samples --no-tests --config=Linux --include-path=/path/to/any/folder/openssl/include --library-path=/path/to/any/folder/openssl/lib
   make -s

Protobuf

First install some prerequisites :

    sudo apt-get install autoconf libtool

Download Protobuf on https://github.com/google/protobuf/releases Extract it

    wget https://github.com/google/protobuf/releases/download/v3.2.0/protobuf-cpp-3.2.0.tar.gz
    tar xzf protobuf-cpp-3.2.0.tar.gz

Build Protobuf :

   cd protobuf-3.2.0
   mkdir build
   ./autogen.sh
   ./configure --enable-shared=no --prefix=`pwd`/build --with-pic
   make

Install :

    sudo make install
    sudo ldconfig

You can test installation :

    protoc --version

should answer :

    libprotoc 3.2.0

SWIG

To install swig 3 (apt-get give swig 2); you must install prerequisites.

PCRE

    sudo apt-get install libpcre3 libpcre3-dev

SWIG

Download swig source tarball from http://www.swig.org/download.html

    wget http://prdownloads.sourceforge.net/swig/swig-3.0.12.tar.gz
    tar xzf swig-3.0.12.tar.gz
    cd swig-3.0.12
    ./configure
    make
    sudo make install

Python

You must install python-dev :

For python 2.x

    sudo apt-get install python-dev

Libudev (optional, needed for ZWave plugin)

Install libudev

	sudo apt-get install libudev-dev

CMake

We need CMake v3.x, which is not provided by apt-get depots. So download it and built it :

   wget https://cmake.org/files/v3.7/cmake-3.7.1.tar.gz
   tar zxvf cmake-3.7.1.tar.gz
   cd cmake-3.7.1
   ./bootstrap && make
   sudo make install

For CMake versions before 3.9, override installed FindProtobuf.cmake file :

   wget https://raw.githubusercontent.com/Kitware/CMake/next/Modules/FindProtobuf.cmake
   sudo mv /usr/local/share/cmake-3.7/Modules/FindProtobuf.cmake /usr/local/share/cmake-3.7/Modules/FindProtobuf.cmake.old
   sudo mv FindProtobuf.cmake /usr/local/share/cmake-3.7/Modules/

Yadoms

Grab sources

Get the latest sources:

    git clone https://github.com/Yadoms/yadoms.git yadoms

Configure build environment

Create the sources/CMakeListsUserConfig.txt (from the .sample.txt) and edit it

    cd yadoms/sources
    cp CMakeListsUserConfig.sample.txt CMakeListsUserConfig.txt
    nano CMakeListsUserConfig.txt

Set the Boost root configuration (replace x_yy_z by current version)

    set(BOOST_ROOT "/home/pi/boost_x_yy_z")

Set the Poco root configuration (replace x.y.z by current version)

    set(POCO_ROOT "/home/pi/poco-x.y.z-all")

Set the Protobuf root configuration (replace x.y.z by current version)

    set(PROTOBUF_ROOT "/home/pi/protobuf-x.y.z")

If needed, set the Gammu root configuration (replace x.y.z by current version)

    set(GAMMU_USE_PKGCONFIG OFF)
    set(GAMMU_ROOT "/home/pi/gammu-x.y.z/build")

Save the file with CTRL-O

Generate makefile

	cd yadoms
	sh cmake_raspberry.sh p

Build Yadoms

        cmake --build projects

Alternatively, if you are using a RaspberriPI 2 or more (with multi cores), you can increase the build speed by using -j2 commutator of make

	cd projects
        make -j2

Wait (about 4 or 5 hours)

Run Yadoms

	cd ../build
	./yadoms
Clone this wiki locally