LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Programming (https://www.linuxquestions.org/questions/programming-9/)
-   -   Gcc Version Compatibility (https://www.linuxquestions.org/questions/programming-9/gcc-version-compatibility-4175449028/)

joshp 02-07-2013 10:56 AM

Gcc Version Compatibility
 
Hey all,

What are the chances of a program that is compiled on gcc 4.7.x working on a system that has gcc 4.4.6?

To put it another way, if I have software that was built using gcc 4.7.x, would it work on a SL 6.1 install?

Josh

knudfl 02-07-2013 11:31 AM

A gcc 4.7.x compiled program may depend on libgcc_s.so.1 from gcc-4.7.x.

And if the program was compiled on an OS with a later glibc,
it may depend on objects from that glibc, i.e. libc.so.6
.
A way of testing : Copy the program executable to SL 6,
and run $ ldd <executable> : If nothing is missing, it's OK.

-

joshp 02-07-2013 12:41 PM

Thank you, was thinking in that direction. I am assuming that this would also apply to a C++ program as well?

knudfl 02-07-2013 02:51 PM

# 3

Any program that is compiled with gcc, g++.

But why not just recompile on the target OS ?

joshp 02-07-2013 03:07 PM

Long story short, our devs are using gcc 4.7.x and our production isn't.

suicidaleggroll 02-07-2013 03:18 PM

You could also get around the problem by compiling with static libraries.

knudfl 02-07-2013 03:28 PM

# 5
Quote:

our devs are using gcc 4.7.x and our production isn't
The gcc version isn't important ( usually ).
Most programs will compile with any gcc version 3.4.6 ... 4.x.x.
But there are of course exceptions.


All times are GMT -5. The time now is 02:34 PM.