What stops DMD from cross-compiling?

Vladimir Panteleev thecybershadow.lists at gmail.com
Sat Apr 28 10:02:00 UTC 2018


On Friday, 27 April 2018 at 10:56:50 UTC, Rel wrote:
> So I was thinking what actually stops DMD from doing the same 
> thing?

IIRC:

1. Linking. DMD uses platform linkers, and the only thing it can 
"link" by itself is a library (with -lib).
2. Import libraries, for Windows COFF targets. (OMF import 
libraries are in the Windows distribution.)
3. Cross-platform C compilation Platform headers (some parts of 
Phobos/Druntime are in C), with all its dependencies, i.e. C 
compiler support, platform and libc headers...
4. When we link to the libc statically (i.e. on Windows), that is 
also needed.
5. CTFE needs to emulate the target architecture, which creates 
some issues with things like pointer size and floating-point 
calculations.

Probably the closest thing to cross-platform building would be 
through LDC, as LLVM already includes everything for C cross 
compilation.



More information about the Digitalmars-d mailing list