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

Unable to link use of hyper_util with -Zsanitizer=address on msvc #124390

Open
russelltg opened this issue Apr 26, 2024 · 3 comments
Open

Unable to link use of hyper_util with -Zsanitizer=address on msvc #124390

russelltg opened this issue Apr 26, 2024 · 3 comments
Labels
A-linkage Area: linking into static, shared libraries and binaries A-sanitizers Area: Sanitizers for correctness and code quality C-bug Category: This is a bug. O-windows-msvc Toolchain: MSVC, Operating system: Windows

Comments

@russelltg
Copy link

I tried this code:

// Cargo.toml
// [package]
// name = "conflicting_weak_bug"
// version = "0.1.0"
// edition = "2021"

// [dependencies]
// hyper-util = { version = "0.1.3", features = ["client-legacy"] }

fn main() {
    hyper_util::client::legacy::connect::Connected::new();
}

With RUSTFLAGS=-Zsanitizer=address, I run cargo +nightly build --target=x86_64-pc-windows-msvc

I expected to see this happen: build succeeds

Instead, this happened: Build fails:

note: libtokio-b91778b05568f23f.rlib(tokio-b91778b05568f23f.tokio.1a77ed8b4a2c54db-cgu.0.rcgu.o) : fatal error LNK1227: conflicting weak extern definition for '__odr_asan_gen___rust_panic_type_info'.  New default '.weak.__odr_asan_gen___rust_panic_type_info.default._ZN100_$LT$core..iter..adapters..take..Take$LT$I$GT$$u20$as$u20$core..iter..traits..iterator..Iterator$GT$8try_fold17h072bc292ea794e70E' conflicts with old default '.weak.__odr_asan_gen___rust_panic_type_info.default._ZN102_$LT$core..iter..adapters..map..Map$LT$I$C$F$GT$$u20$as$u20$core..iter..traits..iterator..Iterator$GT$4next17h028b213dc72dac34E' in libtracing_core-a6cff17f7c0ffd01.rlib(tracing_core-a6cff17f7c0ffd01.tracing_core.3abebefd05f70947-cgu.0.rcgu.o)

Seems somwhat similar to #85461, however setting -Ccodegen-units=1 does not workaround the issue.

Meta

rustc --version --verbose:

rustc 1.79.0-nightly (ef8b9dcf2 2024-04-24)
binary: rustc
commit-hash: ef8b9dcf23700f2e2265317611460d3a65c19eff
commit-date: 2024-04-24
host: x86_64-pc-windows-msvc
release: 1.79.0-nightly
LLVM version: 18.1.4

MSVC version 14.39.33519

@russelltg russelltg added the C-bug Category: This is a bug. label Apr 26, 2024
@rustbot rustbot added the needs-triage This issue may need triage. Remove it if it has been sufficiently triaged. label Apr 26, 2024
@saethlin saethlin added A-linkage Area: linking into static, shared libraries and binaries A-sanitizers Area: Sanitizers for correctness and code quality O-windows-msvc Toolchain: MSVC, Operating system: Windows labels May 9, 2024
@saethlin saethlin changed the title Unable to link use of hypr_util with -Zsanitizer=address on msvc Unable to link use of hyper_util with -Zsanitizer=address on msvc May 24, 2024
@saethlin saethlin removed the needs-triage This issue may need triage. Remove it if it has been sufficiently triaged. label May 24, 2024
@rcvalle
Copy link
Member

rcvalle commented Aug 3, 2024

I couldn't reproduce it with the latest nightly build. Is this still an issue?

@russelltg
Copy link
Author

russelltg commented Aug 4, 2024

Yeah, the reproducer I posted earlier seems to be fixed. However, the bug does still exist. New reproducer:

// Cargo.toml
// [package]
// name = "conflicting_weak_bug"
// version = "0.1.0"
// edition = "2021"

// [dependencies]
// tokio = { version = "1.39.2", features = ["rt-multi-thread"] }

fn main() {
    let _ = tokio::runtime::Builder::new_multi_thread()
        .build()
        .unwrap();
}

Tested with 1.82.0-nightly (64ebd39da 2024-08-03)+ MSVC 14.40.33807

This was actually my original reproducer, but I minimized it to hyper to have it be simpler.

@samkearney
Copy link

I am encountering the same issue in an app with a multi-threaded tokio runtime (although my version of the error message shows a symbol conflict between a different library and my main executable)

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 A-sanitizers Area: Sanitizers for correctness and code quality C-bug Category: This is a bug. O-windows-msvc Toolchain: MSVC, Operating system: Windows
Projects
None yet
Development

No branches or pull requests

5 participants