Pyroscope failed to compile in docker container running Alpine Linux, with error:
Compiling pyroscope v0.5.3
error[E0277]: the trait bound `*mut c_void: Default` is not satisfied
--> /root/.cargo/registry/src/github.com-1ecc6299db9ec823/pyroscope-0.5.3/src/utils.rs:78:31
|
78 | let thread_id = check_err(unsafe { libc::pthread_self() })? as u64;
| --------- ^^^^^^^^^--------------------^^
| | | |
| | | this tail expression is of type `*mut libc::c_void`
| | the trait `Default` is not implemented for `*mut c_void`
| required by a bound introduced by this call
|
note: required by a bound in `check_err`
--> /root/.cargo/registry/src/github.com-1ecc6299db9ec823/pyroscope-0.5.3/src/utils.rs:54:27
|
54 | pub fn check_err<T: Ord + Default>(num: T) -> Result<T> {
| ^^^^^^^ required by this bound in `check_err`
For more information about this error, try `rustc --explain E0277`.
error: could not compile `pyroscope` due to previous error
warning: build failed, waiting for other jobs to finish...
thread 'main' panicked at 'Exited with status code: 101', /root/.cargo/registry/src/github.com-1ecc6299db9ec823/cargo-chef-0.1.44/src/recipe.rs:161:27
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
The command '/bin/sh -c cargo chef cook --release --target x86_64-unknown-linux-musl --recipe-path recipe.json' returned a non-zero code: 101
I am able to compile it with native toolchains on my Ubuntu machine, so I suspect this is due to alpine using Musl libc instead of glibc (especialy considering the error relates to libc bindings).
I attached an archive of a minimal example demonstrating the issue. It's just the "basic" pyroscope example separated out as its own project, along with a Dockerfile and .dockerignore.
Describe the bug you encountered:
Pyroscope failed to compile in docker container running Alpine Linux, with error:
What did you expect to happen instead?
Pyroscope should compile.
How did you install
pyroscope-rs
?In
Cargo.toml
:pyroscope-rs version and environment
pyroscope-rs 0.5.3 on Alpine (Musl libC).
I am able to compile it with native toolchains on my Ubuntu machine, so I suspect this is due to alpine using Musl libc instead of glibc (especialy considering the error relates to libc bindings).
I attached an archive of a minimal example demonstrating the issue. It's just the "basic" pyroscope example separated out as its own project, along with a Dockerfile and .dockerignore.
pyroscope_alpine_bug.zip