Files
dockcross/common/common-manylinux_2_34.crosstool
Julian Oes ad3c0cad8c manylinux_2_34: fix libstdc++ ABI mismatch by isolating host headers
Using -I/usr/include during the crosstool-ng build of libstdc++ pulled
in host x86_64 headers where int64_t is long long, contaminating the
aarch64 cross-build where int64_t should be long. This caused linker
errors for std::__atomic_futex_unsigned_base symbols due to mismatched
C++ name mangling between headers and the built library.

Copy only the required sys/sdt.h headers into /opt/ct-ng-includes and
point CT_CC_GCC_ENABLE_CXX_FLAGS there instead, matching the approach
used by manylinux_2_28-aarch64.
2026-04-09 03:22:00 +12:00

77 lines
2.8 KiB
Plaintext

# crosstool.common-manylinux_2_34
#
# Common Docker instructions to install "crosstool-ng" and build a full
# cross-compiler suite from a crosstool-ng configuration, CROSSTOOL_CONFIG.
#
# This import complements the "dockcross/base" image, adding:
# - "ct-ng", a cross-compiler building utilty.
# - A cross-compiler suite configured in "crosstool-ng.config".
#
# The generated cross-compiler will have a CROSS_ROOT of:
# ${XCC_PREFIX}/${CROSS_TRIPLE}
#
# A given platform will need to supply the appropriate "crosstool-ng.config" to
# generate its cross-compiler. This can be built using "ct-ng menuconfig" to
# generate a configuration.
ENV MANYLINUX_DEPS="glibc-devel glibc-devel.i686 libstdc++-devel glib2-devel libX11-devel libXext-devel libXrender-devel mesa-libGL-devel libICE-devel libSM-devel"
ENV PYTHON_COMPILE_DEPS="python-devel zlib-devel bzip2-devel expat-devel ncurses-devel readline-devel tk-devel gdbm-devel libdb-devel libpcap-devel xz-devel openssl-devel keyutils-libs-devel krb5-devel libcom_err-devel libidn-devel curl-devel perl-devel"
ENV TOOLCHAIN_DEPS="gcc-toolset-14-binutils gcc-toolset-14-gcc gcc-toolset-14-gcc-c++ gcc-toolset-14-gcc-gfortran"
# Install dependent packages required for `ct-ng`.
RUN \
dnf -y update && \
dnf -y install \
gawk \
gperf \
help2man \
texinfo \
flex \
ncurses-devel \
glibc-static \
rsync \
systemtap-devel \
systemtap-sdt-devel \
${TOOLCHAIN_DEPS} \
${PYTHON_COMPILE_DEPS} \
${MANYLINUX_DEPS} && \
dnf clean all
ENV XCC_PREFIX=/usr/xcc
# Add the crosstool-ng script and image-specific toolchain configuration into
# /dockcross/.
#
# Afterwards, we will leave the "ct-ng" config in the image as a reference
# for users.
COPY \
imagefiles/install-crosstool-ng-toolchain.sh \
imagefiles/patch/crosstool-ng/crosstool-ng-zlib-target.patch \
manylinux_2_34-aarch64/crosstool-ng.config \
/dockcross/
# Copy sys/sdt.h to a clean include directory to avoid pulling in all of
# /usr/include (which causes __float128 conflicts on AlmaLinux 9 when
# cross-compiling for aarch64).
RUN mkdir -p /opt/ct-ng-includes/sys && \
cp /usr/include/sys/sdt.h /opt/ct-ng-includes/sys/ && \
cp /usr/include/sys/sdt-config.h /opt/ct-ng-includes/sys/
# Build and install the toolchain, cleaning up artifacts afterwards.
RUN \
mkdir /dockcross/crosstool && \
cd /dockcross/crosstool && \
/dockcross/install-crosstool-ng-toolchain.sh \
-p "${XCC_PREFIX}" \
-c /dockcross/crosstool-ng.config \
-v "${CT_VERSION}" && \
rm -rf /dockcross/crosstool /dockcross/install-crosstool-ng-toolchain.sh && \
# Remove sudo provided by gcc-toolset since it doesn't work with
# our sudo wrapper calling gosu.
rm -f /opt/rh/gcc-toolset-14/root/usr/bin/sudo
# Restore our default workdir (from "dockcross/base").
WORKDIR /work