Skip to content

Commit 33da53f

Browse files
committed
fix(core): Core.Base links bcrypt on Windows, as Guid.cpp requires
System/Guid.cpp has called BCryptGenRandom on Windows since it gained a cryptographically strong source for Guid.NewGuid, and nothing linked bcrypt for it. Every Windows consumer therefore compiled the whole tree and then failed at link time: undefined reference to `BCryptGenRandom' Security.Cryptography.Random already does exactly this for the same library; Core.Base now does too. Found by the first Windows build of CNA against this runtime -- both the mingw-w64 cross-build and native MSVC hit it.
1 parent 5beb70c commit 33da53f

1 file changed

Lines changed: 9 additions & 0 deletions

File tree

modules/core/CMakeLists.txt

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,15 @@ function(_sharp_runtime_setup_core_base target)
66
# build artifacts, while the CMake target name remains unambiguous.
77
set_target_properties("${target}" PROPERTIES OUTPUT_NAME sharp_runtime_core)
88

9+
# System/Guid.cpp calls BCryptGenRandom on Windows (its cryptographically strong source for
10+
# Guid.NewGuid), so this component needs bcrypt exactly the way Security.Cryptography.Random
11+
# already does. Without it every Windows consumer fails at LINK time, after compiling
12+
# everything -- "undefined reference to `BCryptGenRandom'" -- which is where the first native
13+
# Windows build of a CNA application stopped.
14+
if(WIN32)
15+
target_link_libraries("${target}" PRIVATE bcrypt)
16+
endif()
17+
918
# FINAL-STAB-001 i686 dependency boundary: without native __int128 the Decimal
1019
# implementation is outside the supported surface (its header hard-errors), so the
1120
# translation unit must leave the build exactly as it left the monolithic source list.

0 commit comments

Comments
 (0)