Cross-compilation for Linux from Windows using DMD

Preetpal preetpal.sohal at gmail.com
Sat Mar 19 14:26:32 UTC 2022


Is this supposed to work out of the box (see: [Reddit 
Post](https://www.reddit.com/r/d_language/comments/sypgaj/dmd_supports_crosscompilation_with_os_switch/))?

Trying to cross-compile a hello world program for Linux on 
Windows with the command **dmd -os=linux main.d** which gives no 
output on the command line but there is an error:

```
C:\tmp\cross_compilation_d\linux>dmd --version
DMD64 D Compiler v2.099.0-dirty
Copyright (C) 1999-2022 by The D Language Foundation, All Rights 
Reserved written by Walter Bright

C:\tmp\cross_compilation_d\linux>dmd -os=linux main.d

C:\tmp\cross_compilation_d\linux>echo %ErrorLevel%
-1073741795

C:\tmp\cross_compilation_d\linux>dmd -os=host main.d

C:\tmp\cross_compilation_d\linux>echo %ErrorLevel%
0

```

How would you set it up, if it can be set up?




More information about the Digitalmars-d-learn mailing list