Skip to content

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

Closed
@russelltg

Description

@russelltg

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-linkageArea: linking into static, shared libraries and binariesA-sanitizersArea: Sanitizers for correctness and code qualityC-bugCategory: This is a bug.O-windows-msvcToolchain: MSVC, Operating system: Windows

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions