more details on building from source - acfr/comma GitHub Wiki

Table of Contents

Ubuntu 14.04, 16.04, 18.04, and Debian 7.0 (Wheezy)

Install essential comma dependencies:

  sudo apt-get install build-essential git cmake-curses-gui cmake perl python libboost-all-dev socat

Install additional comma dependencies if necessary:

  # if you plan to use zmq applications
  sudo apt-get install libzmq-dev
  # if you plan to build unit tests
  sudo apt-get install libgtest-dev
  # if you plan to use python modules and applications
  sudo apt-get install python-dev python-numpy
  # if you plan to use comma bash utilities with full-fledged comma-timeout-group
  sudo apt-get install libprocps4-dev
  # if you plan to run regression test (e.g. with comma-test-run)
  sudo apt-get install gawk net-tools
  # if you plan to use comma-test-run with junit support
  sudo apt-get install recode

If you want to use RabbitMQ utilities:

  # install rabbitmq-server
  sudo apt-get install rabbitmq-server
  # check service is installed and running
  service rabbitmq-server status
  # for python clients
  sudo pip install pika

Install comma:

  cd ~/src/
  git clone https://github.com/acfr/comma.git
  cd ~/build/comma
  ccmake ~/src/comma
  cmake . && make -j 4 && sudo make install

Boost

The minimum required version of Boost is 1.53. If the provided version on your system is older (or if you wish to have the latest Boost), download Boost source code from www.boost.org and follow the instructions, which will include something like:

  ./bootstrap.sh
  ./b2
  sudo ./b2 install

Python

To use comma Python modules and applications, install python 2.7 and numpy 1.8.2 (or later):

  sudo apt-get install python python-dev python-numpy

and then set BUILD_PYTHON_PACKAGES to ON in ccmake.

If PYTHON_PACKAGE_INSTALL_PREFIX is set to a non-standard location, e.g. /opt/acfr, then PYTHONPATH should be set like this:

  export PYTHONPATH=/opt/acfr/lib/python2.7/dist-packages

where lib/python2.7/dist-packages is a python specific relative path that depends on the python version and the OS. To find out what the relative path should be, run this command:

  python -c "import sys, distutils.sysconfig; print distutils.sysconfig.get_python_lib().lstrip(sys.prefix)" 

Building on other platforms

Redhat/CentOS

TODO

To enable Python modules:

  yum install python-devel numpy

Red Pitaya

Getting compiler

On Ubuntu, install arm compiler with gnueabihf:

    sudo apt-get install gcc-arm-linux-gnueabihf
    sudo apt-get install g++-arm-linux-gnueabihf

For Debian, see installation instructions here: https://wiki.debian.org/CrossToolchains#In_jessie_.28Debian_8.29(https://wiki.debian.org/CrossToolchains#In_jessie_.28Debian_8.29)

Building boost

Download and extract boost library from boost.org e.g to ~/Downloads/boost_1_57_0; and run build it as below (if any module doesn't build you can use --without-<module></module> to turn it off)

Setup build config to use the arm compiler

    echo 'using gcc : arm : arm-linux-gnueabihf-g++ ;' >~/user-config.jam

Install b2 for building boost. bootstrap sets environment variable and is needed for next steps.

    cd ~/Downloads/boost_1_57_0/tools/build/
    ./bootstrap.sh
    sudo ./b2 install --prefix=/usr/local/

Setup build and stage directories. stage directory should match the one in arm.toolchain.cmake

    mkdir -p ~/build/arm/boost
    sudo mkdir -p /stage/arm/lib
    sudo chown $USER:$USER /stage/arm/lib

build boost, this step can take some time

    cd ~/Downloads/boost_1_57_0/
    b2 stage --build-dir=$HOME/build/arm toolset=gcc-arm --stagedir=/stage/arm/ --without-python --without-thread --without-coroutine --without-context --without-iostreams --without-coroutine2 -j6
    mkdir /stage/arm/include
    cp -r boost /stage/arm/include

Building comma

Cross compiling comma is similar to normal build but with enabling option USER_ARM_TOOLCHAIN from command line the first time you run ccmake (after that you can run ccmake .)

    mkdir ~/build/arm/comma
    cd ~/build/arm/comma
    rm * -r
    ccmake -DUSE_ARM_TOOLCHAIN=ON ~/src/comma
    # for simplicity's sake, in ccmake, set INSTALL_BASH_COMPLETION to OFF
    make -j6

Make sure BUILD_SHARED_LIBS is ON before making comma. Stage comma (if required for building comma-dependent applications)

    mkdir /stage/arm/lib -p
    cd ~/build/arm/comma
    make
    cp lib/* /stage/arm/lib

Installing on the board

Enable writing on the disk

    ssh [email protected] rw

Copy boost library to board's lib directory

    scp /stage/arm/lib/libboost*so* [email protected]:/usr/local/lib

Copy comma files to board's bin and lib directories

    scp $HOME/build/arm/comma/bin/* [email protected]:/usr/local/bin
    scp $HOME/build/arm/comma/lib/* [email protected]:/usr/local/lib

After changing libraries location or adding new files we need to run this:

    sudo ldconfig -v

Change back to readonly

    ssh root@redpitaya "killall nginx; ro"
⚠️ **GitHub.com Fallback** ⚠️