Files
Julien Cristau 96ec88b22c Bug 2070120 - Build gn against the sysroot. r=firefox-build-system-reviewers,sylvestre,sergesanspaille
gn was built with the docker image's gcc, so the shipped binary's glibc
floor followed the image: moving to Debian 13 took it from GLIBC_2.18 to
GLIBC_2.38. That broke source-test-vendor-verify-gfx, which runs gn to
re-vendor gfx/angle on the static-analysis-build image; bug 2065412
worked around it by moving that image to Debian 13, but the binary is
also a local-toolchain handed to developers on arbitrary distributions.

The symbols pulling in GLIBC_2.38 are the __isoc23_str* redirects glibc
applies to strtol and friends for __cplusplus >= 202302L, and gn is
built as C++23. Building against older headers removes the redirect
rather than papering over it.

gn needs linux64-toolchain-sysroot-gcc10 rather than
linux64-toolchain-sysroot: it uses <concepts> and <ranges>, which the
libstdc++ 8 in the latter does not have. cctools-port and node-22
already use the gcc10 sysroot for the same reason.

build/gen.py bakes CXX, CFLAGS+CXXFLAGS and LDFLAGS into build.ninja at
generation time and has no cxx-vs-cc distinction, so the environment
variables have to be set before it runs. The mac and win64 gn builds set
their own and are unaffected; build-gn-common.sh is untouched.

Differential Revision: https://phabricator.services.mozilla.com/D324248
2026-09-10 20:14:45 +00:00

19 lines
503 B
Bash
Executable File

#!/bin/bash
set -e -v
# This script is for building GN on Linux.
WORKSPACE=$HOME/workspace
# Build against the sysroot rather than the docker image's libraries, so that
# the resulting binary keeps working on older distros.
sysroot=$MOZ_FETCHES_DIR/sysroot
export CC=$MOZ_FETCHES_DIR/clang/bin/clang
export CXX=$MOZ_FETCHES_DIR/clang/bin/clang++
export CXXFLAGS="--sysroot=$sysroot"
export LDFLAGS="--sysroot=$sysroot -fuse-ld=lld -lrt"
cd $GECKO_PATH
. taskcluster/scripts/misc/build-gn-common.sh