My PC is running Ubuntu 17.10 and has GTK+ 3.22.
When compiled from this environment the binaries cannot be run under Ubuntu 16.04 since the only GTK+ 3.18 is compatible with Ubuntu 16.04. How do I compile for a lower GTK runtime level?
My PC is running Ubuntu 17.10 and has GTK+ 3.22.
When compiled from this environment the binaries cannot be run under Ubuntu 16.04 since the only GTK+ 3.18 is compatible with Ubuntu 16.04. How do I compile for a lower GTK runtime level?
The other way around should work though.
Compile the binary on the older OS version and it should work fine on the newer one.
The usual solution is to not provide binaries at all, but let the users and the distribution developers / packagers deal with the problem.
Just make sure your app is easy to compile, which means use standard build system tools like mesonbuild
and add some build instruction in a README.md file.
the binaries cannor be run
. Well if the ABI doesn't change, you at least you have this guarantee: it will run. It may crash because that's an untested environment with different libraries version combination and you may encounter specific bugs, but that can be fixed. But still, it should run. Even distro have in their cycle "mass rebuilds", but even without that the thing is usable.
– liberforce
Mar 23 '18 at 13:26
It depends what are your real dependencies on the GTK+ API.
Each function has at the end of its documentation a Since:
field that tells on which version of GTK+ it first appeared. Both of your target versions are GTK+ 3, so they are ABI-compatible. So you just need to check which symbols are not found when you run your binaries compiled for 3.22 on your 3.18. Every symbol that isn't found has been added after 3.18. Every symbol with Since:
> 3.18 can't be used, you need to use the smallest common denominator. Once the symbols > 3.18 are identified, you have 2 choices:
.
#if GTK_CHECK_VERSION(3, 20, 0)
// Do it the GTK+ >= 3.20 way
#else
// Do it the GTK 3.18 way
// (and ensure you have checks in your configure.ac or similar to make
// sure configuration breaks if trying to build with a GTK+ < 3.18)
#endif