Discussion:
[Mingw-w64-public] Cross-compiling with MinGW-w64
Spork Schivago
10 years ago
Permalink
Hi.

Is it possible to cross-compiling using pre-compiled binaries of mingw-w64?
I'm running Windows 7, 64-bit, and I'd like to be able to install the
compiler and make either 32-bit only applications or to make 64-bit
applications. Currently, the only way I found to do this is to install
two versions of MinGW-w64. The first one I pick for target x86_64, the
second one I pick the i686 one.

For example, I'd like to install the x86_64 targetted version and then pas
-m32 -march=i686 -mtune=i686 as CFLAGS and as LDFLAGS. Is this
possible?

Thanks
Alexandre Pereira Nunes
10 years ago
Permalink
See tdm-gcc, it works like that.
...
Gisle Vanem
10 years ago
Permalink
Post by Alexandre Pereira Nunes
See tdm-gcc, it works like that.
I know (that's why I love TDM-gcc). But according to my:
f:\MingW32\MingW-w64\bin\gcc.exe -v --help

MingW-w64 could do that too:
-m32 Generate 32bit i386 code
-m64 Generate 64bit x86-64 code

I was under the impression that:
f:\MingW32\MingW-w64\bin\gcc.exe

was just a driver for the right <prefix>gcc.exe.
True or false?
--
--gv

------------------------------------------------------------------------------
Ray Donnelly
10 years ago
Permalink
Post by Gisle Vanem
Post by Alexandre Pereira Nunes
See tdm-gcc, it works like that.
f:\MingW32\MingW-w64\bin\gcc.exe -v --help
-m32 Generate 32bit i386 code
-m64 Generate 64bit x86-64 code
f:\MingW32\MingW-w64\bin\gcc.exe
was just a driver for the right <prefix>gcc.exe.
True or false?
False. Back when Apple used GCC they had such a wrapper to two
distinct GCC builds.

There's a good reason not to use -m32 and -m64. You want to use SEH
for Win64 since it's fastest but you can only use sjlj or dwarf2
exceptions for Win32. Making a 'multilib' MinGW-w64 GCC forces the
same exception model on both.
Post by Gisle Vanem
--
--gv
------------------------------------------------------------------------------
_______________________________________________
Mingw-w64-public mailing list
https://lists.sourceforge.net/lists/listinfo/mingw-w64-public
------------------------------------------------------------------------------
Spork Schivago
10 years ago
Permalink
Ahh, that's a good point. So does that mean I shouldn't be trying to
cross-compile like that? (By cross-compile, I mean on the same OS, create
binaries for that os, just a different architecture. Like using the
32-bit compiler to create 64-bit exe's and vice-versa)

Is the best way to do this, if I really need 32-bit binaries and 64-bit
binaries, just to install a 32-bit version and a 64-bit version of MinGW?
I noticed the 32-bit version can create 64-bit executables.
...
Alexandre Pereira Nunes
10 years ago
Permalink
Post by Ray Donnelly
Post by Gisle Vanem
f:\MingW32\MingW-w64\bin\gcc.exe
was just a driver for the right <prefix>gcc.exe.
True or false?
False. Back when Apple used GCC they had such a wrapper to two
distinct GCC builds.
There's a good reason not to use -m32 and -m64. You want to use SEH
for Win64 since it's fastest but you can only use sjlj or dwarf2
exceptions for Win32. Making a 'multilib' MinGW-w64 GCC forces the
same exception model on both.
the 64-bit tdm-gcc has SEH with -m64 and sjlj with -m32 on the same
multilib toolchain. Perhaps it patches gcc/binutils/whatever, but it should
be trivial to port the behavior to a custom build.

niXman
10 years ago
Permalink
Post by Alexandre Pereira Nunes
See tdm-gcc, it works like that.
MinGW-W64 builds[1] with SjLj exceptions is also works like that.

[1]
https://sourceforge.net/projects/mingw-w64/files/Toolchains%20targetting%20Win32/Personal%20Builds/mingw-builds/installer/mingw-w64-install.exe/download

------------------------------------------------------------------------------
Continue reading on narkive:
Loading...