Reputation: 1527
I'm developing C++ application on Debian machine with installed GCC 6.3.0 x64 architecture, but the application would run on Centos with GCC 4.4.7 x86.
How do I compile my app for the target environment? Is the only way to do that is to install GCC 4.4.7 on my host machine?
Upvotes: 2
Views: 1361
Reputation: 238441
You can build with your GCC 6.3, but you should use the -D_GLIBCXX_USE_CXX11_ABI=0
option to use the older ABI to be compatible with GCC older than 4.9. Otherwise it will not run properly on the target system.
To be absolutely sure of compatibility, you can indeed use the toolchain of the target system. You don't need to install it on your machine directly though. You can compile in a virtual machine running the older distro, or use docker (or some other container system).
Upvotes: 3