DMD, Wine and MinGW

Joakim via Digitalmars-d digitalmars-d at puremagic.com
Sun Jan 18 09:32:28 PST 2015


On Sunday, 18 January 2015 at 16:32:54 UTC, ketmar via 
Digitalmars-d wrote:
> Hello.
>
> it seems that current dmd.exe segfaults in Wine (at least on my
> GNU/Linux x86 box, with freshly created WINEPREFIX), which 
> forces me to
> switch between windoze VM and working environment if i want to 
> write
> some win32 program (and i have to :-( ).
>
> so i have a bunch of questions:
> 1. does anybody observes the same behavior with Wine?

I used dmd under Wine years ago and didn't have a problem 
building a small utility, no recent use though.

> 2. does anybody tried to build dmd.exe with MinGW (this is not 
> related
> to crashes, i think, but i like to build dmd.exe with 
> cross-compiler)?

Not me.

> 3. does anybody thought about allowing each dmd version to 
> create all
> kind of object files on any platform, and how much is this 
> wanted?

Yes, Rainer had a pull that started dmd along this path by 
changing the command-line options, but Walter didn't want dmd to 
give any indication that cross-compiling was supported without 
the rest of the work done so he vetoed it:

https://github.com/D-Programming-Language/dmd/pull/3542

I can't imagine that it's _that_ hard to go the rest of the way 
by turning all the current target preprocessor macros into 
runtime logic and filling in what few OS-specific gaps are 
necessary, especially for a single host/target pair.  I've 
considered doing it but don't really have a need for it, so I 
held off.  ddmd might make the job easier, to the extent the 
frontend won't rely on host headers anymore.

> as for "3": i know that i need a linker too, which is not 
> ported (and
> will not be). yet i seen some attempts to rewrite optlink in D, 
> and if
> windows version of dmd will be able to generte proper COFFs (is
> -ms32coff doing that already?), it will be possible to use 
> MinGW linker
> and cross-linker with it.

Yes, dmd generates 32-bit COFF right now and I'm sure you can 
find a cross-linker that will work.

> allowing dmd to utilize MinGW toolchain will open some 
> possibilities
> for those who either already has MinGW and don't want to use 
> DMC, or
> for those who doing cross-compiles. as dmd alread can be build 
> with
> GCC, i don't think that this will take alot of efforts.
>
> actually, i made bare-bones "mingw.mak", and made some source 
> fixes
> here and there, and now i got "dmd.exe" compiled with MinGW
> cross-compiler. it shows dmd help when i launch it with wine, 
> but
> crashes when i'm trying to compile "hello world" (the 
> "official" dmd
> crashes with it too). as i don't have windows box to check it, 
> i don't
> know if it really works.

You can install Win7 for four months without a license, whether 
in a VM or spare partition.  I've done that before, sometimes 
wiping and installing on top after four months to start the timer 
again. ;) Maybe Win8 allows the same, or you can test on the 
Win10 Preview.


More information about the Digitalmars-d mailing list