Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Duplicate DllMain symbols cause linkage failure using Rust 1.61 #97318

Closed
complexspaces opened this issue May 23, 2022 · 6 comments
Closed

Duplicate DllMain symbols cause linkage failure using Rust 1.61 #97318

complexspaces opened this issue May 23, 2022 · 6 comments
Labels
A-linkage Area: linking into static, shared libraries and binaries C-bug Category: This is a bug. O-windows Operating system: Windows O-windows-msvc Toolchain: MSVC, Operating system: Windows regression-from-stable-to-stable Performance or correctness regression from one stable version to another.

Comments

@complexspaces
Copy link

complexspaces commented May 23, 2022

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

@complexspaces complexspaces added C-bug Category: This is a bug. regression-untriaged Untriaged performance or correctness regression. labels May 23, 2022
@rustbot rustbot added the I-prioritize Issue: Indicates that prioritization has been requested for this issue. label May 23, 2022
@thomcc thomcc added O-windows Operating system: Windows O-windows-msvc Toolchain: MSVC, Operating system: Windows A-linkage Area: linking into static, shared libraries and binaries labels May 23, 2022
@ChrisDenton
Copy link
Member

It most recently worked on: 1.59

So, to be clear, it fails on 1.60? Or did you not test that version?

@complexspaces
Copy link
Author

That's my bad, sorry. It also fails with 1.60 with the same error. We did not try using 1.60 (upgrading from 1.59 to 1.61) but I can reproduce the problem with it too. I'll update the issue,

rustc 1.60.0 (7737e0b5c 2022-04-04)
binary: rustc
commit-hash: 7737e0b5c4103216d6fd8cf941b7ab9bdbaace7c
commit-date: 2022-04-04
host: x86_64-pc-windows-msvc
release: 1.60.0
LLVM version: 14.0.0

@complexspaces
Copy link
Author

I've been trying to narrow this one down more. I haven't had any success with cargo bisect-rustc yet but this issue does not occur in the latest nightly build:

rustc 1.63.0-nightly (b2eed72a6 2022-05-22)
binary: rustc
commit-hash: b2eed72a6fbf254e7d44942eaa121fcbed05d3fb
commit-date: 2022-05-22
host: x86_64-pc-windows-msvc
release: 1.63.0-nightly
LLVM version: 14.0.4

@complexspaces
Copy link
Author

cargo rustc-bisect reports that this issue was fixed by #95604. I still have not had any success finding where it regressed though, sorry.

cargo bisect-rustc -vv --regress=success --preserve --test-dir=./ffi/op-core-bindings --start=1.59.0

...

searched toolchains 02822334e9bd22df33c0692cbaade5a5b5449130 through ef9b49881ba99248b68dbdebbebd50155587c509

********************************************************************************
Regression in 18b53cefdf7456bf68937b08e377b7e622a115c2
********************************************************************************

@apiraino apiraino removed the I-prioritize Issue: Indicates that prioritization has been requested for this issue. label May 26, 2022
@inquisitivecrystal
Copy link
Contributor

inquisitivecrystal commented May 26, 2022

@complexspaces: since the problem seems to be fixed now and it's hard to pin down in the absence of an MCVE, would you be okay with this being closed?

@JohnTitor JohnTitor added regression-from-stable-to-stable Performance or correctness regression from one stable version to another. and removed regression-untriaged Untriaged performance or correctness regression. labels May 26, 2022
@rustbot rustbot added the I-prioritize Issue: Indicates that prioritization has been requested for this issue. label May 26, 2022
@JohnTitor JohnTitor removed the I-prioritize Issue: Indicates that prioritization has been requested for this issue. label May 26, 2022
@complexspaces
Copy link
Author

@inquisitivecrystal Yes, I'm fine closing this one since we were unable to extract a minimal reproduction from our codebase.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-linkage Area: linking into static, shared libraries and binaries C-bug Category: This is a bug. O-windows Operating system: Windows O-windows-msvc Toolchain: MSVC, Operating system: Windows regression-from-stable-to-stable Performance or correctness regression from one stable version to another.
Projects
None yet
Development

No branches or pull requests

7 participants