views:

25

answers:

2

I have a binary compiled with gcc 4.4.0 and am trying to run it on an older system, which does not have gcc 4.4.0. It doesn't work. The error is not that it can't find a symbol, but it just doesn't run correctly and hangs. The differences between the systems are CentOS 5.5 vs 5.2, and gcc 4.4.0 vs 3.4.6.

What can I do to get it running on that system without installing gcc 4.4.0? Are there run-time libraries we can put on it? Simply copying the dependecies over and setting the library path does not appear work.

The binary requires features of gcc 4.4.0.

A: 

If you're compiling, do it on a machine with older GLIBC libraries. I've set up a Debian in VirtualBox, that's works flawless when compiling Apache, MySQL and PHP.

Lekensteyn
The binary requires features of gcc 4.4.0, so we can't compile it on an older gcc version, if that is what you are suggesting.
Eruditass
Well, this solution would work only if the binary isn't using new functions of GCC 4.4.0. I'm out of idea's, sorry.
Lekensteyn
+1  A: 

I've run into a situation where I had to do this recently. My solution was to compile the executable as a statically linked application so there was no issues with compatibility between my application and needed libraries.

diverscuba23
Can you statically link in libgcc and whatnot? If so, how?
Eruditass
When you compile your code add the -static option to gcc. newer gcc versions will even statically link in dynamic libraries as needed. The down side is a much larger executable. (in my case the dynamically linked executable was 500KB and the statically linked executable was 17MB).
diverscuba23
Actually, when I run ldd on it, it says it is "not a dynamic executable" Does that mean it was dynamically linked? The error is not that it can't find a symbol, but it just doesn't run correctly and hangs.
Eruditass
you have a different binary format than what the dynamic loader knows about, and so can't process your executable. It may still be dynamically linked, you can tell that by doing using the file command on the system you compiled it on.
diverscuba23