Thread overview
Re: ldc2 linux -> windows cross-compile linker error
Jul 26
kinke
Jul 26
0xEAB
Jul 26
0xEAB
Jul 26
0xEAB
Jul 27
kinke
July 25
On Sat, Jul 26, 2025 at 05:19:52AM +1200, Richard (Rikki) Andrew Cattermole via Digitalmars-d wrote:
> Did you try renaming the import library to match the case sensitivity?

Huh, I added a symlink in lib/mingw: Bcrypt.lib -> bcrypt.lib, and now everything works.  Thanks!

Strange thing, though: I tracked it down to a `pragma(lib, "Bcrypt");` in one of my modules. However, changing this line to use lowercase "bcrypt" does not make a difference.  Running ldc2 -v indicates that for some reason it gets capitalized to Bcrypt.lib anyway by the compiler. But why is this?  I checked other pragma(lib,...) declarations that had lowercase library names, and they don't get auto-capitalized. Why is bcrypt different?


T

-- 
The most powerful one-line C program: #include "/dev/tty" -- IOCCC
July 26

On Friday, 25 July 2025 at 17:30:41 UTC, H. S. Teoh wrote:

>

Strange thing, though: I tracked it down to a pragma(lib, "Bcrypt"); in one of my modules. However, changing this line to use lowercase "bcrypt" does not make a difference. Running ldc2 -v indicates that for some reason it gets capitalized to Bcrypt.lib anyway by the compiler. But why is this? I checked other pragma(lib,...) declarations that had lowercase library names, and they don't get auto-capitalized. Why is bcrypt different?

I'm pretty sure this is caused by https://github.com/dlang/phobos/blob/4fc3facb47241747d0919ab98501bcf7ea8c595e/std/internal/windows/bcrypt.d#L9. [This module was added 3 months ago and is still in the stable branch only, not in master.]

July 26
On Sat, Jul 26, 2025 at 08:11:59AM +0000, kinke via Digitalmars-d wrote:
> On Friday, 25 July 2025 at 17:30:41 UTC, H. S. Teoh wrote:
> > Strange thing, though: I tracked it down to a `pragma(lib, "Bcrypt");` in one of my modules. However, changing this line to use lowercase "bcrypt" does not make a difference.  Running ldc2 -v indicates that for some reason it gets capitalized to Bcrypt.lib anyway by the compiler. But why is this?  I checked other pragma(lib,...) declarations that had lowercase library names, and they don't get auto-capitalized. Why is bcrypt different?
> 
> I'm pretty sure this is caused by https://github.com/dlang/phobos/blob/4fc3facb47241747d0919ab98501bcf7ea8c595e/std/internal/windows/bcrypt.d#L9.
> [This module was added 3 months ago and is still in the stable branch only,
> not in master.]

Aha! That's where the capital B Bcrypt comes from.  Is there any reason it's capitalized here but not in the actual library filename?


T

-- 
128√e980
July 26
On Saturday, 26 July 2025 at 15:38:52 UTC, H. S. Teoh wrote:
> Aha! That's where the capital B Bcrypt comes from.  Is there any reason it's capitalized here but not in the actual library filename?

Microsoft documents the lib file as `Bcrypt.lib`; see <https://learn.microsoft.com/en-us/windows/win32/api/Bcrypt/nf-bcrypt-bcryptgenrandom>.


July 26
On Saturday, 26 July 2025 at 18:31:54 UTC, 0xEAB wrote:
> Microsoft documents the lib file as `Bcrypt.lib`; see <https://learn.microsoft.com/en-us/windows/win32/api/Bcrypt/nf-bcrypt-bcryptgenrandom>.

Anyway, that line ought to be irrelevant for the most part and was only added because a sibling-module had something similar:
<https://github.com/dlang/phobos/blob/4fc3facb47241747d0919ab98501bcf7ea8c595e/std/internal/windows/advapi32.d#L17>
July 26
On Saturday, 26 July 2025 at 18:31:54 UTC, 0xEAB wrote:
> Microsoft documents the lib file as `Bcrypt.lib`; see <https://learn.microsoft.com/en-us/windows/win32/api/Bcrypt/nf-bcrypt-bcryptgenrandom>.

Anyway, the code in question has been replaced by the upcoming entropy system:
<https://github.com/dlang/phobos/blob/3e50ddbf9fe342a650d9cf15995afb541b5a2c04/std/internal/entropy.d#L886>
July 26
On Sat, Jul 26, 2025 at 06:31:54PM +0000, 0xEAB via Digitalmars-d wrote:
> On Saturday, 26 July 2025 at 15:38:52 UTC, H. S. Teoh wrote:
> > Aha! That's where the capital B Bcrypt comes from.  Is there any reason it's capitalized here but not in the actual library filename?
> 
> Microsoft documents the lib file as `Bcrypt.lib`; see <https://learn.microsoft.com/en-us/windows/win32/api/Bcrypt/nf-bcrypt-bcryptgenrandom>.

OK, in that case the file in the tarball should be named 'Bcrypt.lib' rather than 'bcrypt.lib', otherwise it breaks the linker on case-sensitive systems.


T

-- 
Nearly all men can stand adversity, but if you want to test a man's character, give him power. -- Abraham Lincoln
July 27

On Saturday, 26 July 2025 at 18:58:33 UTC, H. S. Teoh wrote:

>

OK, in that case the file in the tarball should be named 'Bcrypt.lib' rather than 'bcrypt.lib', otherwise it breaks the linker on case-sensitive systems.

The 'convention' is to use lowercase for the Windows libs, as in https://github.com/dlang/dmd/blob/941545f298c6f081577568f32a4905aa40571d29/druntime/src/core/sys/windows/bcrypt.d#L13.

July 27
On Sun, Jul 27, 2025 at 09:08:44AM +0000, kinke via Digitalmars-d wrote:
> On Saturday, 26 July 2025 at 18:58:33 UTC, H. S. Teoh wrote:
> > OK, in that case the file in the tarball should be named 'Bcrypt.lib' rather than 'bcrypt.lib', otherwise it breaks the linker on case-sensitive systems.
> 
> The 'convention' is to use lowercase for the Windows libs, as in https://github.com/dlang/dmd/blob/941545f298c6f081577568f32a4905aa40571d29/druntime/src/core/sys/windows/bcrypt.d#L13.

Well, I don't really care which way it is, as long as it's consistent and doesn't break on case-sensitive systems. :-)


T

-- 
People who are more than casually interested in computers should have at least some idea of what the underlying hardware is like. Otherwise the programs they write will be pretty weird. -- D. Knuth