tikv / pprof-rs

A Rust CPU profiler implemented with the help of backtrace-rs
Apache License 2.0
1.3k stars 99 forks source link

add support for nongnu-libunwind #102

Open YangKeao opened 2 years ago

YangKeao commented 2 years ago

Signed-off-by: YangKeao yangkeao@chunibyo.icu

First part of the https://github.com/tikv/pprof-rs/issues/75#issuecomment-1038643782 . Allow users to (dynamically) link with nongnu-libunwind (through libunwind-sys)

YangKeao commented 2 years ago

Tonight (after I go home), I will test this PR on raspberry pi.

zone117x commented 2 years ago

I wasn't able to get this compiling on linux arm64 or macOS arm64/m1.

Error when compiling from a linux arm64 host (using the docker image rust:latest):

error[E0583]: file not found for module `native`
  --> /usr/local/cargo/registry/src/github.com-1ecc6299db9ec823/libunwind-sys-0.5.1/src/lib.rs:19:1
   |
19 | mod native;
   | ^^^^^^^^^^^
   |
   = help: to create the module `native`, create file "/usr/local/cargo/registry/src/github.com-1ecc6299db9ec823/libunwind-sys-0.5.1/src/native.rs" or "/usr/local/cargo/registry/src/github.com-1ecc6299db9ec823/libunwind-sys-0.5.1/src/native/mod.rs"

error: couldn't read /Users/matt/Projects/stacks-encoding-native-js/target/aarch64-unknown-linux-gnu/release/build/libunwind-sys-59553bb4f6bd6fb9/out/bindings.rs: No such file or directory (os error 2)
  --> /usr/local/cargo/registry/src/github.com-1ecc6299db9ec823/libunwind-sys-0.5.1/src/lib.rs:12:1
   |
12 | include!(concat!(env!("OUT_DIR"), "/bindings.rs"));
   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   |
   = note: this error originates in the macro `include` (in Nightly builds, run with -Z macro-backtrace for more info)

For more information about this error, try `rustc --explain E0583`.
The following warnings were emitted during compilation:

warning: target aarch64-unknown-linux-gnu is unsupported

error: could not compile `libunwind-sys` due to 2 previous errors
warning: build failed, waiting for other jobs to finish...
error: build failed