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

pprof 0.9.1: Databend cannot be built on musl targets #138

Closed PsiACE closed 2 years ago

PsiACE commented 2 years ago
= note: /usr/local/bin/../lib/gcc/x86_64-linux-musl/9.2.0/../../../../x86_64-linux-musl/bin/ld: /workspace/target/x86_64-unknown-linux-musl/release/deps/databend_meta-3240ad175f7a77fc.pprof-d7659ef0c4e51494.pprof.f6a0a7fc-cgu.0.rcgu.o.rcgu.o: in function `pprof::profiler::write_thread_name':
          /opt/rust/cargo/registry/src/[github.com](http://github.com/)-1ecc6299db9ec823/pprof-0.9.1/src/[profiler.rs:193](http://profiler.rs:193/): undefined reference to `pthread_getname_np'
          collect2: error: ld returned 1 exit status

https://github.com/datafuselabs/databend/runs/7005883205?check_suite_focus=true#step:7:1134

Related:

Xuanwo commented 2 years ago

It works on my env:

:) cargo build --target x86_64-unknown-linux-musl
   Compiling libc v0.2.126
   Compiling cfg-if v1.0.0
   Compiling cc v1.0.73
   Compiling proc-macro2 v1.0.40
   Compiling unicode-ident v1.0.1
   Compiling quote v1.0.20
   Compiling autocfg v1.1.0
   Compiling memchr v2.5.0
   Compiling syn v1.0.98
   Compiling uuid v0.8.2
   Compiling cpp_demangle v0.3.5
   Compiling parking_lot_core v0.9.3
   Compiling scopeguard v1.1.0
   Compiling stable_deref_trait v1.2.0
   Compiling log v0.4.17
   Compiling rustc-demangle v0.1.21
   Compiling smallvec v1.8.0
   Compiling gimli v0.26.1
   Compiling symbolic-demangle v8.8.0
   Compiling adler v1.0.2
   Compiling fastrand v1.7.0
   Compiling remove_dir_all v0.5.3
   Compiling bitflags v1.3.2
   Compiling pprof v0.9.1 (/home/xuanwo/Code/tikv/pprof-rs)
   Compiling once_cell v1.12.0
   Compiling miniz_oxide v0.5.3
   Compiling debugid v0.7.3
   Compiling lock_api v0.4.7
   Compiling object v0.28.4
   Compiling findshlibs v0.10.2
   Compiling backtrace v0.3.65
   Compiling memmap2 v0.5.4
   Compiling nix v0.24.1
   Compiling tempfile v3.3.0
   Compiling symbolic-common v8.8.0
   Compiling parking_lot v0.12.1
   Compiling addr2line v0.17.0
   Compiling thiserror-impl v1.0.31
   Compiling thiserror v1.0.31
    Finished dev [unoptimized + debuginfo] target(s) in 4.11s
cargo build --target x86_64-unknown-linux-musl  30.47s user 4.75s system 846% cpu 4.160 total
Xuanwo commented 2 years ago

Seems not related to pprof-rs itself.

Xuanwo commented 2 years ago

tikv-jemalloc-sys works too.

:) cargo build --target x86_64-unknown-linux-musl
   Compiling cc v1.0.73
   Compiling libc v0.2.126
   Compiling fs_extra v1.2.0
   Compiling cfg-if v0.1.10
   Compiling paste v1.0.7
   Compiling tikv-jemalloc-sys v0.5.0+5.3.0 (/home/xuanwo/Code/tikv/jemallocator/jemalloc-sys)
warning: "`background_threads_runtime_support` not supported for `x86_64-unknown-linux-musl`"
   Compiling tikv-jemallocator v0.5.0 (/home/xuanwo/Code/tikv/jemallocator/jemallocator)
   Compiling tikv-jemalloc-ctl v0.5.0 (/home/xuanwo/Code/tikv/jemallocator/jemalloc-ctl)
   Compiling tikv-jemallocator-global v0.5.0 (/home/xuanwo/Code/tikv/jemallocator/jemallocator-global)
    Finished dev [unoptimized + debuginfo] target(s) in 16.83s
cargo build --target x86_64-unknown-linux-musl  86.88s user 10.19s system 575% cpu 16.879 total
Xuanwo commented 2 years ago

Maybe related: https://github.com/tikv/pprof-rs/issues/41#issuecomment-1073523444

Xuanwo commented 2 years ago

Can you take a look at the musl version databend use?

Xuanwo commented 2 years ago

Not related to pprof-rs, addressed by https://github.com/datafuselabs/databend/pull/6165