8000 Doesn't build on x86_64 musl · Issue #4 · rust-minidump/minidump-writer · GitHub
[go: up one dir, main page]

Skip to content

Doesn't build on x86_64 musl #4

Closed

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.

Activity

  1. msirringhaus commented on Mar 24, 2021

    @msirringhaus
    Collaborator

    Thanks for reporting this.
    Yes, the missing getregs is also a problem for other platforms, unfortunately.

    The quickest workaround to build Firefox would probably be to switch back to the old breakpad code.
    In toolkit/moz.configure grep for MOZ_OXIDIZED_BREAKPAD or rather def oxidized_breakpad(target) and return False there in case musl is used.
    At least until we figure a way out to do this properly in this crate.

  2. ericonr commented on Mar 24, 2021

    @ericonr
    Author

    Indeed, I'm looking into this now. It seems oxidized_breakpad can return true even when crashreporter is disabled, which is kind of a bug as well (firefox one, though). I'm patching moz.configure for now, then. Thanks :)

  3. ericonr commented on Mar 24, 2021

    @ericonr
    Author
  4. msirringhaus commented on Mar 24, 2021

    @msirringhaus
    Collaborator

    Yes, this plus your libc-PR looks like it might already do the trick.

    To test, you could just pull this crate, update the nix-version in Cargo.toml and add the missing AT_*-definitions by hand in the files that use them?

    I don't have a musl-system at hand at the moment.

    If it does work, there would need to be a bugreport at Mozilla, asking for a new version of nix.
    Unfortunately, the vendored crates in Firefox are usually quite old as updating them has the potential of breaking other things.
    So it seems to be done rarely.

  5. ericonr commented on Mar 24, 2021

    @ericonr
    Author

    It will probably work, given nix-rust/nix#1198, I can test in a bit!

    Hm, I will try to create a bug report, haven't used the firefox bug tracker ever. Might be nice to fix nix so it works on x86-musl as well, not only x86_64.

  6. msirringhaus commented on Mar 24, 2021

    @msirringhaus
    Collaborator

    A test would be good. Might be some other symbols missing.
    If it works, just post here. I can file that bug for you on Mozilla-side.
    One Mozilla employee already said, he would update it for us. And look into applying your libc - patch to their vendored crate (or update libc altogether)

  7. ericonr commented on Mar 25, 2021

    @ericonr
    Author

    Good thing you asked for a test :)

    I applied this diff

    diff --git a/Cargo.toml b/Cargo.toml
    index 5580b33..b071981 100644
    --- a/Cargo.toml
    +++ b/Cargo.toml
    @@ -9,8 +9,8 @@ license = "MIT"
     
     [dependencies]
     tempfile = "3.1.0"
    -nix = "0.13.1"
    -libc = "0.2.74"
    +nix = "0.19.1"
    +libc = { git = "https://github.com/rust-lang/libc" }
     memoffset = "0.5.1"
     byteorder = "1.3.2"
     memmap = "0.7.0"
    

    and got back:

       Compiling libc v0.2.91 (https://github.com/rust-lang/libc#1627d511)
       Compiling minidump_writer_linux v0.1.0 (/tmp/minidump_writer_linux)
    error[E0061]: this function takes 2 arguments but 1 argument was supplied
       --> src/linux_ptrace_dumper.rs:105:21
        |
    105 |                     ptrace::detach(pid).map_err(|e| DetachErr(child, e))?;
        |                     ^^^^^^^^^^^^^^ --- supplied 1 argument
        |                     |
        |                     expected 2 arguments
    
    error[E0061]: this function takes 2 arguments but 1 argument was supplied
       --> src/linux_ptrace_dumper.rs:135:17
        |
    135 |                 ptrace::detach(pid).map_err(|e| DetachErr(child, e))?;
        |                 ^^^^^^^^^^^^^^ --- supplied 1 argument
        |                 |
        |                 expected 2 arguments
    
    error[E0061]: this function takes 2 arguments but 1 argument was supplied
       --> src/linux_ptrace_dumper.rs:146:9
        |
    146 |         ptrace::detach(pid).map_err(|e| DetachErr(child, e))?;
        |         ^^^^^^^^^^^^^^ --- supplied 1 argument
        |         |
        |         expected 2 arguments
    
    error[E0308]: mismatched types
      --> src/thread_info/thread_info_x86.rs:85:53
       |
    85 |         let regs = Self::getregset(tid).or_else(|_| ptrace::getregs(unistd::Pid::from_raw(tid)))?;
       |                                                     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
       |                                                     |
       |                                                     expected struct `libc::user_regs_struct`, found struct `nix::libc::user_regs_struct`
       |                                                     help: try using a variant of the expected enum: `Err(ptrace::getregs(unistd::Pid::from_raw(tid)))`
       |
       = note: expected enum `std::result::Result<libc::user_regs_struct, _>`
                  found enum `std::result::Result<nix::libc::user_regs_struct, nix::Error>`
       = note: perhaps two different versions of crate `libc` are being used?
    

    I'm not sure how to proceed forward, but there seem to be two issues: a type mismatch and an API mismatch.

  8. added a commit that references this issue on Mar 25, 2021
  9. msirringhaus commented on Mar 25, 2021

    @msirringhaus
    Collaborator

    Ah yes, I remember the first one. There was some breaking API changes in nix::ptrace.
    You can just do ptrace::detach(pid, None).
    The second one is new to me. Maybe because the version of libc imported by us and the one re-exported by nix doesn't match.
    I'm not entirely sure, though. You could try replacing all libc::user_regs_struct with nix::libc::user_regs_struct inside src/thread_info/thread_info_x86.rs (but potentially outside as well)

  10. added a commit that references this issue on Mar 25, 2021
  11. ericonr commented on Mar 25, 2021

    @ericonr
    Author
    diff --git a/src/linux_ptrace_dumper.rs b/src/linux_ptrace_dumper.rs
    index 0e34a6d..42a6223 100644
    --- a/src/linux_ptrace_dumper.rs
    +++ b/src/linux_ptrace_dumper.rs
    @@ -102,7 +102,7 @@ impl LinuxPtraceDumper {
                 match wait::waitpid(pid, Some(wait::WaitPidFlag::__WALL)) {
                     Ok(_) => break,
                     Err(e @ nix::Error::Sys(Errno::EINTR)) => {
    -                    ptrace::detach(pid).map_err(|e| DetachErr(child, e))?;
    +                    ptrace::detach(pid, None).map_err(|e| DetachErr(child, e))?;
                         return Err(DumperError::WaitPidError(child, e));
                     }
                     Err(_) => continue,
    @@ -132,7 +132,7 @@ impl LinuxPtraceDumper {
                     skip_thread = true;
                 }
                 if skip_thread {
    -                ptrace::detach(pid).map_err(|e| DetachErr(child, e))?;
    +                ptrace::detach(pid, None).map_err(|e| DetachErr(child, e))?;
                     return Err(DumperError::DetachSkippedThread(child));
                 }
             }
    @@ -143,7 +143,7 @@ impl LinuxPtraceDumper {
         pub fn resume_thread(child: Pid) -> Result<(), DumperError> {
             use DumperError::PtraceDetachError as DetachErr;
             let pid = nix::unistd::Pid::from_raw(child);
    -        ptrace::detach(pid).map_err(|e| DetachErr(child, e))?;
    +        ptrace::detach(pid, None).map_err(|e| DetachErr(child, e))?;
             Ok(())
         }
     
    diff --git a/src/thread_info/thread_info_x86.rs b/src/thread_info/thread_info_x86.rs
    index 6dbf6c2..7800859 100644
    --- a/src/thread_info/thread_info_x86.rs
    +++ b/src/thread_info/thread_info_x86.rs
    @@ -5,8 +5,8 @@ use crate::minidump_cpu::RawContextCPU;
     #[cfg(target_arch = "x86_64")]
     use crate::thread_info::to_u128;
     use core::mem::size_of_val;
    -use libc;
    -use libc::user;
    +use nix::libc;
    +use nix::libc::user;
     use memoffset;
     use nix::sys::ptrace;
     use nix::unistd;

    Was indeed enough, but idk if this counts as punting the problem forward? Maybe most (all?) of the libc usage should be in the form of nix::libc?

  12. Whissi commented on Mar 27, 2021

    @Whissi

    FYI, the proposed patch doesn't work:

     5:32.74    Compiling minidump_writer_linux v0.1.0 (https://github.com/msirringhaus/minidump_writer_linux.git?rev=9191af36343846b2c7ada65b9602b481b717c4d8#9191af36)
     5:32.74      Running `CARGO=/usr/lib/rust/1.50.0/bin/cargo-1.50.0 CARGO_CRATE_NAME=minidump_writer_linux CARGO_MANIFEST_DIR=/var/tmp/portage/www-client/firefox-87.0/work/firefox-87.0/third_party/rust/minidump_writer_linux CARGO_PKG_AUTHORS='Martin Sirringhaus' CARGO_PKG_DESCRIPTION='' CARGO_PKG_HOMEPAGE='' CARGO_PKG_LICENSE=MIT CARGO_PKG_LICENSE_FILE='' CARGO_PKG_NAME=minidump_writer_linux CARGO_PKG_REPOSITORY='' CARGO_PKG_VERSION=0.1.0 CARGO_PKG_VERSION_MAJOR=0 CARGO_PKG_VERSION_MINOR=1 CARGO_PKG_VERSION_PATCH=0 CARGO_PKG_VERSION_PRE='' LD_LIBRARY_PATH='/var/tmp/portage/www-client/firefox-87.0/work/firefox_build/release/deps:/usr/lib/rust/1.50.0/lib' /usr/bin/sccache /usr/bin/rustc --crate-name minidump_writer_linux --edition=2018 /var/tmp/portage/www-client/firefox-87.0/work/firefox-87.0/third_party/rust/minidump_writer_linux/src/lib.rs --error-format=json --json=diagnostic-rendered-ansi,artifacts --crate-type lib --emit=dep-info,metadata,link -C opt-level=2 -C panic=abort -C embed-bitcode=no -C metadata=2f33d262f9afd261 -C extra-filename=-2f33d262f9afd261 --out-dir /var/tmp/portage/www-client/firefox-87.0/work/firefox_build/x86_64-unknown-linux-gnu/release/deps --target x86_64-unknown-linux-gnu -C linker=/var/tmp/portage/www-client/firefox-87.0/work/firefox-87.0/build/cargo-linker -L dependency=/var/tmp/portage/www-client/firefox-87.0/work/firefox_build/x86_64-unknown-linux-gnu/release/deps -L dependency=/var/tmp/portage/www-client/firefox-87.0/work/firefox_build/release/deps --extern byteorder=/var/tmp/portage/www-client/firefox-87.0/work/firefox_build/x86_64-unknown-linux-gnu/release/deps/libbyteorder-5a220ac65096a11a.rmeta --extern goblin=/var/tmp/portage/www-client/firefox-87.0/work/firefox_build/x86_64-unknown-linux-gnu/release/deps/libgoblin-461d7535f7a12cd5.rmeta --extern libc=/var/tmp/portage/www-client/firefox-87.0/work/firefox_build/x86_64-unknown-linux-gnu/release/deps/liblibc-d1acb77d421e99e1.rmeta --extern memmap=/var/tmp/portage/www-client/firefox-87.0/work/firefox_build/x86_64-unknown-linux-gnu/release/deps/libmemmap-96392cab11d397a9.rmeta --extern memoffset=/var/tmp/portage/www-client/firefox-87.0/work/firefox_build/x86_64-unknown-linux-gnu/release/deps/libmemoffset-1ddd1bc4fa9f0ddf.rmeta --extern nix=/var/tmp/portage/www-client/firefox-87.0/work/firefox_build/x86_64-unknown-linux-gnu/release/deps/libnix-6d726621185293e0.rmeta --extern tempfile=/var/tmp/portage/www-client/firefox-87.0/work/firefox_build/x86_64-unknown-linux-gnu/release/deps/libtempfile-5742b3f23b633433.rmeta --extern thiserror=/var/tmp/portage/www-client/firefox-87.0/work/firefox_build/x86_64-unknown-linux-gnu/release/deps/libthiserror-452098289428188f.rmeta --cap-lints warn -C opt-level=2 --cap-lints warn -C codegen-units=1`
     5:34.31 error[E0061]: this function takes 1 argument but 2 arguments were supplied
     5:34.31    --> /var/tmp/portage/www-client/firefox-87.0/work/firefox-87.0/third_party/rust/minidump_writer_linux/src/linux_ptrace_dumper.rs:105:21
     5:34.32     |
     5:34.32 105 |                     ptrace::detach(pid, None).map_err(|e| DetachErr(child, e))?;
     5:34.32     |                     ^^^^^^^^^^^^^^ ---  ---- supplied 2 arguments
     5:34.32     |                     |
     5:34.32     |                     expected 1 argument
     5:34.32 error[E0061]: this function takes 1 argument but 2 arguments were supplied
     5:34.32    --> /var/tmp/portage/www-client/firefox-87.0/work/firefox-87.0/third_party/rust/minidump_writer_linux/src/linux_ptrace_dumper.rs:135:17
     5:34.32     |
     5:34.32 135 |                 ptrace::detach(pid, None).map_err(|e| DetachErr(child, e))?;
     5:34.32     |                 ^^^^^^^^^^^^^^ ---  ---- supplied 2 arguments
     5:34.32     |                 |
     5:34.32     |                 expected 1 argument
     5:34.32 error[E0061]: this function takes 1 argument but 2 arguments were supplied
     5:34.32    --> /var/tmp/portage/www-client/firefox-87.0/work/firefox-87.0/third_party/rust/minidump_writer_linux/src/linux_ptrace_dumper.rs:146:9
     5:34.32     |
     5:34.32 146 |         ptrace::detach(pid, None).map_err(|e| DetachErr(child, e))?;
     5:34.32     |         ^^^^^^^^^^^^^^ ---  ---- supplied 2 arguments
     5:34.32     |         |
     5:34.32     |         expected 1 argument
     5:34.32 error: aborting due to 3 previous errors
     5:34.33 For more information about this error, try `rustc --explain E0061`.
     5:34.33 error: could not compile `minidump_writer_linux`
     5:34.33 Caused by:
     5:34.33   process didn't exit successfully: `CARGO=/usr/lib/rust/1.50.0/bin/cargo-1.50.0 CARGO_CRATE_NAME=minidump_writer_linux CARGO_MANIFEST_DIR=/var/tmp/portage/www-client/firefox-87.0/work/firefox-87.0/third_party/rust/minidump_writer_linux CARGO_PKG_AUTHORS='Martin Sirringhaus' CARGO_PKG_DESCRIPTION='' CARGO_PKG_HOMEPAGE='' CARGO_PKG_LICENSE=MIT CARGO_PKG_LICENSE_FILE='' CARGO_PKG_NAME=minidump_writer_linux CARGO_PKG_REPOSITORY='' CARGO_PKG_VERSION=0.1.0 CARGO_PKG_VERSION_MAJOR=0 CARGO_PKG_VERSION_MINOR=1 CARGO_PKG_VERSION_PATCH=0 CARGO_PKG_VERSION_PRE='' LD_LIBRARY_PATH='/var/tmp/portage/www-client/firefox-87.0/work/firefox_build/release/deps:/usr/lib/rust/1.50.0/lib' /usr/bin/sccache /usr/bin/rustc --crate-name minidump_writer_linux --edition=2018 /var/tmp/portage/www-client/firefox-87.0/work/firefox-87.0/third_party/rust/minidump_writer_linux/src/lib.rs --error-format=json --json=diagnostic-rendered-ansi,artifacts --crate-type lib --emit=dep-info,metadata,link -C opt-level=2 -C panic=abort -C embed-bitcode=no -C metadata=2f33d262f9afd261 -C extra-filename=-2f33d262f9afd261 --out-dir /var/tmp/portage/www-client/firefox-87.0/work/firefox_build/x86_64-unknown-linux-gnu/release/deps --target x86_64-unknown-linux-gnu -C linker=/var/tmp/portage/www-client/firefox-87.0/work/firefox-87.0/build/cargo-linker -L dependency=/var/tmp/portage/www-client/firefox-87.0/work/firefox_build/x86_64-unknown-linux-gnu/release/deps -L dependency=/var/tmp/portage/www-client/firefox-87.0/work/firefox_build/release/deps --extern byteorder=/var/tmp/portage/www-client/firefox-87.0/work/firefox_build/x86_64-unknown-linux-gnu/release/deps/libbyteorder-5a220ac65096a11a.rmeta --extern goblin=/var/tmp/portage/www-client/firefox-87.0/work/firefox_build/x86_64-unknown-linux-gnu/release/deps/libgoblin-461d7535f7a12cd5.rmeta --extern libc=/var/tmp/portage/www-client/firefox-87.0/work/firefox_build/x86_64-unknown-linux-gnu/release/deps/liblibc-d1acb77d421e99e1.rmeta --extern memmap=/var/tmp/portage/www-client/firefox-87.0/work/firefox_build/x86_64-unknown-linux-gnu/release/deps/libmemmap-96392cab11d397a9.rmeta --extern memoffset=/var/tmp/portage/www-client/firefox-87.0/work/firefox_build/x86_64-unknown-linux-gnu/release/deps/libmemoffset-1ddd1bc4fa9f0ddf.rmeta --extern nix=/var/tmp/portage/www-client/firefox-87.0/work/firefox_build/x86_64-unknown-linux-gnu/release/deps/libnix-6d726621185293e0.rmeta --extern tempfile=/var/tmp/portage/www-client/firefox-87.0/work/firefox_build/x86_64-unknown-linux-gnu/release/deps/libtempfile-5742b3f23b633433.rmeta --extern thiserror=/var/tmp/portage/www-client/firefox-87.0/work/firefox_build/x86_64-unknown-linux-gnu/release/deps/libthiserror-452098289428188f.rmeta --cap-lints warn -C opt-level=2 --cap-lints warn -C codegen-units=1` (exit code: 1)
     5:34.33 warning: build failed, waiting for other jobs to finish...
    
  13. ericonr commented on Mar 27, 2021

    @ericonr
    Author

    @Whissi you're missing the previous patch that updates the nix version.

  14. Whissi commented on Mar 28, 2021

    @Whissi

    OK, I think I managed to create a patch for Firefox 87.0 with the change and all crate updates, https://dev.gentoo.org/~whissi/stuff/firefox-87.0-musl-minidump_writer_linux.patch.gz -- at least it will allow me to build on glibc x86_64. But on a msul system, it will fail:

    24:19.95    Compiling minidump_writer_linux v0.1.0 (https://github.com/msirringhaus/minidump_writer_linux.git?rev=9191af36343846b2c7ada65b9602b481b717c4d8#9191af36)
    24:19.95      Running `CARGO=/usr/lib/rust/1.47.0/bin/cargo-1.47.0 CARGO_CRATE_NAME=minidump_writer_linux CARGO_MANIFEST_DIR=/var/tmp/portage/www-client/firefox-87.0/work/firefox-87.0/third_party/rust/minidump_writer_linux CARGO_PKG_AUTHORS='Martin Sirringhaus' CARGO_PKG_DESCRIPTION='' CARGO_PKG_HOMEPAGE='' CARGO_PKG_LICENSE=MIT CARGO_PKG_LICENSE_FILE='' CARGO_PKG_NAME=minidump_writer_linux CARGO_PKG_REPOSITORY='' CARGO_PKG_VERSION=0.1.0 CARGO_PKG_VERSION_MAJOR=0 CARGO_PKG_VERSION_MINOR=1 CARGO_PKG_VERSION_PATCH=0 CARGO_PKG_VERSION_PRE='' LD_LIBRARY_PATH='/var/tmp/portage/www-client/firefox-87.0/work/firefox_build/release/deps:/usr/lib/rust/1.47.0/lib' /usr/bin/rustc --crate-name minidump_writer_linux --edition=2018 /var/tmp/portage/www-client/firefox-87.0/work/firefox-87.0/third_party/rust/minidump_writer_linux/src/lib.rs --error-format=json --json=diagnostic-rendered-ansi,artifacts --crate-type lib --emit=dep-info,metadata,link -C opt-level=2 -C panic=abort -C embed-bitcode=no -C metadata=c9de868bd5a95119 -C extra-filename=-c9de868bd5a95119 --out-dir /var/tmp/portage/www-client/firefox-87.0/work/firefox_build/x86_64-gentoo-linux-musl/release/deps --target x86_64-gentoo-linux-musl -C linker=/var/tmp/portage/www-client/firefox-87.0/work/firefox-87.0/build/cargo-linker -L dependency=/var/tmp/portage/www-client/firefox-87.0/work/firefox_build/x86_64-gentoo-linux-musl/release/deps -L dependency=/var/tmp/portage/www-client/firefox-87.0/work/firefox_build/release/deps --extern byteorder=/var/tmp/portage/www-client/firefox-87.0/work/firefox_build/x86_64-gentoo-linux-musl/release/deps/libbyteorder-b13af10a76978d6d.rmeta --extern goblin=/var/tmp/portage/www-client/firefox-87.0/work/firefox_build/x86_64-gentoo-linux-musl/release/deps/libgoblin-79bd1bf38e85f59c.rmeta --extern libc=/var/tmp/portage/www-client/firefox-87.0/work/firefox_build/x86_64-gentoo-linux-musl/release/deps/liblibc-1cf0ad8cdbdbd66f.rmeta --extern memmap=/var/tmp/portage/www-client/firefox-87.0/work/firefox_build/x86_64-gentoo-linux-musl/release/deps/libmemmap-f30d41a086db5930.rmeta --extern memoffset=/var/tmp/portage/www-client/firefox-87.0/work/firefox_build/x86_64-gentoo-linux-musl/release/deps/libmemoffset-6d7f9492c374b2e8.rmeta --extern nix=/var/tmp/portage/www-client/firefox-87.0/work/firefox_build/x86_64-gentoo-linux-musl/release/deps/libnix-c975ef9254f2a127.rmeta --extern tempfile=/var/tmp/portage/www-client/firefox-87.0/work/firefox_build/x86_64-gentoo-linux-musl/release/deps/libtempfile-cb74b84b056fbbf2.rmeta --extern thiserror=/var/tmp/portage/www-client/firefox-87.0/work/firefox_build/x86_64-gentoo-linux-musl/release/deps/libthiserror-c08f12f3c21db51a.rmeta --cap-lints warn -C opt-level=2 --cap-lints warn -Cembed-bitcode=yes -C codegen-units=1`
    24:20.24 error[E0425]: cannot find value `AT_NULL` in crate `libc`
    24:20.24     --> /var/tmp/portage/www-client/firefox-87.0/work/firefox-87.0/third_party/rust/minidump_writer_linux/src/auxv_reader.rs:98:29
    24:20.24      |
    24:20.24 98   |             at_null = libc::AT_NULL;
    24:20.24      |                             ^^^^^^^ help: a constant with a similar name exists: `PT_NULL`
    24:20.24      | 
    24:20.24     ::: /var/tmp/portage/www-client/firefox-87.0/work/firefox-87.0/third_party/rust/libc/src/unix/linux_like/linux/mod.rs:1736:1
    24:20.24      |
    24:20.24 1736 | pub const PT_NULL: u32 = 0;
    24:20.24      | --------------------------- similarly named constant `PT_NULL` defined here
    24:20.24 error[E0425]: cannot find value `AT_PHDR` in crate `libc`
    24:20.24     --> /var/tmp/portage/www-client/firefox-87.0/work/firefox-87.0/third_party/rust/minidump_writer_linux/src/dso_debug.rs:91:25
    24:20.24      |
    24:20.24 91   |         at_phdr = libc::AT_PHDR;
    24:20.24      |                         ^^^^^^^ help: a constant with a similar name exists: `PT_PHDR`
    24:20.24      | 
    24:20.24     ::: /var/tmp/portage/www-client/firefox-87.0/work/firefox-87.0/third_party/rust/libc/src/unix/linux_like/linux/mod.rs:1742:1
    24:20.24      |
    24:20.25 1742 | pub const PT_PHDR: u32 = 6;
    24:20.25      | --------------------------- similarly named constant `PT_PHDR` defined here
    24:20.25 error[E0425]: cannot find value `AT_PHNUM` in crate `libc`
    24:20.25   --> /var/tmp/portage/www-client/firefox-87.0/work/firefox-87.0/third_party/rust/minidump_writer_linux/src/dso_debug.rs:92:26
    24:20.25    |
    24:20.25 92 |         at_phnum = libc::AT_PHNUM;
    24:20.25    |                          ^^^^^^^^ not found in `libc`
    24:20.25 error[E0425]: cannot find value `AT_ENTRY` in crate `libc`
    24:20.25    --> /var/tmp/portage/www-client/firefox-87.0/work/firefox-87.0/third_party/rust/minidump_writer_linux/src/linux_ptrace_dumper.rs:241:30
    24:20.25     |
    24:20.25 241 |             at_entry = libc::AT_ENTRY;
    24:20.25     |                              ^^^^^^^^ not found in `libc`
    24:20.71 error: aborting due to 4 previous errors
    24:20.71 For more information about this error, try `rustc --explain E0425`.
    24:20.71 error: could not compile `minidump_writer_linux`.
    24:20.71 Caused by:
    24:20.71   process didn't exit successfully: `CARGO=/usr/lib/rust/1.47.0/bin/cargo-1.47.0 CARGO_CRATE_NAME=minidump_writer_linux CARGO_MANIFEST_DIR=/var/tmp/portage/www-client/firefox-87.0/work/firefox-87.0/third_party/rust/minidump_writer_linux CARGO_PKG_AUTHORS='Martin Sirringhaus' CARGO_PKG_DESCRIPTION='' CARGO_PKG_HOMEPAGE='' CARGO_PKG_LICENSE=MIT CARGO_PKG_LICENSE_FILE='' CARGO_PKG_NAME=minidump_writer_linux CARGO_PKG_REPOSITORY='' CARGO_PKG_VERSION=0.1.0 CARGO_PKG_VERSION_MAJOR=0 CARGO_PKG_VERSION_MINOR=1 CARGO_PKG_VERSION_PATCH=0 CARGO_PKG_VERSION_PRE='' LD_LIBRARY_PATH='/var/tmp/portage/www-client/firefox-87.0/work/firefox_build/release/deps:/usr/lib/rust/1.47.0/lib' /usr/bin/rustc --crate-name minidump_writer_linux --edition=2018 /var/tmp/portage/www-client/firefox-87.0/work/firefox-87.0/third_party/rust/minidump_writer_linux/src/lib.rs --error-format=json --json=diagnostic-rendered-ansi,artifacts --crate-type lib --emit=dep-info,metadata,link -C opt-level=2 -C panic=abort -C embed-bitcode=no -C metadata=c9de868bd5a95119 -C extra-filename=-c9de868bd5a95119 --out-dir /var/tmp/portage/www-client/firefox-87.0/work/firefox_build/x86_64-gentoo-linux-musl/release/deps --target x86_64-gentoo-linux-musl -C linker=/var/tmp/portage/www-client/firefox-87.0/work/firefox-87.0/build/cargo-linker -L dependency=/var/tmp/portage/www-client/firefox-87.0/work/firefox_build/x86_64-gentoo-linux-musl/release/deps -L dependency=/var/tmp/portage/www-client/firefox-87.0/work/firefox_build/release/deps --extern byteorder=/var/tmp/portage/www-client/firefox-87.0/work/firefox_build/x86_64-gentoo-linux-musl/release/deps/libbyteorder-b13af10a76978d6d.rmeta --extern goblin=/var/tmp/portage/www-client/firefox-87.0/work/firefox_build/x86_64-gentoo-linux-musl/release/deps/libgoblin-79bd1bf38e85f59c.rmeta --extern libc=/var/tmp/portage/www-client/firefox-87.0/work/firefox_build/x86_64-gentoo-linux-musl/release/deps/liblibc-1cf0ad8cdbdbd66f.rmeta --extern memmap=/var/tmp/portage/www-client/firefox-87.0/work/firefox_build/x86_64-gentoo-linux-musl/release/deps/libmemmap-f30d41a086db5930.rmeta --extern memoffset=/var/tmp/portage/www-client/firefox-87.0/work/firefox_build/x86_64-gentoo-linux-musl/release/deps/libmemoffset-6d7f9492c374b2e8.rmeta --extern nix=/var/tmp/portage/www-client/firefox-87.0/work/firefox_build/x86_64-gentoo-linux-musl/release/deps/libnix-c975ef9254f2a127.rmeta --extern tempfile=/var/tmp/portage/www-client/firefox-87.0/work/firefox_build/x86_64-gentoo-linux-musl/release/deps/libtempfile-cb74b84b056fbbf2.rmeta --extern thiserror=/var/tmp/portage/www-client/firefox-87.0/work/firefox_build/x86_64-gentoo-linux-musl/release/deps/libthiserror-c08f12f3c21db51a.rmeta --cap-lints warn -C opt-level=2 --cap-lints warn -Cembed-bitcode=yes -C codegen-units=1` (exit code: 1)
    
  15. ericonr commented on Mar 28, 2021

    @ericonr
    Author

    Hm, have to wait for the libc release with those constants, I think (my patch pulled from libc git)... Maybe keeping a libc crate only for constants in here would help not being bound by the version nix is using.

  16. msirringhaus commented on Mar 29, 2021

    @msirringhaus
    Collaborator

    By the way, I've submitted a patch to fix the bug that this crate was being built, even if crashreporter is disabled: https://bugzilla.mozilla.org/show_bug.cgi?id=1701623

  17. gabrielesvelto commented on Oct 22, 2021

    @gabrielesvelto
    Contributor

    Firefox is now vendoring libc 0.2.97 which should include the fix above and nix 0.15.0. Would that be enough to fix this?

  18. msirringhaus commented on Oct 22, 2021

    @msirringhaus
    Collaborator

    No, from what I can tell the getregs() in nix is only available since version 0.18.0.
    I've just spun up an Alpine linux VM to check this. If I bump nix to 0.18.0 and do some minor adjustments to the changed API, it builds.
    But cargo test still fails, because of missing functions in libc.

  19. msirringhaus commented on Oct 22, 2021

    @msirringhaus
    Collaborator

    Addendum: The missing function in libc for cargo test is getcontext(), which musl itself does not implement, apparently.
    So, we either have to require libucontext to be installed and link against that somehow. Or look at our usages of them and try to patch them out for musl.

    tl;dr: nix version 0.18.0 should be enough for building this on musl systems, but not for running cargo test on them.

  20. gabrielesvelto commented on Oct 22, 2021

    @gabrielesvelto
    Contributor

    I see, thanks for checking!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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

      0