Are there any idiosyncrasies or variations between distros that would affect C++ binaries compiled with GCC 4.7.x on one distro being used directly on another? I understand that the ideal situation is to compile from source on the second distro but I'd really prefer not to worry about compiling new GCC versions and the program source code on my production machine. I'm a relatively inexperienced linux user (hence the question!) and still prefer IDEs as opposed to command line compilation, ssh being all I can really use to access the production machine.
The code itself is nothing interesting but it does make use of some run of the mill OS facilities like blocking sockets and the like.
Any advice would be greatly appreciated!
Unless the binaries are built on exactly the same OS (including version) and exactly the same hardware there are no guarantees.
In practice:
If the hardware is the same family of chip it should work.
If the OS has the same Major number then it should (probably) work.
My advice build from source.
README
file. But usually it involves running two commands ./configure
and make
. If you don't want anything special you usually do not need to do anything else.G++ has had a stable ABI for quite a while, so that shouldn't cause problems. What is likely to cause problems is using dynamically linked libraries. The system running the program will need to have compatible versions of any shared libraries that the executable was compiled against. If you use only static linking, you shouldn't have a problem. You can turn on static linking by using the -static
option.
With static linkage, two conditions must be met:
1) The target system and the build system must be of same architecture (with exceptions: you can run 32-bit binaries on many 64-bit hosts)
2) The (g)libc package on the target system must not be an older version than on the build system (you can sometimes get away with minor version differences)
It gets more complicated with dynamic linkage.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With