rust-lang / libz-sys

Rust crate package to link to a system libz (zlib)
Apache License 2.0
110 stars 73 forks source link

libz-ng: illegal instruction on `x86_64-unkown-linux-{musl, gnu}` #148

Open NobodyXu opened 11 months ago

NobodyXu commented 11 months ago

cargo-binstall, which uses gix v0.50.1 and depends on libz-ng get killed by illegal instructions on this CI and also this one:

+ ./cargo-binstall binstall --force --git file:///tmp/tmp.iyk2axDWcq --no-confirm cargo-binstall
 INFO resolve: Resolving package: 'cargo-binstall'
 INFO Cloning::receiving pack: Enumerating objects → 3.0 objects
git.sh: line 39: 24033 Illegal instruction     (core dumped) "./$1" binstall --force --git "file://$GIT" --no-confirm cargo-binstall

I disabled the flate2/zlib-ng and it fixed the issue.

Also reported here: https://github.com/Byron/gitoxide/issues/955

NobodyXu commented 11 months ago

The cargo-binstall is built using the following commands:

export CARGO_PROFILE_RELEASE_LTO=no
export CARGO_PROFILE_RELEASE_CODEGEN_UNITS=1024
export RUSTFLAGS='-C link-arg=-static-libgcc -C link-arg=-Wl,--icf=safe'
export CARGO=cargo-zigbuild

git clone https://github.com/cargo-bins/cargo-binstall
cd cargo-binstall
git checkout d5549ce

cargo-auditable auditable build  --release --target x86_64-unknown-linux-musl --features git,static,rustls,trust-dns,fancy-no-backtrace,zstd-thin,log_release_max_level_debug,cross-lang-fat-lto,git-max-perf --timings
NobodyXu commented 11 months ago

The git repository is created using:

GIT="$(mktemp -d 2>/dev/null || mktemp -d -t 'git')"
if [ "$OSTYPE" = "cygwin" ] || [ "$OSTYPE" = "msys" ]; then
    # Convert it to windows path so `--git "file://$GIT"` would work
    # on windows.
    GIT="$(cygpath -w "$GIT")"
fi

git init "$GIT"
cp manifests/github-test-Cargo.toml "$GIT/Cargo.toml"
(
  cd "$GIT"
  git config user.email 'test@example.com'
  git config user.name 'test'
  git add Cargo.toml
  git commit -m "Add Cargo.toml"
)
Byron commented 11 months ago

As there was no response from people more knowledgable than me, I think maybe it's more of an issue by the underlying zlib-ng C library, and would wonder how to best bring it up there or…make it reproducible.

I also wonder if zlib-ng may have something to do with the spurious gitoxide failures that I have been seeing recently - sometimes they say things like "double-free". …But not to digress, I don't know what the best way would be to bring it up there, maybe a discussion would help gain some insights.