#debugging segfault, -Zsanitiser=address nightly compile failures

33 messages ยท Page 1 of 1 (latest)

lusty sentinel
#

I have a segfault that I'd like to debug with -Zsanitizer=address. of course, i need to use Nightly to make that happen.
Running cargo 1.91.0-nightly (840b83a10 2025-07-30), running my dummy example that reproduces the bug with
RUSTFLAGS=-Zsanitizer=address cargo run -Zbuild-std --features foo,bar --example repro
causes different compile failures on different machines.

(i cargo cleaned and rm'd my .cargo/registry on every machine in question)

Without -Zsanitizer=address everything builds fine.
With it on, machine 1 throws:

error[E0463]: can't find crate for `thiserror_impl`
   --> /home/ari/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/thiserror-1.0.69/src/lib.rs:278:9
    |
278 | pub use thiserror_impl::*;
    |         ^^^^^^^^^^^^^^ can't find crate

And machine 2 throws a whole ton of

error[E0463]: can't find crate for `pin_project_internal`
   --> /mnt/weka/home/ari/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/pin-project-1.1.10/src/lib.rs:117:9
    |
117 | pub use pin_project_internal::pin_project;
    |         ^^^^^^^^^^^^^^^^^^^^ can't find crate

error: /mnt/weka/home/ari/src/psyche/target/debug/deps/libserde_derive-db1c349eb6bff2d0.so: undefined symbol: __asan_option_detect_stack_use_after_return
   --> /mnt/weka/home/ari/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/serde-1.0.219/src/lib.rs:339:1
    |

and many more errors involving missing symbols, crates, and duplicated definitions.

I've seen people report similar issues with other projects online, but with no solutions ๐Ÿ˜…
Any ideas as to why -Zsanitizer=address is causing massive changes in how crates are compiled / found?

brazen apex
#

What about today's nightly

lusty sentinel
#

lemme give it a shot :)

lusty sentinel
frozen chasm
#

i cant really help you with the -Zsanitizer stuff but what segfault are you hitting

lusty sentinel
#

was hoping that address sanitization would pick it up

#

might break out valgrind or gdb I guess

misty quartz
#

passing --target activates "cross compilation" mode in cargo, which means that it will only pass RUSTFLAGS to actual builds for the target, and not to build scripts and proc macros

#

your issue here is that a proc macro was compiled with asan, which is not at all what you want

lusty sentinel
#

๐Ÿคฏ

#

wow

#

thank you

misty quartz
#

the error message is really bad sadly :(

misty quartz
lusty sentinel
misty quartz
#

ok then not as long as youre using the stable toolchain

lusty sentinel
#

yeah - normally i use stable, was just switching to nightly to try this asan stuff

misty quartz
#

with asan you'll also need to compile all the libraries with asan i think

lusty sentinel
#

ooooooof

#

okay yeah that's not gonna happen

#

๐Ÿ˜ญ

#

would probably take me a week+ to compile all my libs with asan.. not even sure they're all available as source

#

ugh, okay, so next point of order is getting some other debugger in

sharp wharf
#

asan shouldn't care about all libs

misty quartz
#

ah

#

but you do miss instrumentation of course

misty quartz
#

so it seems unlikely to really aid debugging here unless the offending library also has it