Skip to content

Duplicate DllMain symbols cause linkage failure using Rust 1.61 #97318

Closed
@complexspaces

Description

@complexspaces

As of Rust 1.60+, my work codebase no longer compiles correctly when trying to build a workspace package. I believe this may be related to #95604.

Code

I do not yet have a reproduction example as the crate that fails to build is heavy on internal dependencies.

I expected to see this happen: The crate would build correctly.

Instead, this happened: The linker fails with a duplicate DllMain symbol issue.

Version it worked on

It most recently worked on: 1.59

Version with regression

 rustc --version --verbose
rustc 1.61.0 (fe5b13d68 2022-05-18)
binary: rustc
commit-hash: fe5b13d681f25ee6474be29d748c65adcd91f69e
commit-date: 2022-05-18
host: x86_64-pc-windows-msvc
release: 1.61.0
LLVM version: 14.0.0

Link Error

Error

 = note:    Creating library T:\core\target\debug\deps\op_core_bindings.dll.lib and object T:\core\target\debug\deps\op_core_bindings.dll.exp
          libop_windows-45692cb0a6c830a2.rlib(op_windows-45692cb0a6c830a2.43v0ma26l5e2e6rk.rcgu.o) : error LNK2005: DllMain already defined in libcmt.lib(dll_dllmain_stub.obj)
          LINK : warning LNK4199: /DELAYLOAD:CRYPTBASE.DLL ignored; no imports found from CRYPTBASE.DLL
          LINK : warning LNK4199: /DELAYLOAD:NODE.EXE ignored; no imports found from NODE.EXE
          LINK : warning LNK4199: /DELAYLOAD:SECUR32.DLL ignored; no imports found from SECUR32.DLL
          LINK : warning LNK4199: /DELAYLOAD:SSPICLI.DLL ignored; no imports found from SSPICLI.DLL
          LINK : warning LNK4199: /DELAYLOAD:WTSAPI32.dll ignored; no imports found from WTSAPI32.dll
          LINK : warning LNK4199: /DELAYLOAD:tbs.dll ignored; no imports found from tbs.dll
          T:\core\target\debug\deps\op_core_bindings.dll : fatal error LNK1169: one or more multiply defined symbols found

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-linkageArea: linking into static, shared libraries and binariesC-bugCategory: This is a bug.O-windowsOperating system: WindowsO-windows-msvcToolchain: MSVC, Operating system: Windowsregression-from-stable-to-stablePerformance or correctness regression from one stable version to another.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions