Reputation: 1801
I am trying to build an c++ application using gcc to run it on Cent OS among others. The thing is, compiling this in Cent OS is harder than the development. I am using 2 libraries, the MySQL C API and the boost asio. The MySQL C API has a different version of the library for each OS. This makes me believe it a terrible idea to get the edition for ubuntu and run it on Cent OS.
Is the following recommended:
Build the program in ubuntu and use the libraries designed to work with Cent OS. Then copy the executable from ubuntu to Cent OS.
If the above is a good idea, can I build it on windows?
Upvotes: 1
Views: 39
Reputation: 4763
The main reason why different libraries are made for different linux versions is because they are using dependencies to different system .so files.
It's not a good idea to use on Ubuntu the libraries designed to work with Cent OS , since at compile time, they (might) dynamically link to your Ubuntu system .so files. You will never have the guarantee it will work.
Your suggestion of installing the Cent OS versions of the libraries in an Ubuntu system might work, but you need to test it first. If you can run your Ubuntu compiled program on the Cent OS system , then you are safe to go. Just make sure you make this test every time you want to install a library :).
Upvotes: 2