gcc: Compile a 64-bit binary on 32-bit platform

weekens picture weekens · Sep 28, 2011 · Viewed 24.9k times · Source

Is it possible to compile a 64-bit binary on a 32-bit Linux platform using gcc?

Answer

rubenvb picture rubenvb · Sep 28, 2011

If you have a multilib GCC installed, it's as simple as adding -m64 to the commandline. The compiler should complain if it is not built with multilib support.

In order to link, you'll need all the 64-bit counterparts of the standard libraries. If your distro has a multilib GCC, these should also be in the repositories.