Skip to content

New linker error when building diesel with rust-beta on windows #139352

Closed
@weiznich

Description

@weiznich

Code

I tried this code: https://github.com/diesel-rs/diesel/tree/2.2.x (2464571)

I'm using the following command to execute tests: cargo +beta test --manifest-path diesel_derives/Cargo.toml --no-default-features --features "diesel/mysql mysql"

I expected to see this happen: Code compiles successful and tests complete (Link to the relevant CI run)

Instead, this happened: Code fails to compile with a linking error on windows (other systems work fine):

  = note:    Creating library D:\a\diesel\diesel\target\debug\deps\tests-1cc142ef763bf67a.lib and object D:\a\diesel\diesel\target\debug\deps\tests-1cc142ef763bf67a.exp␍
          mysqlclient.lib(my_init.obj) : error LNK2019: unresolved external symbol __imp_RegCloseKey referenced in function "bool __cdecl win32_have_tcpip(void)" (?win32_have_tcpip@@YA_NXZ)␍
          mysqlclient.lib(my_init.obj) : error LNK2019: unresolved external symbol __imp_RegEnumValueA referenced in function "void __cdecl win_init_registry(void)" (?win_init_registry@@YAXXZ)␍
          mysqlclient.lib(my_init.obj) : error LNK2019: unresolved external symbol __imp_RegOpenKeyExA referenced in function "bool __cdecl win32_have_tcpip(void)" (?win32_have_tcpip@@YA_NXZ)␍
          mysqlclient.lib(common.obj) : error LNK2019: unresolved external symbol __imp_EqualSid referenced in function "public: bool __cdecl Sid::operator==(class Sid const &)" (??8Sid@@QEAA_NAEBV0@@Z)␍
          mysqlclient.lib(common.obj) : error LNK2019: unresolved external symbol __imp_GetTokenInformation referenced in function "public: __cdecl Sid::Sid(void *)" (??0Sid@@QEAA@PEAX@Z)␍
          mysqlclient.lib(common.obj) : error LNK2019: unresolved external symbol __imp_IsValidSid referenced in function "public: bool __cdecl Sid::is_valid(void)const " (?is_valid@Sid@@QEBA_NXZ)␍
          mysqlclient.lib(common.obj) : error LNK2019: unresolved external symbol __imp_LookupAccountNameW referenced in function "public: __cdecl Sid::Sid(wchar_t const *)" (??0Sid@@QEAA@PEB_W@Z)␍
          D:\a\diesel\diesel\target\debug\deps\tests-1cc142ef763bf67a.exe : fatal error LNK1120: 7 unresolved externals␍

Link to the relevant CI run

Version it worked on

It most recently worked on: Current stable (1.86.0)

Version with regression

rustc --version --verbose:

rustc 1.87.0-beta.1 (45165c82a 2025-04-01)

@rustbot label: O-windows regression-from-stable-to-beta

Metadata

Metadata

Assignees

No one assigned

    Labels

    C-bugCategory: This is a bug.O-windowsOperating system: WindowsT-libsRelevant to the library team, which will review and decide on the PR/issue.regression-from-stable-to-betaPerformance or correctness regression from stable to beta.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions