You are not logged in.

#1 2012-04-15 14:05:05

Radioactiveman
Member
From: Germany
Registered: 2010-05-13
Posts: 388

[Solved] Compiling GTK+ application for Ubuntu on Arch

Hi all,

If I compile on Arch, the binary works only with ArchLinux.
But if I do the same on Ubuntu, it works also on ArchLinux.

What's the reason? Is it because of different pkg-config output?
And how do I compile on ArchLinux so it will work on other distributions?

Regards
Radioactiveman

Last edited by Radioactiveman (2012-04-15 21:55:09)

Offline

#2 2012-04-15 14:42:27

lunar
Member
Registered: 2010-10-04
Posts: 95

Re: [Solved] Compiling GTK+ application for Ubuntu on Arch

@Radioactiveman:  Why Arch binaries don't work in your specific case, but Ubuntu binaries do, can't be answered precisely without knowing your build system and compilation procedure. Generally, you can't compile binaries for other distributions on Arch Linux, at least not with a lot of hassle and manual intervention.  Arch Linux ships with the most recent versions of compilers and libraries, stable, non-rolling-release distributions are bound to lack behind.  Hence binaries compiled on Arch are likely to link against libraries that do not (yet) exist on other distributions.  Not to mention 32/64 bit incompatibilities…

If you want to build binaries for a wide range of Linux distributions, you need to do this on the oldest one you want to support.  And even that may not work, if the distribution you build on is much older than the newest one you want to support.

Best ship source distributions of your program, and leave building to users and packaging to distributors.  If you really need to provide binaries for distributions, use dedicated build services like OBS, or setup a separate virtual machine for each distribution you want to support.  And yes, the latter means a lot of work if you want to support reasonable many distributions, but that's just how things are, and the price developers have to pay for users to have the choice between so many distributions.  And it's the reason why only a tiny minority of projects distribute binaries.

Offline

#3 2012-04-15 16:09:15

Radioactiveman
Member
From: Germany
Registered: 2010-05-13
Posts: 388

Re: [Solved] Compiling GTK+ application for Ubuntu on Arch

Thanks for your extensive answer. I really appreciate it how Archers help each other. smile
I've already thought it's a problem with library linking.

But because of the recent version (Ubuntu 12.04), the same arch (x86-64)
and the simplicity (just a GTK window) it could have been different…

Offline

#4 2012-04-15 16:24:57

lunar
Member
Registered: 2010-10-04
Posts: 95

Re: [Solved] Compiling GTK+ application for Ubuntu on Arch

@Radioactiveman: As said, we'll need details of the build system and the code to judge this case.  Generally, even a simple Gtk window has a rather long chain of dependencies.

Offline

#5 2012-04-15 16:31:49

wonder
Developer
From: Bucharest, Romania
Registered: 2006-07-05
Posts: 5,941
Website

Re: [Solved] Compiling GTK+ application for Ubuntu on Arch

because our libraries are newer (especially glibc and gcc) and the resulted binaries requires symbols from them


Give what you have. To someone, it may be better than you dare to think.

Offline

#6 2012-04-15 19:37:57

/dev/zero
Member
From: Melbourne, Australia
Registered: 2011-10-20
Posts: 1,247

Re: [Solved] Compiling GTK+ application for Ubuntu on Arch

Radioactiveman wrote:

And how do I compile on ArchLinux so it will work on other distributions?

If it were only one other distribution (i.e. Ubuntu, as in your example), I would probably use a vm.

Offline

#7 2012-04-15 21:54:34

Radioactiveman
Member
From: Germany
Registered: 2010-05-13
Posts: 388

Re: [Solved] Compiling GTK+ application for Ubuntu on Arch

Thanks for your answers, marking as solved.

Offline

#8 2012-04-16 07:45:22

Blµb
Member
Registered: 2008-02-10
Posts: 224

Re: [Solved] Compiling GTK+ application for Ubuntu on Arch

(If glibc would support static linking you could build a static binary which runs on all distros...)

You could however, ship the .o files, and have them just linked on the target system... then they at least only need the compiler/linker and libs, and not all headers installed, too.


You know you're paranoid when you start thinking random letters while typing a password.
A good post about vim
Python has no multithreading.

Offline

Board footer

Powered by FluxBB