Skip to content
Matt Magoffin edited this page May 13, 2019 · 1 revision

mbpoll Setup for SolarNode

This guide describes compiling and packaging the mbpoll utility for use on Debian 9 based SolaNode devices.

Packaging with fpm

For packaging, use fpm. Install fpm with:

$ sudo apt-get install ruby ruby-dev build-essential
$ sudo gem install --no-ri --no-rdoc fpm

Build libmodbus

Build and package libmodbus:

# install dependencies for building
$ sudo apt-get install automake autoconf libtool git

$ git clone https://github.com/stephane/libmodbus.git
$ cd libmodbus
$ git checkout v3.1.4
$ ./autogen.sh
$ ./configure --prefix="$PWD/local/usr"
$ make && make install
# make check

# package binaries
fpm -s dir -t deb -m 'packaging@solarnetwork.org.nz' --vendor 'SolarNetwork Foundation' \
	-n libmodbus -v 3.1.4  --description 'Shared library for Modbus' \
	--url https://github.com/stephane/libmodbus -f -C local --deb-activate noawait \
	usr/lib usr/share

# package headers
fpm -s dir -t deb -m 'packaging@solarnetwork.org.nz' --vendor 'SolarNetwork Foundation' \
	-n libmodbus-dev -v 3.1.4  --description 'Shared library for Modbus' \
	--url https://github.com/stephane/libmodbus -f -C local \
	usr/include
	
# need libmodbus installed to build mbpoll 
$ sudo dpkg -i libmodbus*.deb

Build mbpoll

Build and package mbpoll:

# install dependencies for building
$ sudo apt-get install cmake pkg-config

$ git clone https://github.com/epsilonrt/mbpoll
$ cd mbpoll
$ git checkout v1.4.11
$ mkdir build && cd build
$ cmake -DCMAKE_INSTALL_PREFIX:PATH=/usr ..
$ make && make DESTDIR=$PWD/local install
$ fpm -s dir -t deb -m 'packaging@solarnetwork.org.nz' --vendor 'SolarNetwork Foundation' \
	-n mbpoll -v 1.4.11  --description 'Command line utility to communicate with ModBus devices.' \
	--url https://github.com/epsilonrt/mbpoll -f -d 'libmodbus (>= 3.1.0)' -C local \
	usr/bin
	
# install
$ dpkg -i mbpoll*.deb
Clone this wiki locally