Skip to content

Installation fails on Windows due to signal-hook-registry breakage #1959

@EliahKagan

Description

@EliahKagan

Current behavior 😯

signal-hook-registry 1.4.4 was recently released, and it fails to build on Windows, due to vorner/signal-hook#173. The bug is in signal-hook-registry and not in gitoxide, but it causes gitoxide to fail to install from source on Windows unless --locked or --frozen is passed. Installation from precompiled binaries, such as with cargo binstall gitoxide, are unaffected.

This issue tracks that build failure and may help users who encounter this problem and search for how to work around it.

Also, should we pin signal-hook-registry to version 1.4.3 in Cargo.lock? The changelog lists only one item for version 1.4.4, "Get rid of a warning." So it would probably be okay to use 1.4.3.

Expected behavior 🤔

gitoxide should be installable on Windows with cargo install gitoxide.

Git behavior

Not applicable, since git is written in C and not Rust, and accordingly does not use signal-hook-registry for signal handling.

More precisely, some code carried by the git project is written in Rust, but:

  • Such code is in contrib/libgit-sys and contrib/libgit-rs. This code is not used when building the git executable.
  • The Cargo.lock files in those two directories also do not list signal-hook-registry nor any other signal-hook related crates.

Steps to reproduce 🕹

That the failure is due to vorner/signal-hook#173 can be verified by comparing the error message to the output of this experiment on the same Windows system:

C:\Users\ek\source\repos> cargo new try-signal-hook
    Creating binary (application) `try-signal-hook` package
note: see more `Cargo.toml` keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
C:\Users\ek\source\repos> cd .\try-signal-hook\
C:\Users\ek\source\repos\try-signal-hook [main +3 ~0 -0 !]> cargo add signal-hook-registry
    Updating crates.io index
      Adding signal-hook-registry v1.4.4 to dependencies
    Updating crates.io index
     Locking 2 packages to latest Rust 1.86.0 compatible versions
C:\Users\ek\source\repos\try-signal-hook [main +4 ~0 -0 !]> cargo build
   Compiling libc v0.2.172
   Compiling signal-hook-registry v1.4.4
error[E0433]: failed to resolve: use of unresolved module or unlinked crate `ptr`
   --> C:\Users\ek\.cargo\registry\src\index.crates.io-1949cf8c6b5b557f\signal-hook-registry-1.4.4\src\lib.rs:300:60
    |
300 | static GLOBAL_DATA: AtomicPtr<GlobalData> = AtomicPtr::new(ptr::null_mut());
    |                                                            ^^^ use of unresolved module or unlinked crate `ptr`
    |
    = help: if you wanted to use a crate named `ptr`, use `cargo add ptr` to add it to your `Cargo.toml`
help: a builtin type with a similar name exists
    |
300 - static GLOBAL_DATA: AtomicPtr<GlobalData> = AtomicPtr::new(ptr::null_mut());
300 + static GLOBAL_DATA: AtomicPtr<GlobalData> = AtomicPtr::new(str::null_mut());
    |
help: consider importing this module
    |
69  + use std::ptr;
    |

For more information about this error, try `rustc --explain E0433`.
error: could not compile `signal-hook-registry` (lib) due to 1 previous error

Metadata

Metadata

Assignees

No one assigned

    Labels

    acknowledgedan issue is accepted as shortcoming to be fixedhelp wantedExtra attention is needed

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions