Take the 2-minute tour ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

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

share|improve this question

3 Answers 3

up vote 1 down vote accepted

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.

share|improve this answer

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.

share|improve this answer
    
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.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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