rust-cross / cargo-zigbuild

Compile Cargo project with zig as linker
MIT License
1.57k stars 56 forks source link

error: /tmp/rustc1xVHGG/libblake3-716a40260c8329b7.rlib: unrecognized file extension #290

Open i18nsite opened 1 month ago

i18nsite commented 1 month ago

https://github.com/i18n-site/rust/actions/runs/11519713302/job/32069371843#step:9:494

+ RUSTFLAGS='--cfg reqwest_unstable -D warnings -C target-feature=+aes -C target-feature=+neon'
+ cargo zigbuild -p i18 -Z build-std=std,panic_abort --release --target aarch64-unknown-linux-gnu
...
error: linking with `/home/runner/.cache/cargo-zigbuild/0.19.3/zigcc-aarch64-unknown-linux-gnu-aef7.sh` failed: exit status: 1
  |
  = note: LC_ALL="C" PATH="/home/runner/.rustup/toolchains/nightly-2024-09-26-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/bin:/home/runner/.rustup/toolchains/nightly-2024-09-26-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/bin:/home/runner/.rustup/toolchains/nightly-2024-09-26-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/bin:/opt/hostedtoolcache/zig/master/x64:/opt/hostedtoolcache/protoc/v23.4/x64/bin:/snap/bin:/home/runner/.local/bin:/opt/pipx_bin:/home/runner/.cargo/bin:/home/runner/.config/composer/vendor/bin:/usr/local/.ghcup/bin:/home/runner/.dotnet/tools:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin" VSLANG="1033" "/home/runner/.cache/cargo-zigbuild/0.19.3/zigcc-aarch64-unknown-linux-gnu-aef7.sh" "/tmp/rustc1xVHGG/symbols.o" "/home/runner/work/rust/rust/target/aarch64-unknown-linux-gnu/release/deps/i18-a9d13ee857f8352f.i18.c41756c17b41297-cgu.0.rcgu.o" "-W
  = note: warning: ignoring deprecated linker optimization setting '1'
          error: /tmp/rustc1xVHGG/libblake3-716a40260c8329b7.rlib: unrecognized file extension
epompeii commented 1 month ago

I'm also hitting the same error for a different rlib:

error: linking with `/home/runner/.cache/cargo-zigbuild/0.19.3/zigcc-x86_64-unknown-linux-gnu.2.17-c33b.sh` failed: exit status: 1
...
  = note: error: /home/runner/work/bencher/bencher/target/x86_64-unknown-linux-gnu/release-small/deps/libdeunicode-ff1e04ce90e4b134.rlib: unrecognized file extension

error: could not compile `slug` (lib) due to 1 previous error

https://github.com/bencherdev/bencher/actions/runs/11519600050/job/32068983882#step:6:464

i18nsite commented 1 month ago

Yes, it was working fine before, but I don't know why, but it keeps reporting rlib errors since yesterday.

epompeii commented 1 month ago

Yep, same here. I checked the GitHub Actions runner compared to the last successful build: https://github.com/bencherdev/bencher/actions/runs/11471625875/job/31949627680

And it seems like they are the exact same, so I eliminated that as a factor.

i18nsite commented 1 month ago

I find a way to fix this use github action

  - uses: mlugg/setup-zig@v1

to install stable zig not the nightly zig

break on zig-linux-x86_64-0.14.0-dev.1991+33d07f4b6 -> zig-linux-x86_64-0.14.0-dev.2032+c563ba6b1

https://github.com/ziglang/zig/commit/c563ba6b1 https://github.com/ziglang/zig/pull/21700

epompeii commented 4 weeks ago

I find a way to fix this use github action

  - uses: mlugg/setup-zig@v1

Making the switch is now recommended by the maintainer of goto-bus-stop/setup-zig: https://github.com/goto-bus-stop/setup-zig/issues/88