Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Binary compatibility between Linux distributions

Sorry if this is an obvious question, but I've found surprisingly few references on the web ...

I'm working with an API written in C by one of our business partners and supplied to us as a .so binary file, built on Fedora 11. We've been testing out the API on a Fedora 11 development machine with no problems. However, when I try to link against the API on our customer's target platform, which happens to be SuSE Enterprise 10.2, I get a "File format not recognized" error.

Commands that are also part of the binutils package, such as objdump or nm, give me the same file format error. The "file" command shows me:

ELF 64-bit LSB shared object, AMD x86-64, version 1 (SYSV), not stripped

and the "ldd" command shows:

ldd: warning: you do not have execution permission for `./libuscuavactivity.so.1.1'
./libuscuavactivity.so.1.1: /usr/lib64/libstdc++.so.6: version `GLIBCXX_3.4.9' not found (required by ./libuscuavactivity.so.1.1)
[dependent library list]

I'm guessing this is due to incompatibility between the C libraries on the two platforms, with the problem being that the code was compiled against a new version of glibc etc. than the one available on SuSE 10.2. I'm posting this question on the off chance that there is a way to compile the code on our partner's Fedora 11 platform in such a way that it will run on SuSE 10.2 as well.

like image 545
gareth_bowles Avatar asked Nov 20 '09 15:11

gareth_bowles


2 Answers

I think the trick is to build on a flavour of linux with the oldest kernel and C library versions of any of the platforms you wish to support. In my job we build on Debian 4, which allows us to officially support Debian 4 and above, RedHat 3,4,5, SuSE 10 plus various other distros (SELinux etc.) in an unofficial fashion.

I suspect by building on a nice new version of linux, it becomes difficult to support people on older machines.

(edit) I should mention that we use the default compiler that comes with Debian 4, which I think is GCC 4.1.2. Installing newer compiler versions tends to make compatibility much worse.

like image 179
Matt T Avatar answered Oct 03 '22 02:10

Matt T


Windows has it problems with compatability between different realeases, service packs, installed SDKs, and DLLs in general (DLL Hell, anyone?). Linux is not immune to the same kinds of issues.

The compatability issues I have seen include:

  • Runtime library changes
  • Link library changes
  • Kernel changes
  • Compiler technology changes (eg: pre and post EGCS gcc versions. This might be your issue).
  • Packager issues (RPM vs. APT)

In your particular case, I'd have them do a "gcc -v" on their system and report to you the gcc version number. Compare that to what you are using.

You might have to get hold of that version of the compiler to build your half with.

like image 30
T.E.D. Avatar answered Oct 03 '22 04:10

T.E.D.