Compile nymea from source code


nymea is written in Qt which is a full development framework with tools designed to streamline the creation of applications and user interfaces for desktop, embedded, and mobile platforms. With Qt, you can reuse code efficiently to target multiple platforms with one code base.

You need a Qt version >= 5.5

Officially nymea is supported only on Linux platforms, which means this guide is for Linux users only.

Install build dependencies

In order to build nymea you need to install the build dependencies:

$ sudo apt update
$ sudo apt upgrade
$ sudo apt install build-essential qt5-default qtbase5-dev qtcreator git ccache dpkg-dev python debhelper \
  rsync dbus-test-runner libaws-iot-device-sdk-cpp libssl-dev libavahi-common-dev libavahi-client-dev \
  libqt5dbus5 libqt5sql5-sqlite libqt5bluetooth5 libqt5serialport5-dev libqt5websockets5-dev \
  qtconnectivity5-dev qttools5-dev-tools qtbase5-dev-tools qt5-qmake

Compile nymea with the QtCreator

  1. If you want to open the nymea-project wit the Qt Creator (SDK), you have to install the needed packages either from the official repository of your distribution:

    You can also install Qt manually with the Qt Installer for Linux. All necessary downloads can be found here:

    Download Qt

  2. Once you installed Qt you can clone the nymea source code:

    You can find the sourcecode on our github page: https://github.com/guh/nymea

    Note: It's good practice to create a sub folder with the name of the application. The QtCreator will create by default a build directory next to the source folder. This keeps the source folder free of output and binary files.

    $ git clone https://github.com/guh/nymea.git
    $ mkdir nymea
    $ cd nymea/
    $ git clone https://github.com/guh/nymea.git

    Now open the project file (/nymea/nymea.pro) with the QtCreator and configure your project. You can use the default setting, which will create a build-nymea-<Kit>-Debug directory next to the source code directory where all build output files and binaries will be generated.

  3. In order to speed up the the compilation process you can check how many CPU's you have:

    $ nproc
    8

    In the QtCreator (nymea.pro opened) do following steps:

    • Go to Projects on the left side of the window.
    • Go to the Build tab of your Kit
    • Under Build Steps click on Detail of the Make: line
    • Write in the Make arguments field: -j9

      Note: the -j argument specifies the number of jobs (commands) to run simultaneously. With n CPU's you can run n+1 jobs.

  4. Press the Build button on the bottom left of the QtCreator window (Ctrl + b) and follow the build process in the Compile output section (Alt + 4).

  5. Before you can run the fresh compiled nymea binary, you need to export the library path to the libnymea and libnymea-core, otherwise you will get following message:

    $ nymead: error while loading shared libraries: libnymea.so.1: cannot open shared object file: No such file or directory

    In order to export the lib path, you can run following command in the terminal:

    Note: customize the path PATH_TO_NYMEA to your nymea folder!

    $ export LD_LIBRARY_PATH=LD_LIBRARY_PATH:/PATH_TO_NYMEA/build-nymea-Desktop-Debug/libnymea/:PATH_TO_NYMEA/build-nymea-Desktop-Debug/libnymea-core/

    To make it permanent, you can add this line to the /etc/bash.bashrc file.

  6. Now you should be able to run nymead by pressing the Play button in the QtCreator (or you can press Ctrl + r). You can follow the stdout in the Application Output section (Alt + 3).

    If you want to run the application in the terminal you can start nymead with following command:

    $ cd build-nymea-Desktop-Debug/server/
    $ ./nymead -n

You can proceed with the Getting-Started instructions.


Compile nymea in the terminal

  1. Install needed packages to compile nymea:

    $ sudo apt-get install build-essential qt5-default git
  2. Clone the source code git repository:

    You can find the sourcecode on our github page: https://github.com/guh/nymea

    Note: It's good practice to create a sub-folder with the name of the application and create a build directory next to the source directory. This keeps the source folder free of output and binary files.

    $ mkdir nymea
    $ cd nymea/
    $ git clone https://github.com/guh/nymea.git
  3. Create a build folder:

    $ mkdir build-nymea
    $ cd build-nymea
  4. Run qmake (See also qmake configuration)

    $ qmake ../nymea/
  5. Compile nymea:

    Note: the -j argument specifies the number of jobs to run simultaneously to speed up compilation time.

    $ make -j`nproc`
  6. Now you have two possibilitis:

    • If you want to install your compiled nymea version you can type following command in the build directory:

      $ sudo make install
    • If you don't want to install the application you need to export the library path to the libnymea and libnymea-core before you can start the application, otherwise you will get following message:

      $ nymead: error while loading shared libraries: libnymea.so.1: cannot open shared object file: No such file or directory

      In order to export the lib path, you can run following command in the terminal:

      Note: customize the path PATH_TO_NYMEA to your nymea folder!

      $ export LD_LIBRARY_PATH=LD_LIBRARY_PATH:/PATH_TO_NYMEA/build-nymea-Desktop-Debug/libnymea/:PATH_TO_NYMEA/build-nymea-Desktop-Debug/libnymea-core/

      To make it permanent, you can add this line to the /etc/bash.bashrc file.

Now you can run nymead with following command:

Note: ensure that there is no other nymead installation in your system. If you already have installed nymea somewhere, there could be a collision with the different libs!

    $ cd build-nymea/server/
    $ ./nymead -n

You can proceed with the Getting-Started instructions.