Having trouble cross-compiling from linux to windows

Sergey kornburn at yandex.ru
Sat Jan 14 22:16:35 UTC 2023


I don't have ability to test it, but try this How-To:

* download LDC for Linux
* download LDC for Windows (multilib)
* extract LDC for Linux somewhere - it will be $LDC_PATH
* add to $PATH : $LDC_PATH/bin
* extract LDC for Windows and move folders lib32 and lib64 to 
<LDC_PATH>/win-lib32 and <LDC_PATH>/win_lib64
* add rows below to the $LDC_PATH/etc/ldc2.conf:
```bash
   "i[3-6]86-.*-windows-msvc":
   {
       switches = [
           "-defaultlib=phobos2-ldc,druntime-ldc",
           "-link-defaultlib-shared=false",
       ];
       lib-dirs = [
           "%%ldcbinarypath%%/../win-lib32",
       ];
   };

   "x86_64-.*-windows-msvc":
   {
       switches = [
           "-defaultlib=phobos2-ldc,druntime-ldc",
           "-link-defaultlib-shared=false",
       ];
       lib-dirs = [
           "%%ldcbinarypath%%/../win-lib64",
       ];
   };
```
* to build use
```dub build --arch=x86_64-pc-windows-msvc```



More information about the digitalmars-d-ldc mailing list