ldc2 linux -> windows cross-compile linker error

H. S. Teoh hsteoh at qfbox.info
Fri Jul 25 17:14:38 UTC 2025


I cross-compile one of my projects from Linux to Windows, and it was
working fine with ldc2-1.40.1.  After upgrading to ldc2-1.41.0, however,
it's giving me this strange linker error:

```
lld-link: error: could not open 'Bcrypt.lib': No such file or directory
Error: linking with LLD failed
```

Compiler invocation:
```
ldc2 -mtriple=x86_64-windows-msvc -L/subsystem:windows -L/entry:wmainCRTStartup -O -linkonce-templates $SOURCE_FILES
```

Relevant section in ldc2.conf:
```
"x86_64-.*-windows.msvc":
{
    switches = [
        "-defaultlib=phobos2-ldc,druntime-ldc",
        "-link-defaultlib-shared=false",
    ];
    lib-dirs = [
        "/usr/src/d/ldc/ldc2-1.41.0-windows-x64/lib",
    ];
};
```

The path /usr/src/d/ldc/ldc2-1.41.0-windows-x64/lib points to the lib
directory of the unpacked tarball of the windows version of LDC. I
notice that there's a file mingw/bcrypt.lib, but for whatever reason
it's not getting picked up.

What am I doing wrong?


T

-- 
Why did the chicken cross the Möbius strip?  To get to the same side!


More information about the Digitalmars-d mailing list