Is it possible to configure the gcc cross compiler on Linux to compile 64-bit targets in a 32-bit architecture?

I know that you can compile a 32-bit target on 64-bit Linux using the -m32 flag, but is it possible to compile it on a 64-bit machine on a 32-bit machine using the -m64 flag?

Or, alternatively, do you need to configure the cross gcc toolchain that supports 64-bit targets and is this possible on a 32-bit machine?

Regards, Johan

+6
linux 32bit-64bit cross-compiling
source share
4 answers

As MarkR noted, it is much easier to run a 64-bit VM and build there. Otherwise, yes, you will need to build the gcc cross toolchain.

Good resources for creating gcc cross-reference:

+6
source share

yes, its possible and actually quite simple. Just install gcc-multilib .

+5
source share

Yes, it should be possible. This is possible on Mac OS X, where the Apple gcc toolchain supports x86, x86-64, ppc and ppc64, and you can compile for all 4 purposes from a development machine that is 32-bit or 64-bit.

+3
source share

You will need to configure the cross compiler. And don’t worry. Just start the 64-bit virtual machine. You can run 64-bit virtual machines on a 32-bit host OS, provided that the processor supports it (what will happen if it is not ancient).

-one
source share

All Articles