Skip to content

Commit 2aee72e

Browse files
committed
fix: name bcrypt on the MSVC side too — it needed no library list until now
一致性矩阵的两个 Windows 格都失败: lld-link: error: undefined symbol: __declspec(dllimport) BCryptGenRandom ⚠️ 而链接行里**一个 `-l` 都没有** —— 不是库里没这个名字,是那段 `ldflags` 挂在 `cfg(all(windows, not(env = "msvc")))` 下,两格都被排除: 一格是 `msvc@system`,另一格 `llvm@20.1.7` 在 Windows 宿主上默认目标 就是 `windows-msvc`。 ⭐ MSVC 那侧此前**不需要任何库列表** —— SDK 隐式链接常用的一套,写 `ldflags` 纯属噪声。`openkal.random` 改变了这一点:`bcrypt.lib` 不在两个工具链的 隐式集合里。两侧各写一次,因为它们对库的拼法不同、不共用列表。 ⚠️ 我先前判断「Windows SDK 出 bcrypt.lib 所以能解析」——**那句是凭印象**, 与我几小时前查 mingw 目录犯的是同一个错。真正的判据是那个 job 的链接行, 而它一个 `-l` 都没有。
1 parent 89e481f commit 2aee72e

1 file changed

Lines changed: 18 additions & 0 deletions

File tree

mcpp.toml

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,24 @@ openkal = "0.7.0"
5151
[target.'cfg(all(windows, not(env = "msvc")))'.build]
5252
ldflags = ["-lntdll", "-lsynchronization", "-lshell32", "-lkernel32", "-lbcrypt"]
5353

54+
# ⚠️ AND THE SAME ONE LIBRARY ON THE MSVC SIDE, WHICH UNTIL NOW NEEDED NONE.
55+
#
56+
# The block above lists the four this implementation calls into, and the MSVC
57+
# side never needed a list: its SDK links the usual set implicitly, so a
58+
# `ldflags` entry there would have been noise. `openkal.random` changes that —
59+
# `BCryptGenRandom` is in `bcrypt.lib`, and that one is not among the implicit
60+
# set on either the MSVC toolchain or clang's `windows-msvc` target.
61+
#
62+
# Measured on the conformance matrix, both Windows rows:
63+
#
64+
# lld-link: error: undefined symbol: __declspec(dllimport) BCryptGenRandom
65+
#
66+
# ⚠️ The predicate above is `not(env = "msvc")`, so neither row saw the entry
67+
# there. The library is named once per side because the two sides spell a
68+
# library differently and share no list.
69+
[target.'cfg(all(windows, env = "msvc"))'.build]
70+
ldflags = ["-lbcrypt"]
71+
5472
# Exceptions and run-time type information, on the one ABI where their absence
5573
# is asserted.
5674
#

0 commit comments

Comments
 (0)