Close

How to build SerialPlot on Linux

A project log for SerialPlot - Realtime Plotting Software

Small and simple software for plotting data from serial port

Hasan Yavuz ÖzderyaHasan Yavuz Özderya 09/07/2020 at 07:590 Comments

These are the steps for building SerialPlot on linux. I will also provide more detailed steps for Ubuntu and similar debian based distributions.

Building SerialPlot on linux is quite easy. Most difficult part (not really difficult) is gathering the dependencies. It is possible that you already have some of them installed such as a C++ compiler.

I've also described how to build with docker which might be the easiest method if you are familiar with it.

Install Dependencies

You should have following dependencies installed, preferably using your package manager:

On ubuntu or similar operating systems you can install these dependencies with the  following command.

sudo apt install build-essential qtbase5-dev libqt5serialport5-dev cmake mercurial

 Note: instead of 'qtbase5-dev' you can install 'qt5-default' package to make sure it is the default qt version.

Also note: SerialPlot doesn't build with Qt4, you need Qt5.

Also also note: you need internet access during build process. It is not necessary, but if you don't you have to also "QWT" library installed.

Get Source Code

You can download the source code using mercurial with the following command. Mercurial is a version control tool very similar to git.

hg clone https://hg.sr.ht/~hyozd/serialplot

Or if you don't want to deal with the mercurial you can download the latest code from this link.

https://hg.sr.ht/~hyozd/serialplot/archive/tip.tar.gz

Build

When you have everything ready, run following commands in the serialplot directory.

mkdir build
cmake ..
make run

 This should build SerialPlot and start it.

Building AppImage

Note: This only works on ubuntu 14.04 at the moment due to restrictions from appimage creator tool that I use at the moment.

When you build SerialPlot this way it probably only works on your computer. It should work on other computers with the same distribution as yours as long as they have the correct libraries installed. If you want to lend your build to your friends you can create a portable executable called AppImage. This should run on most distributions. And it is how I release the Gnu/Linux version of the SerialPlot.

It is easy to build SerialPlot appimage.

Run below command in your build directory.

cmake ..
make appimage

That's it. If everything goes well you should  now have SerialPlot appimage in your build directory, and it should run in most distributions (fingers crossed).

Building with Docker

There is a Dockerfile inside the serialplot directory ready to go. It is based on Ubuntu 14.04 (trusty). Building it, produces an appimage that you can use on Ubuntu/Debian based systems. Maybe on other distros too?

If you don't have it installed, you can install docker on Ubuntu with this command:

sudo apt install docker.io

After that, get into the directory of 'serialplot' where the 'Dockerfile' exists and run this command. It might take some time depending on your internet speed.

sudo docker build -t serialplot_trusty .

 This will build a docker image that should contain the SerialPlot appimage. After building appimage, you should get it from inside the docker image with this command.

sudo docker run --rm --entrypoint cat serialplot_trusty /serialplot/build_docker/SerialPlot-x86_64.AppImage > ./serialplot.appimage

Make it executable and start serialplot:

chmod +x ./serialplot.appimage
./serialplot.appimage

Notes

Although actual build process is quite simple and straightforward, if you are not experienced you may have issues building SerialPlot successfully. It is usually missing dependencies. It is rarely an incompatible library. In that case please leave a comment : ) I will be happy to help.

Also if you have steps for other distributions and recommendations, please share, I will try to add them here.

Discussions