Skip to content

Getting started on Linux

Jasmin B. Maglic edited this page Nov 15, 2022 · 6 revisions

MoloVol is distributed by providing download links to deb files. These files can be used to install applications on Ubuntu and Debian flavoured distributions of Linux. If such file is available for your platform and you just want to use the software then this article is not for you.

This article provides a detailed explanation of how to set up a command line development environment on Linux and compile MoloVol. You may want to do this if no installation file is available for your platform/ OS version/ CPU architecture or if you would like to contribute to the project.

This guide has been tested with Ubuntu 20.04.2.0 LTS.

Installing gcc and GTK

First install GNU c++ compiler if you haven't already. On Ubuntu you may use apt-get, for other Linux flavours you may need to use a different method.

$ sudo apt-get update
$ sudo apt-get install build-essential manpages-dev

Afterwards you should have gcc installed. You can check whether gcc is installed by requesting the version.

$ gcc -v
...
gcc version 9.3.0 (Ubuntu 9.3.0-17ubuntu1~20.04)

In order to compile wxWidgets you will also need GTK+ 2 developer tools. If you used apt-get before you can now install it directly.

$ sudo apt-get install libgtk2.0-dev

If you encounter an error message when compiling the app on a 64 but system, you may want to install GTK Canberra Module:

$ sudo apt-get install libcanberra-gtk-module

Installing wxWidgets

To install wxWidgets visit https://www.wxwidgets.org and download the appropriate source files for Linux. Unzip the download file and place it in a directory of your choice, such as your user directory Users/myname/wx. Then enter that directory.

myname@mycomputer:~$ cd wx/wxWidgets-3.1.5

In order to compile wxWidgets and not risk overwriting it upon recompilation, create a new directory and enter it.

myname@mycomputer:~/wx/wxWidgets-3.1.5$ mkdir build-debug
myname@mycomputer:~/wx/wxWidgets-3.1.5$ cd build-debug

Afterwards run the configuration executable in the parent folder with the following flags: Enable building for debugging, disable "shared" to obtain a static library, enable unicode support, and build a universal library for 64 bit and ARM architectures. The latter flag is needed for compiling the code on CPU chips with ARM architecture such as Apple M1.

myname@mycomputer:~/wx/wxWidgets-3.1.5/build-debug$ ../configure --enable-debug --disable-shared --enable-unicode --enable-universal_binary=arm64,x86_64

Now you're ready to compile. Simply run:

myname@mycomputer:~/wx/wxWidgets-3.1.5/build-debug$ make

This step will take a while. Once compilation has finished, you can place the library files in your system's default library folder.

myname@mycomputer:~/wx/wxWidgets-3.1.5/build-debug$ make install

You can check whether your installation was successful by running the wx-config command.

$ wx-config --list
    Default config is gtk2-unicode-static-3.1
  Default config will be used for output

Finally, you can remove the build files. They are no longer needed and take up disk space.

myname@mycomputer:~/wx/wxWidgets-3.1.5/build-debug$ make clean

If you ever wish to remove the installation, run the following command from your build folder.

myname@mycomputer:~/wx/wxWidgets-3.1.5/build-debug$ make uninstall

Downloading and compiling the source code

You will need to install Git if you haven't already. Visit https://git-scm.com. Once you have Git installed on your computer you can clone the repository to download all files to your local machine.

myname@mycomputer:~$ git clone https://github.com/molovol/MoloVol
myname@mycomputer:~$ cd MoloVol

Compilation of the application is done using CMake.

Creating an installation file (deb)

A deb file is an installation package for Ubuntu and Debian distributions of Linux. It contains the application binary along with a collection of other files, such as the licence, icons, and a short changelog. deb files allow easy installation of applications.

Packing of the deb file is supported through CPack contained in CMake. Find info on how to install CMake here.

As part of the packing process, the png file containing the application icon will be resized to all supported sizes. This requires the convert command that is part of GraphicsMagick. To install:

$ sudo apt install graphicsmagick-imagemagick-compat

Inside the build directory, compile the application using CMake. Make sure to enable MOLOVOL_ABS_RESOURCE_PATH.

myname@mycomputer:~/build$ cmake .. -DCMAKE_BUILD_TYPE=RELEASE -DMOLOVOL_ABS_RESOURCE_PATH=ON
myname@mycomputer:~/build$ make

Then create the deb file by running the following command.

myname@mycomputer:~/MoloVol$ cpack -G DEB

If successful, there will be a deb file inside the build folder. In order to install the application from the command line, simply run the following command.

myname@mycomputer:~/build$ dpkg -i MoloVol_debian_arm64_v1.0.deb