Compilation for CentOS on Ubuntu

Is it possible to install an older version of gcc / g ++ (4.1.3) on the latest version of Ubuntu (which comes with 4.4.3) and use it to compile .so, which should run on CentOS? The binary compiled with the gcc version of Ubuntu gcc does not load on CentOS due to lack of import (GLIB_2_11, ...). I need C ++ (including exceptions), so I can’t just statically refer to glibc, which I have already tried.

Is it possible to install the old gcc without removing the newer? How do I go to the libs required by older gcc?

I am currently developing code on CentOS, but it is so painful to use. I really want to go to the Ubuntu desktop.

+5
source share
1 answer

g ++ - 4.1 is available for Ubuntu; just run apt-get install g++-4.1, then run g++-4.1instead g++. However, simply using an older compiler may not fix all the problems in your library.

As Joachim Sauer said, it's best to do your development on Ubuntu, and then do the final compilation on CentOS.

Although you use C ++, static binding should still be an option. (However, you are much better at compiling CentOS and using dynamic linking.)

: - CentOS, Ubuntu CentOS, , CentOS Fedora, chroot , . .

+5

All Articles