-
Notifications
You must be signed in to change notification settings - Fork 411
cross 0.2.4 failed to compile libz-ng-sys v1.1.8 on armv7-unknown-linux-gnueabihf #1066
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
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 There's something wrong with the libraries you are using, not with the toolchain itself. |
Let me know if this fails to compile with NEON intrinsics available, in which case, there might be a bug in the toolchain. But right now, this error definitely does not seem to be an issue in cross, especially considering our toolchain is direct from Ubuntu's repositories. |
Running export RUSTFLAGS="-C link-arg=-lgcc -Clink-arg=-static-libgcc -C target-feature=+neon"
cross +nightly 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 still failed with the neon error. |
Interesting. I still doubt this is a toolchain error since using the C++ toolchain itself works as expected: $ docker run -it --rm ghcr.io/cross-rs/armv7-unknown-linux-gnueabihf:0.2.4 bash
$ echo '#include <iostream>
int main() {
std::cout << "Hello World" << std::endl;
}' >> main.cc
$ arm-linux-gnueabihf-g++ main.cc -march=armv7-a -mfpu=neon-vfpv4
$ readelf -A a.out
Attribute Section: aeabi
File Attributes
Tag_CPU_name: "7-A"
Tag_CPU_arch: v7
Tag_CPU_arch_profile: Application
Tag_ARM_ISA_use: Yes
Tag_THUMB_ISA_use: Thumb-2
Tag_FP_arch: VFPv4
Tag_Advanced_SIMD_arch: NEONv1 with Fused-MAC
Tag_ABI_PCS_wchar_t: 4
Tag_ABI_FP_rounding: Needed
Tag_ABI_FP_denormal: Needed
Tag_ABI_FP_exceptions: Needed
Tag_ABI_FP_number_model: IEEE 754
Tag_ABI_align_needed: 8-byte
Tag_ABI_align_preserved: 8-byte, except leaf SP
Tag_ABI_enum_size: int
Tag_ABI_VFP_args: VFP registers
Tag_CPU_unaligned_access: v6
$ arm-linux-gnueabihf-g++ main.cc -march=armv7-a -mfpu=neon
$ readelf -A a.out
Attribute Section: aeabi
File Attributes
Tag_CPU_name: "7-A"
Tag_CPU_arch: v7
Tag_CPU_arch_profile: Application
Tag_ARM_ISA_use: Yes
Tag_THUMB_ISA_use: Thumb-2
Tag_FP_arch: VFPv3
Tag_Advanced_SIMD_arch: NEONv1
Tag_ABI_PCS_wchar_t: 4
Tag_ABI_FP_rounding: Needed
Tag_ABI_FP_denormal: Needed
Tag_ABI_FP_exceptions: Needed
Tag_ABI_FP_number_model: IEEE 754
Tag_ABI_align_needed: 8-byte
Tag_ABI_align_preserved: 8-byte, except leaf SP
Tag_ABI_enum_size: int
Tag_ABI_VFP_args: VFP registers
Tag_CPU_unaligned_access: v6 IE, it supports NEONv1, VFPv3, and VFPv4, as expected. Also, just testing it with a Rust package, this also works as expected (ensuring that these are the features enabled by default, not optional ones): $ cross build --target armv7-unknown-linux-gnueabihf -v
$ readelf -A target/armv7-unknown-linux-gnueabihf/debug/hello2
Attribute Section: aeabi
File Attributes
Tag_CPU_name: "7-A"
Tag_CPU_arch: v7
Tag_CPU_arch_profile: Application
Tag_ARM_ISA_use: Yes
Tag_THUMB_ISA_use: Thumb-2
Tag_FP_arch: VFPv3-D16
Tag_ABI_PCS_GOT_use: GOT-indirect
Tag_ABI_PCS_wchar_t: 4
Tag_ABI_FP_rounding: Needed
Tag_ABI_FP_denormal: Needed
Tag_ABI_FP_exceptions: Needed
Tag_ABI_FP_number_model: IEEE 754
Tag_ABI_align_needed: 8-byte
Tag_ABI_enum_size: int
Tag_ABI_VFP_args: VFP registers
Tag_CPU_unaligned_access: v6
Tag_ABI_FP_16bit_format: IEEE 754
$ RUSTFLAGS="-C target-feature=+neon" cross build --target armv7-unknown-linux-gnueabihf -v
$ readelf -A target/armv7-unknown-linux-gnueabihf/debug/hello2
Attribute Section: aeabi
File Attributes
Tag_CPU_name: "7-A"
Tag_CPU_arch: v7
Tag_CPU_arch_profile: Application
Tag_ARM_ISA_use: Yes
Tag_THUMB_ISA_use: Thumb-2
Tag_FP_arch: VFPv3
Tag_Advanced_SIMD_arch: NEONv1
Tag_ABI_PCS_GOT_use: GOT-indirect
Tag_ABI_PCS_wchar_t: 4
Tag_ABI_FP_rounding: Needed
Tag_ABI_FP_denormal: Needed
Tag_ABI_FP_exceptions: Needed
Tag_ABI_FP_number_model: IEEE 754
Tag_ABI_align_needed: 8-byte
Tag_ABI_enum_size: int
Tag_ABI_VFP_args: VFP registers
Tag_CPU_unaligned_access: v6
Tag_ABI_FP_16bit_format: IEEE 754
$ cross build --target thumbv7neon-unknown-linux-gnueabihf -vv
$ readelf -A target/thumbv7neon-unknown-linux-gnueabihf/debug/hello2
Attribute Section: aeabi
File Attributes
Tag_CPU_name: "7-A"
Tag_CPU_arch: v7
Tag_CPU_arch_profile: Application
Tag_ARM_ISA_use: Yes
Tag_THUMB_ISA_use: Thumb-2
Tag_FP_arch: VFPv4
Tag_Advanced_SIMD_arch: NEONv1 with Fused-MAC
Tag_ABI_PCS_GOT_use: GOT-indirect
Tag_ABI_PCS_wchar_t: 4
Tag_ABI_FP_rounding: Needed
Tag_ABI_FP_denormal: Needed
Tag_ABI_FP_exceptions: Needed
Tag_ABI_FP_number_model: IEEE 754
Tag_ABI_align_needed: 8-byte
Tag_ABI_enum_size: int
Tag_ABI_VFP_args: VFP registers
Tag_CPU_unaligned_access: v6
Tag_ABI_FP_16bit_format: IEEE 754 So basically, everything works as expected here. NEON intrinsics are not enabled by default for |
That makes me even more confused on what caused the issue here. |
Same result as #1067, using the latest main fixes this issue. $ cross --version
cross 0.2.4 (0fcfc0b 2022-09-29)
$ cargo +nightly --version
cargo 1.66.0-nightly (0b84a35c2 2022-10-03)
cross +nightly 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 It seems like the move to GCC 9.4.0 and glibc 2.31 (from GCC 5.4.0 and 2.23) fixes the issue. |
to fix this @NobodyXu , you can specify what image to build with, since we've fixed the direct backwards incompability with 0.2.4 and current main regarding env vars in #1047, you could specify [package.metadata.cross.target.armv7-unknown-linux-gnueabihf]
image = "ghcr.io/cross-rs/armv7-unknown-linux-gnueabihf@sha256:45f953c4f4945a670cc0b7f2993f1581adbc60c900028ccfebdc421eef40f84a" this comment also applies to #1067 instead of installing cross from main, use a pinned image with 0.2.4 |
Thanks, but I would probably just wait for cross v0.3.0 since it is going to be ready soon. |
Uh oh!
There was an error while loading. Please reload this page.
Checklist
Describe your issue
Running cmd
on cargo-binstall v0.15.0 failed with error:
From CI failure.
and
This might be related to #733 and #985
I've tried setting
export RUSTFLAGS="-C link-arg=-lgcc -Clink-arg=-static-libgcc"
according to https://github.com/cross-rs/cross/wiki/FAQ#undefined-reference-with-build-std but still doesn't work.Compiling libz-ng-sys worked before #1046
What target(s) are you cross-compiling for?
armv7-unknown-linux-gnueabihf
Which operating system is the host (e.g computer cross is on) running?
What architecture is the host?
What container engine is cross using?
cross version
cross 0.2.4
Example
No response
Additional information / notes
No response
The text was updated successfully, but these errors were encountered: