--- title: Pin the byte order for old configure scripts; do not let gcc 14 guess "big" area: build impact: CRITICAL tags: [build, configure, autoconf, endianness, gcc14, AC_C_BIGENDIAN, porting] verified: 2026-11-04 --- # Pin the byte order for old configure scripts; do not let gcc 14 guess "big" Old endianness probes (`AC_C_BIGENDIAN` in autoconf 2.59, gnupg's `GNUPG_CHECK_ENDIAN`) read little-endian x86_64 and aarch64 illumos as big-endian under gcc 14. The build still succeeds and the program gives wrong answers: tcl printed wrong doubles, and gnupg computed wrong uid hashes. Pass the answer as a cache variable, then test a result that depends on byte order. **Antipattern** ```sh ./configure --prefix="$out" # tcl or gnupg, unpinned, on x86_64-solaris or aarch64-solaris # gnupg's log: "checking endianness... big"; tcl's result: WORDS_BIGENDIAN=1 in tclConfig.sh. Both wrong: # the probe's test program failed to build ./configure --disable-endian-check # gnupg: the build then stops at #error "No endianness found" # the only build check is a round trip (encrypt, then decrypt) that cannot see the bug # why: the probe looks for BYTE_ORDER in ; the illumos gate defines it only in . # The fallback run test calls exit() without ; gcc 14 rejects the implicit declaration, # and the probe reads the failed link as "big endian". ``` **The Solnix way** ```sh # in the package recipe's configure step: choose the order from the target, never from a probe case "$system" in x86_64-solaris|aarch64-solaris) order=little bigendian=no EN=LITTLE ;; # the gnupg fix's mapping sparcv9-solaris) order=big bigendian=yes EN=BIG ;; *) echo "FATAL: no byte order known for $system" >&2; exit 1 ;; esac (cd unix && ./configure --prefix="$out" ac_cv_c_bigendian=$bigendian) # tcl: configure is in unix/; AC_C_BIGENDIAN ./configure --prefix="$out" gnupg_cv_c_endian=$order # GNUPG_CHECK_ENDIAN (gnupg) # gnupg's configure now prints: checking endianness... (cached) little gmake && ./g10/t-rmd160 # gnupg: its RIPEMD-160 vectors fail on a wrong order grep -q "define ${EN}_ENDIAN_HOST 1" config.h # gnupg: fail the build if this is missing echo 'puts [expr {0.1}]' | "$out/bin/tclsh8.6" # tcl: must print 0.1; the bad build aborts "wrong digit!" ``` The fixed gnupg recipe also checks a known uid hash. Prove each check can fail: a build forced to `big` must stop. Solnix main has no central pin yet; wave6 pins it in `config.site`. **The illumos way** (OpenIndiana, OmniOS, SmartOS) ```c /* ask (or _LITTLE_ENDIAN / _BIG_ENDIAN from ), not */ #include #if BYTE_ORDER == BIG_ENDIAN /* big-endian path */ #endif uint32_t le = htole32(host); /* endian(3C); htonl() in byteorder(3C) gives network order */ ``` Same gate headers. The gate builds with GCC 10 (GCC 14 only as a shadow); up to gcc 13 an implicit declaration is only a warning, so under gcc 10 the fallback run test still builds. **The difference.** The header layout is not Solnix-specific. The compiler matters: the gate itself builds with GCC 10 (14 is its shadow compiler), and Solnix builds packages with GCC 14, so an old configure script whose probe has this form can hit the trap (tcl and gnupg did). A host on gcc 10 does not hit it until it moves to gcc 14. On Solnix, pin the answer in the recipe and test it. **Check.** `echo 'puts [expr {0.1}]' | tclsh` prints `0.1`. For gnupg, `config.h` defines `LITTLE_ENDIAN_HOST 1` and `g10/t-rmd160` passes. A wrong build prints `expr {2.5}` as `5.56e-309`. **Unverified** - Which gcc OpenIndiana, OmniOS and SmartOS build their packages with. The sources name only the gate's compilers. **Sources** - [handoff: from-builder-20261104T154849-libdb-tcl-rows](https://codeberg.org/solnix/solnix-infra/src/commit/c2ecf4535e0fc32261bbfb2414bc7961a73fa6ca/docs/handoff/from-builder-20261104T154849-libdb-tcl-rows/README.md), What we ask item 2 (WORDS_BIGENDIAN=1, "wrong digit!", 5.56e-309, the mechanism); Tests (tcl's new check) - [handoff: from-builder-20261104T173111-gnupg-uid-hash-rows](https://codeberg.org/solnix/solnix-infra/src/commit/c2ecf4535e0fc32261bbfb2414bc7961a73fa6ca/docs/handoff/from-builder-20261104T173111-gnupg-uid-hash-rows/README.md), The bug (GNUPG_CHECK_ENDIAN, `checking endianness... big`); The fix (gnupg_cv_c_endian from `$system`, no `--disable-endian-check`, config.h, t-rmd160, uid hash, sabotage builds, config.site on wave6) - [docs/progress.md](https://codeberg.org/solnix/solnix/src/commit/5a8e5ce75a33086d7be4410149847bdf7501b8fc/docs/progress.md) (solnix 5a8e5ce), aa-xbuild23 (tcl-8.6.14 built with `ac_cv_c_bigendian=no`, bin/tclsh8.6) - [Porting to GCC 14](https://gcc.gnu.org/gcc-14/porting_to.html), Certain warnings are now errors (GCC 13 and earlier: warnings); Implicit function declarations; Impact on Autoconf and build environment probing in general - [Autoconf 2.72: C Compiler Characteristics](https://www.gnu.org/software/autoconf/manual/autoconf-2.72/html_node/C-Compiler.html), AC_C_BIGENDIAN (header check first, then a test-case; WORDS_BIGENDIAN) - [endian.h(3HEAD)](https://solnix.io/docs/man/endian.h.3head) (illumos, CDDL), DESCRIPTION: BYTE_ORDER, LITTLE_ENDIAN, BIG_ENDIAN - [byteorder(7)](https://solnix.io/docs/man/byteorder.7) (illumos, CDDL), Determining the System's Byte Order (`` _LITTLE_ENDIAN, _BIG_ENDIAN) - [endian(3C)](https://solnix.io/docs/man/endian.3c) (illumos, CDDL), SYNOPSIS (htole32 and friends, ``) - [byteorder(3C)](https://solnix.io/docs/man/byteorder.3c) (illumos, CDDL), NAME (htonl, ntohl) - [Handbook: How Solnix is built](https://solnix.io/docs/handbook/how-solnix-is-built#the-two-toolchains) (site 307b67f), The illumos gate (OmniOS, OpenIndiana, SmartOS take the gate); The two toolchains (GCC 14 primary) - [illumos: Building illumos](https://illumos.org/docs/developers/build/), Installing required packages (GCC 10 primary, GCC 14.2.0 shadow)