You are not logged in.
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
@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
Thanks for your extensive answer. I really appreciate it how Archers help each other.
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
@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
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
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
Thanks for your answers, marking as solved.
Offline
(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