Search code examples
linuxgcc64-bit32-bit

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


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


Solution

  • 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.