Which crosscompiler to use

Hello,

I used the unstable packages in windows:mingw:win64
for a long time. Now linking does not work any more and the package seems unmaintained?!
/usr/lib64/gcc/x86_64-w64-mingw32/7.2.0/…/…/…/…/x86_64-w64-mingw32/bin/ld: BFD (GNU Binutils) 2.29.1 assertion fail …/…/bfd/cofflink.c:265

Is there anyone doing crosscompiling? How do you do it? Other packages? Build yourself? E.g. http://mxe.cc/

I need g++ and gfortran to build for Windows.

Thank you,

Fabian

I personally don’t know of any other Windows cross-compiler or used anything else.

My personal SOP is that the target platform determines my build platform choice.
Even if mingw is working perfectly, there are still going to be corner scenarios that don’t work.
The only way to avoid any and all such issues is to build Windows Apps on a Windows machine, Mac apps on a Mac machine, FOSS on a Linux machine, etc.

If you want to deploy code across platforms, there are alternatives to cross-compiling if your’e the author…
Java - “Write once, run anywhere” - Well, that’s the promise. The Java runtime addresses the platform integration
Mono - The C code itself is converted into the CLR, which is then used to compile against your target of choice.
Use a scripting language - Used to be, compiled code had performance advantages over JIT script code. No more. Today’s script engines often deliver performance like C and other compiled languages.

That’s just me, though…

TSU

Well, our C++ application has 60 man years of effort, we won’t rewrite it so soon :slight_smile:

We use many old academic code (often Fortran), that is easier to crosscompile than to build native in Windows (but it also works).

I found the reason: mingw is still working, it was openblas which was not properly crosscompiled. Before I used windows mkl (which is currently not available) for blas/lapack but netlib also works.

We tested mingw on Leap 42.2 and there was an error message in the linker indicating an issue with openblas - that was the helping hint.
/usr/lib64/gcc/x86_64-w64-mingw32/7.2.0/…/…/…/…/x86_64-w64-mingw32/bin/ld: BFD (GNU Binutils) 2.29.1 assertion fail …/…/bfd/cofflink.c:265
did not help.

Yup,
if you’re not “the author” it wouldn’t make much sense to re-write what you have.
Over the years, people have asked several Q about getting openblas to work, but I don’t remember any that specifically tried to build for Windows. You can still search for them to see if any might help or suggest a different approach.
So, for instance I don’t know if it’d be helpful to try to compile to run natively on Linux before you try to cross-compile to Windows…

TSU