Making my GTK applications available for macOS

A while ago I was exploring the possibility of distributing my GTK applications for macOS. At the time I was having an issue with my distribution packages that turned out to be a show stopper.
I eventually moved on and lost access to the build machine I was using. Therefore nothing really came out of that effort but a few partially working packages I shared in the hope that somebody might find them useful.

Things changed recently when Christian Vogelgsang (aka lallafa) contacted me asking whether I still had macOS binaries of my IECHost GUI client to share with him. I initially thought it would be a wasteful effort to try and address the issue I had had, as there haven’t been many requests for my applications made by macOS users. Therefore I pointed Christian to one of the above mentioned partially working packages.

However, the idea of getting closure intrigued me and Christian was able to provide two insights that I had been unable to get to as I never had admin access to any of my macOS build machines.

By running the IECHost GUI client through dtruss (the equivalent of strace for macOS), he first identified that access to the loaders.cache file from within the GDK-PixBuf library was made by means of an absolute path that was specific to my first build machine. This turned out to be an issue in the way the GTK modulesets for jhbuild were configured. Specifically, the GDK-PixBuf library was built to be non-relocatable: the define -Drelocatable=true was not passed to Meson at configuration time.

Christian also made an attempt at addressing the hardcoded path, by making modifications to the library in question in a hex editor, getting some success running the application from Terminal, but without being able to run the bundle as intended.

In the meantime I gained access to a suitable build machine once again. I initially thought to just rebuild the GDK-PixBuf library to be relocatable and get Christian to test with it. It turned out that there was another issue now.

At this point I decided to set up the build environment for GTK from scratch and build the toolkit along with all of its dependencies. It turned out to be a tricky business as support for version 2 has been dropped a while back, but I was eventually successful and I was able to appreciate that in more recent modulesets the GDK-PixBuf was indeed built to be relocatable.

Still no joy running a fresh bundle for the IECHost GUI client.

The second insight came once again from Christian running dtruss. The relative path to loaders.cache was now wrong when referred to bundle contents.

With this additional piece of information, I was able to change the macOS bundling script for GTK applications and fix the issue.

As I was at it, I also decided to investigate the GTK-macOS integration side of things. Therefore now my GTK applications leverage the menu system in macOS (and its style of accelerators), instead of menus being part of the windows that my applications consist of.

Here are a few screenshots that show the current state of the IECHost GUI client on macOS:

IECHost GUI Client running on MacOS by Luigi Di Fraia
IECHost GUI Client running on macOS
IECHost GUI Client running on MacOS by Luigi Di Fraia
IECHost GUI Client running on macOS

I am extremely grateful to Christian for his help with this and you macOS users interested in my applications should too 🙂

Stay tuned for more!

About Luigi Di Fraia

I am a Senior DevOps Engineer so I get to work with the latest technologies and open-source software. However, in my private time I enjoy retro-computing.
This entry was posted in Technical and tagged , , , , , . Bookmark the permalink.

Leave a comment