Synfig Studio is one of several software that was made with gtkmm
gtkmm-4.0 has several new improvements and features.
In this article we will see how to compile on Ubuntu 22.04 .
Before following this tutorial, check if version 4 is already available in the repository, as some distros already have it. But anyway, it will serve as a learning experience or for new versions! 😃
Install build dependencies
By default, GNOME uses Meson, but in all packages there is an alternative to compile with GNU Autotools, in this case we will compile everything with Autotools:
It’s also good to have gtkmm-3.0 to solve other dependencies. In addition to Gtk4 .
sudo apt install build-essential git g++ autotools-dev libgtkmm-3.0-dev \
libgtkmm-3.0-doc mm-common libgtk-4-bin \
libgtk-4-common libgtk-4-dev libgtk-4-doc pkg-config
Now let’s use the updated versions, without them you can’t continue, click on the links if there is already a newer version, download the latest one. It accepts these versions or higher.
You must have SigC++-3.07:
wget ftp://ftp.acc.umu.se/pub/gnome/sources/libsigc++/3.0/libsigc++-3.0.7.tar.xz
tar Jxvf libsigc++-3.0.7.tar.xz
cd libsigc++-3.0.7/
./autogen.sh --prefix=/usr/local
make
sudo make install
It is necessary to have giomm-2.68 and to get it we compile/install glibmm-2.68:
wget https://download.gnome.org/sources/glibmm/2.68/glibmm-2.68.2.tar.xz
tar Jxvf glibmm-2.68.2.tar.xz
cd glibmm-2.68.2/
./autogen.sh --prefix=/usr
make
sudo make install
You must have the latest version of cairomm:
git clone https://github.com/freedesktop/cairomm
cd cairomm
./autogen.sh --prefix=/usr
make
sudo make install
And finally pangomm-2.50:
wget https://download.gnome.org/sources/pangomm/2.50/pangomm-2.50.0.tar.xz
tar Jxvf pangomm-2.50.0/
cd pangomm-2.50.o/
./autogen.sh --prefix=/usr
make
sudo make install
If you want to see the path where they are all installed see here .
Download and check the hash
wget https://download.gnome.org/sources/gtkmm/4.6/gtkmm-4.6.1.tar.xz
wget https://download.gnome.org/sources/gtkmm/4.6/gtkmm-4.6.1.sha256sum
sha256sum -c --ignore-missing gtkmm-4.6.1.sha256sum
If it appears:
gtkmm-4.6.1.tar.xz: SUCCESS
, everything is ok and we can proceed, if not, download the files again.
Unzip, compile and install
tar Jxvf gtkmm-4.6.1.tar.xz
cd gtkmm-4.6.1
./autogen.sh --prefix=/usr
make
sudo make install
libsigc-3.0.so
Run the command:
ls /usr/lib/libsigc-3*
If you don’t find anything, CREATE these symlinks:
sudo ln -s /usr/local/lib/libsigc-3.0.so.0.0.0 /usr/lib/libsigc-3.0.so.0.0.0
sudo ln -s /usr/local/lib/libsigc-3.0.la /usr/lib/libsigc-3.0.la
sudo ln -s /usr/local/lib/libsigc-3.0.so /usr/lib/libsigc-3.0.so
sudo ln -s /usr/local/lib/libsigc-3.0.so.0 /usr/lib/libsigc-3.0.so.0
If any of them are not in
/usr/local/lib
, just ignore them and create only the ones that exist.
This will solve problems when running our program!
Create a file with any name, for example main.cpp
and insert the content below:
#include <gtkmm.h>
class MyWindow : public Gtk::Window {
public:
MyWindow();
};
MyWindow::MyWindow(){
set_title("Basic application");
set_default_size(800, 450);
}
int main(int argc, char ** argv){
auto app = Gtk::Application::create("org.gtkmm.examples.base");
return app->make_window_and_run<MyWindow>(argc, argv);
}
Compile and run:
g++ main.cpp $(pkg-config gtkmm-4.0 --cflags --libs)
./a.out
If all steps were followed correctly, this window will appear: