Build broken for i386 architectures
What is the current bug behavior?
Build for i386 architecture fail with the following message:
Running `CARGO=/usr/local/bin/cargo CARGO_CRATE_NAME=regex CARGO_MANIFEST_DIR=/wrkdirs/usr/ports/www/hurl/work/hurl-7.0.0/cargo-crates/regex-1.11.2 CARGO_MANIFEST_PATH=/
wrkdirs/usr/ports/www/hurl/work/hurl-7.0.0/cargo-crates/regex-1.11.2/Cargo.toml CARGO_PKG_AUTHORS='The Rust Project Developers:Andrew Gallant <[email protected]>' CARGO_PKG_D
ESCRIPTION='An implementation of regular expressions for Rust. This implementation uses
finite automata and guarantees linear time matching on all inputs.
' CARGO_PKG_HOMEPAGE='https://github.com/rust-lang/regex' CARGO_PKG_LICENSE='MIT OR Apache-2.0' CARGO_PKG_LICENSE_FILE='' CARGO_PKG_NAME=regex CARGO_PKG_README=README.md CARG
O_PKG_REPOSITORY='https://github.com/rust-lang/regex' CARGO_PKG_RUST_VERSION=1.65 CARGO_PKG_VERSION=1.11.2 CARGO_PKG_VERSION_MAJOR=1 CARGO_PKG_VERSION_MINOR=11 CARGO_PKG_VERS
ION_PATCH=2 CARGO_PKG_VERSION_PRE='' LD_LIBRARY_PATH=/wrkdirs/usr/ports/www/hurl/work/target/release/deps /usr/local/bin/rustc --crate-name regex --edition=2021 /wrkdirs/usr/
ports/www/hurl/work/hurl-7.0.0/cargo-crates/regex-1.11.2/src/lib.rs --error-format=json --json=diagnostic-rendered-ansi,artifacts,future-incompat --crate-type lib --emit=dep-
info,metadata,link -C opt-level=3 -C panic=abort -C linker-plugin-lto -C codegen-units=1 --cfg 'feature="default"' --cfg 'feature="perf"' --cfg 'feature="perf-backtrack"' --c
fg 'feature="perf-cache"' --cfg 'feature="perf-dfa"' --cfg 'feature="perf-inline"' --cfg 'feature="perf-literal"' --cfg 'feature="perf-onepass"' --cfg 'feature="std"' --cfg '
feature="unicode"' --cfg 'feature="unicode-age"' --cfg 'feature="unicode-bool"' --cfg 'feature="unicode-case"' --cfg 'feature="unicode-gencat"' --cfg 'feature="unicode-perl"'
--cfg 'feature="unicode-script"' --cfg 'feature="unicode-segment"' --check-cfg 'cfg(docsrs,test)' --check-cfg 'cfg(feature, values("default", "logging", "pattern", "perf", "
perf-backtrack", "perf-cache", "perf-dfa", "perf-dfa-full", "perf-inline", "perf-literal", "perf-onepass", "std", "unicode", "unicode-age", "unicode-bool", "unicode-case", "u
nicode-gencat", "unicode-perl", "unicode-script", "unicode-segment", "unstable", "use_std"))' -C metadata=2b37982fa6ff4157 -C extra-filename=-289f1f881373c578 --out-dir /wrkd
irs/usr/ports/www/hurl/work/target/release/deps -C strip=symbols -L dependency=/wrkdirs/usr/ports/www/hurl/work/target/release/deps --extern aho_corasick=/wrkdirs/usr/ports/w
ww/hurl/work/target/release/deps/libaho_corasick-7c9f573abe504af4.rmeta --extern memchr=/wrkdirs/usr/ports/www/hurl/work/target/release/deps/libmemchr-7873b88471f2b3f0.rmeta
--extern regex_automata=/wrkdirs/usr/ports/www/hurl/work/target/release/deps/libregex_automata-f34203b9a2957235.rmeta --extern regex_syntax=/wrkdirs/usr/ports/www/hurl/work/t
arget/release/deps/libregex_syntax-a5874ef35ee43d1a.rmeta --cap-lints warn -C ar=ar -C linker=/usr/local/llvm19/bin/clang`
error[E0080]: attempt to compute `16_usize - 20_usize`, which would overflow
--> /wrkdirs/usr/ports/www/hurl/work/target/release/build/libxml-808547634d8bc94c/out/bindings.rs:417:29
|
417 | ["Size of __max_align_t"][::std::mem::size_of::<__max_align_t>() - 20usize];
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ evaluation of `bindings::_` failed here
For more information about this error, try `rustc --explain E0080`.
warning: `libxml` (lib) generated 1 warning (1 duplicate)
error: could not compile `libxml` (lib) due to 1 previous error; 1 warning emitted
No issue reported for other architectures (arm64, aarch64, armv6, armv7, powerpc)
Steps to reproduce
The issue occurs for all versions of FreeBSD (14.3, 15) on i386 architecture.
Execution context
FreeBSD 1403i386-head 14.3-RELEASE-p2 FreeBSD 14.3-RELEASE-p2 i386
- Hurl Version (
hurl --version): 7.0.0
The build environment includes
- brotli-1.1.0,1
- ccache-3.7.12_8
- curl-8.15.0
- gettext-runtime-0.23.1
- indexinfo-0.3.1_1
- libedit-3.1.20250104,1
- libffi-3.5.1
- libidn2-2.3.8
- liblz4-1.10.0,1
- libnghttp2-1.67.0
- libpsl-0.21.5_2
- libssh2-1.11.1,3
- libunistring-1.3
- libxml2-2.14.5
- llvm19-19.1.7_1
- lua53-5.3.6_1
- mpdecimal-4.0.1
- perl5-5.42.0_1
- pkg-2.3.1
- pkgconf-2.4.3,1
- python311-3.11.13_1
- readline-8.2.13_2
- rust-1.89.0
- zstd-1.5.7
Possible fixes
I try to move rust-libxml2 from 0.3.6 to 0.3.7, but without success
Hi @rosorio, We are not too familiar with FreeBSD, could you share the steps to get Rust 1.89 so we can reproduce and debug using the same setup as you ?
For now, @fabricereix, @jcamiel, here are the steps to reproduce the issue on an emulated FreeBSD 14.3-i386 with Rust-1.87 from an Ubuntu-22.04-amd64 host:
cd /tmp
apt update
apt install -y qemu-system-x86 qemu-utils
wget https://download.freebsd.org/ftp/releases/ISO-IMAGES/14.3/FreeBSD-14.3-RELEASE-i386-disc1.iso
qemu-img create -f qcow2 freebsd143_i386.qcow2 10G
qemu-system-i386 -m 1G -enable-kvm -cdrom FreeBSD-14.3-RELEASE-i386-disc1.iso -boot d -hda freebsd143_i386.qcow2
pkg update
pkg install -y git vim rust llvm16 cmake gmake gcc pkgconf openssl curl libxml2
git clone --depth 1 https://github.com/orange-opensource/hurl
cd hurl
sed -i '' 's/rust-version = "1.89.0"/rust-version = "1.87.0"/g' packages/*/Cargo.toml
cargo build --release
Hi @rosorio the issue is libxml Rust crates uses now bindgen to build a Rust binding to libxml.
If you clone this crate and build it on FreeBSD/i386, you'll end up with the same error:
$ git clone https://github.com/KWARC/rust-libxml.git
$ cd rust-libxml
$ cargo build
Updating crates.io index
Locking 82 packages to latest Rust 1.87.0 compatible versions
...
error[E0080]: evaluation of constant value failed
--> /home/jc/rust-libxml/target/debug/build/libxml-0db722a43088e767/out/bindings.rs:407:29
|
407 | ["Size of __max_align_t"][::std::mem::size_of::<__max_align_t>() - 20usize];
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ attempt to compute `16_usize - 20_usize`, which would overflow
For more information about this error, try `rustc --explain E0080`.
error: could not compile `libxml` (lib) due to 1 previous error
This is due to layout tests that bindgen generates to check the binding (check if the generated binding is correct regarding the build environment).
What could be done is:
- see with the libxml Rust crates why the project doesn't build under FreeBSD/i386
- use a patch version of libxml Rust crates that deactivate the layout test:
https://github.com/KWARC/rust-libxml/blob/ecfa38c75f7b975034567a67abcee3d54b9476b3/build.rs#L73
to
.opaque_type("max_align_t")
// invalidate build as soon as the wrapper changes
.parse_callbacks(Box::new(bindgen::CargoCallbacks::new()))
.layout_tests(false)
Usually these tests are useful and if everything is correct they should not fail. Failure indicates something is misunderstood by bindgen.
- finally, you can fill an issue to libxml Rust crates to add a way for consumer project to disable the bindgen layout tests
I've tested to disable the layout tests and succefully build Hurl:
$ hurl --version
hurl 7.1.0-SNAPSHOT (i386-portbld-freebsd14.2) libcurl/8.14.1 OpenSSL/3.0.16 zlib/1.3.1 brotli/brotli/1.1.0 zstd/zstd/1.5.7 libidn2/2.3.8 libssh2/1.11.1 nghttp2/1.66.0
Features (libcurl): alt-svc AsynchDNS brotli HSTS HTTP2 IDN IPv6 Largefile libz NTLM SPNEGO SSL TLS-SRP UnixSockets zstd
Features (built-in): brotli
And with this file:
GET https://hurl.dev
HTTP 200
[Asserts]
xpath "normalize-space(//title)" == "Hurl - Run and Test HTTP Requests"
hurl --test /tmp/test.hurl
Success /tmp/test.hurl (1 request(s) in 315 ms)
--------------------------------------------------------------------------------
Executed files: 1
Executed requests: 1 (3.0/s)
Succeeded files: 1 (100.0%)
Failed files: 0 (0.0%)
Duration: 333 ms