My production env runs CentOS 5.2 and 5.5 versions. I have to develop a new tool using C/C++ and deploy it on this production env.

I was planning to use Fedora 14 on my desktop with GCC 4.4 to do the development with Eclipse IDE. And then later I want to deploy the executables to CentOS 5.2 or 5.5 The production env will have GCC 4.4 as well.

Since both Fedora and CentOS are RHEL based, I thought this is possible.

So can I do this?

Or do I need to have CentOS 5.2/5.5 on my development desktop as well?

Thanks Amit


If you build static binaries, then you should be able to build on pretty much anything, and run pretty much anywhere. The exact details about how you build things static, would be best answered on stackoverflow.

Building in a different enviroment seems a bit silly though. Why not build yourself a VM, or chroot that is identical to production on your dev machine. That way you will be much less likely to expereince weird/unexpected incompatibilities.


if you link dynamic against libraries that are not present on centos then you need to provide the libraries as well

if you provide the source code and compile on the centos box you will need to provide any headers or source files that you use into your code. if you don't use anything special (you just use for example the libc) there is no need to provide extra libs.

one more thing you need to be careful is the CPU architecture - if you have code for 64 bits it will not work on 32.

  • don't build static unless this is a small program
    – silviud
    Dec 22 '10 at 1:49

You can do this, but you shouldn't.

It's best to build your final, production packages in a clean environment, which your development desktop certainly won't be. Since CentOS is free, there's no reason not to have a special build environment which is either made clean every time from kickstart or restored from a known-good snapshot. It's maybe a little setup work, but after that, you'll know the resulting packages will work with no surprise dependencies creeping in accidentally.

And, do you need gcc in your production environment? There's nothing wrong with having it there per se (attackers will copy in their own binaries), but generally production should be as focused as possible.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.