Wednesday, April 7, 2010

Compile 32 bit C Code On Your 64 bit Linux Workstation

So, you need to compile for a 32 bit server (or whatever similar scenario you may encounter)? Well, if you are using gcc, there is a simple solution:

$ gcc -m32 -o output32 yourfile.c

And, the reverse, as you may have guessed already:

$ gcc -m64 -o output64 yourfile.c

Note: You may need to install the gcc multilibs for this to work properly.

Have an excellent evening all,

Kenny

0 comments:

Post a Comment