xar was built with the docker image's headers and libraries even though its task already fetched clang and a sysroot. Moving to Debian 13 took the shipped binary from GLIBC_2.34 to GLIBC_2.38 and added a libzstd.so.1 dependency, by way of deb13's openssl pulling zstd into pkg-config --static --libs libcrypto. It is a local-toolchain, so mach bootstrap hands it to developers on arbitrary distributions. xar's configure can only locate libxml2 through xml2-config, which sysroots do not ship because they contain no /usr/bin. Left alone it combines the host's libxml2 headers with the sysroot's library, so pass a small shim backed by pkg-config. The sysroot's openssl is 1.0.1t, which does not pull in zstd, so libzstd-dev is no longer needed in the image; bug 2010574 only added it for xar. Dropping it also stops gcc autodetecting zstd, which was silently adding a libzstd.so.1 dependency to the gcc toolchains. The explicit -DLLVM_ENABLE_ZSTD=OFF and --without-zstd stay: they pin autodetection that would otherwise vary with the image's contents. Other consequences worth knowing: - the statically linked libcrypto becomes the sysroot's openssl 1.0.1t. xar only uses the EVP digest functions, no TLS or certificate code. - that libcrypto.a is not built PIC, so the binary can no longer be a PIE. - the sysroot has lzma.h where the image did not, so xar gains lzma support and a liblzma.so.5 dependency. Measured locally: GLIBC_2.38 -> GLIBC_2.14, configure resolves libxml 2.9.1 with no host/sysroot split, and create/extract roundtrips pass for sha1, sha256 and md5 with gzip, bzip2 and no compression. Differential Revision: https://phabricator.services.mozilla.com/D324249
54 lines
1.8 KiB
Bash
Executable File
54 lines
1.8 KiB
Bash
Executable File
#!/bin/bash
|
|
set -x -e -v
|
|
|
|
# This script is for building xar for Linux.
|
|
mkdir -p $UPLOAD_DIR
|
|
|
|
export PATH=$PATH:$MOZ_FETCHES_DIR/clang/bin
|
|
|
|
sysroot=$MOZ_FETCHES_DIR/sysroot
|
|
export CC="$MOZ_FETCHES_DIR/clang/bin/clang --sysroot=$sysroot"
|
|
# The sysroot's libcrypto.a is not compiled as PIC, so the xar binary that
|
|
# links it statically can't be a PIE.
|
|
export LDFLAGS="-fuse-ld=lld -no-pie"
|
|
|
|
# Point pkg-config exclusively at the sysroot
|
|
export PKG_CONFIG_ALLOW_CROSS=1
|
|
export PKG_CONFIG_SYSROOT_DIR=$sysroot
|
|
export PKG_CONFIG_LIBDIR="$sysroot/usr/lib/x86_64-linux-gnu/pkgconfig:$sysroot/usr/lib/pkgconfig:$sysroot/usr/share/pkgconfig"
|
|
|
|
# xar's configure can only find libxml2 through xml2-config, which sysroots
|
|
# don't ship because they contain no /usr/bin. Without this it would silently
|
|
# combine the host's libxml2 headers with the sysroot's library.
|
|
xml2_config=$(mktemp -d)/xml2-config
|
|
cat > $xml2_config <<'EOF'
|
|
#!/bin/sh
|
|
case "$1" in
|
|
--version) exec pkg-config --modversion libxml-2.0 ;;
|
|
--cflags) exec pkg-config --cflags libxml-2.0 ;;
|
|
--libs) exec pkg-config --libs libxml-2.0 ;;
|
|
esac
|
|
exit 1
|
|
EOF
|
|
chmod +x $xml2_config
|
|
|
|
cd $MOZ_FETCHES_DIR/xar/xar
|
|
|
|
./autogen.sh --prefix=/builds/worker --enable-static --with-xml2-config=$xml2_config
|
|
|
|
# Force statically-linking to libcrypto. pkg-config --static will tell
|
|
# us the extra flags that are needed (in practice, -ldl -pthread),
|
|
# and -lcrypto, which we need to change to actually link statically.
|
|
# The substitution contains sysroot paths, so it can't use / as separator.
|
|
CRYPTO=$(pkg-config --static --libs libcrypto | sed 's/-lcrypto/-l:libcrypto.a/')
|
|
sed -i "s|-lcrypto|$CRYPTO|" src/Makefile.inc
|
|
|
|
make_flags="-j$(nproc)"
|
|
make $make_flags
|
|
|
|
cd $(mktemp -d)
|
|
mkdir xar
|
|
|
|
cp $MOZ_FETCHES_DIR/xar/xar/src/xar ./xar/xar
|
|
tar caf $UPLOAD_DIR/xar.tar.zst ./xar
|