Linux -> Windows crosscompiler

Marvin Gülker via digitalmars-d-ldc digitalmars-d-ldc at puremagic.com
Tue May 16 00:40:59 PDT 2017


On Mon, May 15, 2017 at 05:37:30PM +0000, Joakim via digitalmars-d-ldc wrote:
> Are you mixing object files produced by different D compilers?  That won't
> work, you need to compile all your D code with a single D compiler.

I'm sorry if I was unclear. No, I don't do that. I have, for the
attempts on native Windows, however tried mixing MinGW/MSYS2 GCC object
files for C code with LDC ones for D code. And I have tried mixing MSVC
object files with LDC ones for D code. The latter worked, but
GraphicsMagick fails to compile with MSVC 2017, and MSVC 2015 is only
crashing for me. I also tried mixing MinGW/MSYS2 GCC object files for C
code with DMD object files for D code, but haven't yet gotten around to
trying it with MSVC C object files since MSVC has stopped working for me
meanwhile.

As a non-Windows dev, this is a quite frustrating experience for me. The
most annoying thing is that whatever one does with the MSVC setup
installer, it takes really, really, really long. It doesn't do anything
under an hour. Why is it distributed as an ISO file that I have to burn
to a DVD first? That slows things further down... Since a few weeks, I
finally have an acceptable Internet connection (was a max 16MBit aDSL
line before), so at least downloading this insane amount of data went
acceptably fast.

I have concluded from that that D+C on Windows doesn't work for me,
mostly because MSVC doesn't.

I'm sorry if I am only complaining all the time. I'm an open-source
developer myself, so I know that users complain all the time about this
or that not fitting their exotic edgecase. I would have to work on LDC
to support MinGW if I wanted it to be otherwise, but given that I have
never worked on a compiler this is going to be difficult (and does not
fit my time constraints).

> It can be done with dmd, but it would require some work on the compiler
> itself.

Likewise.

> Of course, by default ldc is a cross-compiler for all other platforms it
> officially supports.  You simply need to pass the right llvm triple to ldc,
> similar to how it's done for the ARM cross-compiler.

See my reply to the other post; that worked indeed pretty seemless.

> The bigger issue is getting the cross-compiled stdlib and a cross-linker,
> that will link for Windows but run on linux.  You can probably just take the
> pre-built stdlib from the ldc for Windows package, but you're on your own
> for finding a cross-linker.  Maybe lld would work?

Likewise.

Greetings
Marvin

-- 
Blog: https://www.guelkerdev.de
PGP/GPG ID: F1D8799FBCC8BC4F


More information about the digitalmars-d-ldc mailing list