Trying to get cross compiling working on centos7. (I have jenkins running in that environment.) There is a lot of out of date documentation on the web for mingw. Apparently there was an answer here but is gone. The cross compilation steps are discussed here. I can do a sudo yum groupinstall -y packagename, but nothing I try works (MinGW-64 mingw-64 mingw64, MinGW64, or MinGW cross-compiler) as I have seen in various posts and forums. I also tried downloading the source but had no luck with that also as various pre-requsites are missing, and when I try and obtain them they don't exist or are the wrong version.
-
Have you tried installing using the EPEL repositories?– Timothy MartinCommented Dec 1, 2016 at 1:51
-
That's a good resource I was unaware of. I found discussion groups and some good documentation there. Thanks. I wonder why Google could not point it out?– ggb667Commented Dec 1, 2016 at 18:04
-
@ggb667 Because as of lately google has completely abandoned search for information in favour of search for advertising.– ajehCommented Jun 20, 2018 at 14:34
3 Answers
With the EPEL repo installed you can install mingw-w64
with:
yum install mingw64-gcc
-
7As of 2020-02-17 15:24:00 UTC mingw can no longer be found in the Centos 7 EPEL Repository See bugzilla.redhat.com/show_bug.cgi?id=1807975 and pagure.io/fesco/issue/2333 for more information on this issue.– RlonRyanCommented Mar 26, 2020 at 1:27
Finally located a compiled binary (good enough for my purposes) that will work. Here is the 64 bit binary for linux (prebuilt, just DL, and unpack it and upload the tar to the box). You will need to create an /opt/mingw64 directory and untar the file in that directory (sudo tar -xvf ~/mingw-w64-bin_x86_64-linux_20131228.tar) for ex. https://sourceforge.net/projects/mingw-w64/files/Toolchains%20targetting%20Win64/Automated%20Builds/ http://www.blogcompiler.com/2010/07/11/compile-for-windows-on-linux/
The compiler will be /opt/mingw64/bin/x86_64-w64-mingw32-gcc instead of just gcc. The reason for this is that we should be able to pick the right gcc, even if there are multiple compilers in the PATH environment.
-
works, but note that this is an old version with so many bugs and issues that the development team has decided to cancel maintenance. Commented Jun 8, 2020 at 7:33
if you are looking for mingw64-binutils to support linking EFI binaries, there is another, easier approach.
In Sep 2016 Fedora patched the distro gnu loader in binutils to support i386pep, which is what you need for EFI linking. So what I did is get that source, extract the patch, and apply it to the latest binutils you want to use in C7. I've done this multiple times if you need more help. I also have a working binary package for binutils patched this way. The build is easy and quick, even easier to test.
Here is what you see on C8:
ld -V
GNU ld version 2.30-79.el8
Supported emulations:
elf_x86_64
elf32_x86_64
elf_i386
elf_iamcu
i386linux
elf_l1om
elf_k1om
i386pep <--- EFI support