koute / not-perf

A sampling CPU profiler for Linux
Apache License 2.0
870 stars 41 forks source link

Building fails with SIGSEV #15

Closed tumdum closed 4 years ago

tumdum commented 4 years ago

Executing repro.sh.txt produces compilation failure with sigsev, logs: log.txt

koute commented 4 years ago

Hmm... this is very interesting!

According to those logs it crashes in libc crate's build.rs, which is very very strange as that script doesn't have any unsafe nor any external dependencies. And of course I can't reproduce it on my system. ):

  1. Is it always reproducible on your system?
  2. Do you have any $RUSTFLAGS set? (Or flags in .cargo/config.)
  3. Does it also crash if you manually run /home/klak/tmp/not-perf/target/release/build/libc-80018afddfa52891/build-script-build after running cargo build --release?
  4. Does it also crash if you clone libc and try to build it by itself?
tumdum commented 4 years ago
  1. Yes
  2. $RUSTFLAGS are empty and I don't have ~/.cargo/config
  3. Yes
  4. Yes :(
koute commented 4 years ago

That is really interesting. I guess at this point it would be interesting to see where exactly it SIGSEGVs - maybe then we can figure out why it does it.

Can you try running the build script under gdb? IIRC the build scripts might be built by-default in release mode (I'm not sure), so it may be necessary to cargo new --bin a new crate, copy the build.rs into its src/main.rs and perhaps run it with the same environment variables as the original build.rs to properly be able to debug it.

bjorn3 commented 4 years ago

the build scripts might be built by-default in release mode

I believe they are build with the same codegen options as the rest of the rlibs/executables by default.

tumdum commented 4 years ago

Closing - I no longer have access to that machine and I was never able to reproduce this on other machines.