Skip to content

Doesn't build on x86_64 musl #4

@ericonr

Description

@ericonr

Hi! I'm trying to build firefox 87.0 on a musl system, and this crate won't build there, which stops the whole build process.

I opened rust-lang/libc#2121 to solve the libc constants, but I'm not sure how to fix the getregs dependency.

I have added this patch, which copies the actual restriction used by the nix crate (would be nice if Rust allowed querying for function availability instead of having to copy assignments):

--- third_party/rust/minidump_writer_linux/src/linux_ptrace_dumper.rs
+++ third_party/rust/minidump_writer_linux/src/linux_ptrace_dumper.rs
@@ -108,7 +108,7 @@ impl LinuxPtraceDumper {
                 Err(_) => continue,
             }
         }
-        #[cfg(any(target_arch = "x86", target_arch = "x86_64"))]
+        #[cfg(all(target_os = "linux", any(target_arch = "x86_64", target_arch = "x86"), target_env = "gnu"))]
         {
             // On x86, the stack pointer is NULL or -1, when executing trusted code in
             // the seccomp sandbox. Not only does this cause difficulties down the line

but I still get the following build failure:

5:44.40    Compiling minidump_writer_linux v0.1.0 (https://github.com/msirringhaus/minidump_writer_linux.git?rev=9191af36343846b2c7ada65b9602b481b717c4d8#9191af36)
 5:44.81 error[E0425]: cannot find function `getregs` in module `ptrace`
 5:44.81   --> /builddir/firefox-87.0/third_party/rust/minidump_writer_linux/src/thread_info/thread_info_x86.rs:85:61
 5:44.81    |
 5:44.81 85 |         let regs = Self::getregset(tid).or_else(|_| ptrace::getregs(unistd::Pid::from_raw(tid)))?;
 5:44.81    |                                                             ^^^^^^^ not found in `ptrace`
 5:45.53 error: aborting due to previous error

I can't figure out how to clean up that file to work on musl, it seems just throwing in a #[cfg ...] won't be enough.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions