Skip to content

Link to Bcrypt on Windows with Rust >= 1.57 #119

@jschwe

Description

@jschwe

rust-lang/rust#84096 introduced a dependency on BCryptGenRandom. This does not seem to play a role when just using cargo build, but when using corrosion, Bcrypt needs to be linked on Windows. See also rust-lang/rust#91974.

The following change fixes the build of rust2cpp and features for me (checked on Windows 11, msvc).
test/rust2cpp/CMakeLists.txt

-target_link_libraries(cpp-exe PUBLIC rust-lib)
+target_link_libraries(cpp-exe PUBLIC rust-lib Bcrypt)

test/features/CMakeLists.txt

-target_link_libraries(features-cpp-exe PUBLIC rust-feature-lib)
+target_link_libraries(features-cpp-exe PUBLIC rust-feature-lib Bcrypt)

But since this is something that will generally be needed as soon as someone uses whatever std function uses Bcrypt, Corrosion should probably add the Bcrypt dependency automatically on Windows (at least for Rust >=1.57).

Fixing this should also fix the CI failures on Windows for the stable and nightly toolchains.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions