Skip to content

proc-macro + -Zsanitizer=address = Linking error #10666

Closed
@Volker-Weissmann

Description

@Volker-Weissmann

Problem

If you give -Zsanitizer=address and use a proc-macro crate, you get an ugly linking error. It should either compile, or give a nicer error message.

Steps

Take this example crate

cargo build works fine, but

$  RUSTFLAGS="-Zsanitizer=address" cargo build                                                                                                                                                         
   Compiling otherlib v1.0.0 (/home/volker/Documents/bug/mycrate/otherlib)
   Compiling mycrate v1.0.0 (/home/volker/Documents/bug/mycrate)
error: /home/volker/Documents/bug/mycrate/target/debug/deps/libotherlib-b3d905195a09f55e.so: undefined symbol: __asan_register_elf_globals
 --> src/lib.rs:1:5
  |
1 | use otherlib;
  |     ^^^^^^^^

error: could not compile `mycrate` due to previous error

Possible Solution(s)

No response

Notes

$ rustc --version -v                                                                                                                                                                            
rustc 1.62.0-nightly (52ca603da 2022-04-12)
binary: rustc
commit-hash: 52ca603da73ae9eaddf96f77953b33ad8c47cc8e
commit-date: 2022-04-12
host: x86_64-unknown-linux-gnu
release: 1.62.0-nightly
LLVM version: 14.0.0

Version

cargo 1.62.0-nightly (e2e2ddd 2022-04-05)
release: 1.62.0-nightly
commit-hash: e2e2dddebe66dfc1403a312653557e332445308b
commit-date: 2022-04-05
host: x86_64-unknown-linux-gnu
libgit2: 1.4.2 (sys:0.14.2 vendored)
libcurl: 7.80.0-DEV (sys:0.4.51+curl-7.80.0 vendored ssl:OpenSSL/1.1.1m)
os: Arch Linux Rolling Release [64-bit]

Metadata

Metadata

Assignees

No one assigned

    Labels

    C-bugCategory: bug

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions