Consideration about GTK "cross platform" compatibility

Hi all,

I’m planning on starting a big (at least for me) project.

The main idea is to build a software to create motion graphics and basic video composition, so the UI is going to be not so simple and might require custom widgets with lots of custom graphic (think about the curve editor, the main canvas and many more complex views).

I’ve been investigating the development stack to build upon and, in the end, the only viable solutions were C++/Qt and GTK3/Vala.

Even though Qt seems to be the best option, I don’t like it very much from a developer experience point of view, so I started thinking about Vala, since I was working with it and I found it rewarding, easy enough and capable of even complex tasks.

My main concern, now, is about cross compatibility.

Since I’d like this software to have the maximum audience possible, I wanted it to run the same on Window, Mac and Linux.

I tried a Google search with “GTK cross platform” as keywords and I found very little about the feasibility of a completely cross platform compatibility, many articles (much outdated) but not so many real case scenarios of successful experiments.

What do you guys think?
There is the possibility for a GTK3/Vala application to run smoothly on the three major platforms?
If the answer is yes, do you have some recommendations or readings on the topic?

Thanks in advance for your help and wise advice!

Giacomo

GNU Cash is an example of a complex cross-platform app written in GTK - so it seems possible. Since the vala compiler simply generates C code which is then compiled, it should also work fine in a cross platform context.

1 Like

GTK is a portable toolkit. This means applications written using it can be ported to different platforms—currently Linux and other Unix-like operating systems; Windows; and macOS. The main development target for GTK applications is, though, Linux mainly because the vast majority of contributors to the toolkit and to its underlying dependencies are Linux developers.

What this means in practice is that GTK applications are first and foremost meant to be developed and run under Linux-based desktop operating systems; nevertheless, you can also port them to work on Windows and macOS, with various degrees of success depending on your knowledge of those OS. GTK will try to “paper over” some of the underlying differences, and will try to ensure that the behavior of the application will be similar regardless of the platform on which it’s run—which may or may not be what you’re looking for.

There are various GTK-based applications that have been successfully ported to different operating systems other than Linux:

There are also smaller applications.

1 Like

@giacomoalbe I just wanna add one more success story of Vala and GTK on all platforms, it’s a FontBird


And by the way I recently tested (because also going to write something on Vala for Windows at work) HelloWorld app with all the GTK libraries, weighs 21 megabytes.

I also made this video This is a stupid illustrative example of the implementation of the guide, but youtube is a good platform for disseminating information, and everything posted there is remarkably indexed in Google.

2 Likes

You might also look into the D language and GtkD:

Tour of the D
132 GtkD demos and growing

Hope this helps.

1 Like

First of all, thank you guys for all the answers provided!

I made a tour of all the examples you stated (I already knew many of those projects, btw) and I have to say that now I feel a lot more comfortable with the idea of building a cross platform application in Gtk.

I think that some work needs to be done in order to make it work properly on every platform, but it might be worth the time and effort.

@gavr thanks for the BirdFont reference, I was not aware of the project, and it seems to be also very close to the requirements I have for my project, so your contribution has been very valuable!
And the explanation video you put on YouTube has been very informative too.
I might argue with your statement about the “discoverability” of the content, because I was looking exactly for those keywords, but I haven’t been able to find it.

I think that Gtk portability capability needs more and better advertisement, and maybe some more support, maybe I can do something useful for this in the future.

And @rontarrant: I also considered D for this particular project, but I found it lacking some “ease of use” compared to Vala and also a worse development experience (in particular wrt compile time, bindings completeness and documentation).

But nevertheless I enjoyed working with D, it’s a very nice and powerful programming language!

4 Likes

Heya,

FWIW my problem wasn’t getting my application itself run on Windows, but getting small enough release tarballs for Windows while still including everything I need (which isn’t just libs but also the gdk-pixbuf loader cache and stuff). Automating the creation of the release tarballs also seems rather painful :confused:
I can’t seem to find how birdfont does that (and the blog post about how GEdit does it doesn’t work for me anymore, I guess it’s a bit outdated :c). How do you guys do that?