Skip to content

Build from source

epsilonrt edited this page Apr 7, 2020 · 12 revisions

The compilation requires a compiler g ++ managing C++11, the compilation has been made with gcc version 6.3.0 20170516. This compiler is usually installed with a complete tool chain on Linux systems.

To build from sources you must do the following.

If you are on a Debian (Armbian, Raspbian ...), you can use my repository to install libmodbusepsi (or libmodbus at your convenience) :

wget -O- | sudo apt-key add -
sudo add-apt-repository 'deb stretch piduino'
sudo apt update
sudo apt install build-essential pkg-config cmake libunittest++-dev libmodbusepsi-dev

otherwise, you will have to compile and install libmodbusepsi (or libmodbus at your convenience) from source.

Then you can clone and compile libmodbuspp :

git clone --recurse-submodules
cd libmodbuspp
git submodule init
git submodule update
mkdir cmake-build-Release
cd cmake-build-Release
cmake ..
sudo make install
sudo ldconfig

To uninstall:

 cd cmake-build-Release
 sudo make uninstall

Debian packages

You can also generate Debian packages with:

 cd cmake-build-Release
 rm -fr *
 sudo apt-get install fakeroot
 fakeroot make package

then install them:

 sudo apt install ./*.deb

Doxygen documentation

To generate documentation in HTML format and Man pages, you must install the pre-requisites:

 sudo apt install doxygen doxygen-latex doxygen-doc doxygen-gui graphviz

To correctly display the C ++ code in the documentation, it is better to install marked which depends on nodejs:

 sudo apt install npm
 sudo npm install -g marked

If you do not have nodejs 8.x minimum, you will need to add the necessary repository beforehand :

 curl -sL | sudo -E bash -

then built the doc:

 cd cmake-build-Release
 fakeroot make package
Clone this wiki locally