rust-lang / rust-lang/libz-sys

Failed to compile libz-ng-sys v1.1.8 on armv7-unknown-linux-gnueabihf

Open
#108 10 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Rust
Stars
138
Forks
88
PR merge metrics
No merged PRs in 30d

Description

Running cmd

cross build --target armv7-unknown-linux-gnueabihf --profile release --no-default-features --features zlib-ng,static,rustls,trust-dns,fancy-no-backtrace,log_release_max_level_debug -Z build-std=std,panic_abort -Z build-std-features=panic_immediate_abort

on cargo-binstall v0.15.0 failed with error:

  /usr/lib/gcc-cross/arm-linux-gnueabihf/5/include/arm_neon.h:31:2: error: #error You must enable NEON instructions (e.g. -mfloat-abi=softfp -mfpu=neon) to use arm_neon.h
   #error You must enable NEON instructions (e.g. -mfloat-abi=softfp -mfpu=neon) to use arm_neon.h

From CI failure.

and

  In file included from /cargo/registry/src/index.crates.io-e139d0d48fed7772/libz-ng-sys-1.1.8/src/zlib-ng/compare256.c:7:0:
  /cargo/registry/src/index.crates.io-e139d0d48fed7772/libz-ng-sys-1.1.8/src/zlib-ng/fallback_builtins.h:102:15: error: unknown type name 'uint16x8x4_t'
   static inline uint16x8x4_t vld1q_u16_x4(uint16_t *a) {

According to this comment from @Alexhuszagh:

This isn't a cross bug: it's an issue with the library you're trying to use: ARMv7HF defaults to using VFPv3, not NEON, and refuses to compile NEON intrinsics unless you basically force it to. You'd have to add -C target-feature=+neon to RUSTFLAGS, and even then I doubt it would work. If you want an ARMv7 hard-float target that supports NEON by default, use thumbv7neon-unknown-linux-gnueabihf. FYI: your library is also asking you to use -mfloat-abi=softfp which is definitely wrong here: it would have to be -mfloat-abi=hard.

There's something wrong with the libraries you are using, not with the toolchain itself.

libz-ng should not use NEON intrinsics on armv7hf.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Reproduce the reported cross build for armv7-unknown-linux-gnueabihf and inspect libz-ng-sys 1.1.8, especially zlib-ng/compare256.c and fallback_builtins.h. Check how NEON intrinsics are selected for ARMv7HF and verify that the build completes without using NEON instructions on that target.

Written by the indexing model from the issue text.

Assessment

Tech stack
c, rust
Domain
build-system
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.