Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have a 64-bit RHEL 5.3 server. There's a piece of server software that's more memory efficient if I compile it as 32-bit. Is there a way to tell GCC to target 32-bit?

I just want a specific piece of software to be 32-bit, everything else should stay 64-bit.

This software is not packaged in the yum repositories so I cannot just do 'yum install 32-bit-version'.

share|improve this question

If you're stuck with compiling yourself, gcc accepts the -m32 option which should instruct the compiler to generate 32bit objects/executables. (Although, if you can go the route gekkz suggests, do that).

share|improve this answer

If you're using yum you should probably do install my_software-1.2.2-1.i386. Note that this is an example of how a package would look, as you will have to provide the actual package name with the version and append i386.

share|improve this answer
This software is not packaged in the yum repositories. I really need to compile it. – Hongli Lai Oct 27 '09 at 10:04

As Joergensen said, you can use the -m32 flag. This needs to be passed to both the compiler and linker.

Also, make sure you have the proper 32 bit devel packages.

share|improve this answer

Your Answer


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.