From 399d7ed87f11a04c252d2c4cf24f0135c8f11034 Mon Sep 17 00:00:00 2001 From: mayeut Date: Sun, 23 Mar 2025 10:12:42 +0100 Subject: [PATCH 1/3] fix: link `libstdc++` with `--as-needed` on `manylinux_2_28` fix #1760 --- docker/build_scripts/finalize.sh | 6 ++++++ tests/run_tests.sh | 14 ++++++++++++++ 2 files changed, 20 insertions(+) diff --git a/docker/build_scripts/finalize.sh b/docker/build_scripts/finalize.sh index be23516e..2aac75a6 100755 --- a/docker/build_scripts/finalize.sh +++ b/docker/build_scripts/finalize.sh @@ -103,3 +103,9 @@ LC_ALL=C "${MY_DIR}/update-system-packages.sh" # wrap compilers (see https://github.com/pypa/manylinux/issues/1725) "${MY_DIR}/install-gcc-wrapper.sh" + +# patch libstdc++.so (see https://github.com/pypa/manylinux/issues/1760) +if [ "${AUDITWHEEL_POLICY}" == "manylinux_2_28" ]; then + LIBSTDCXX=$(find "${DEVTOOLSET_ROOTPATH}" -name 'libstdc++.so') + sed -i 's/INPUT\s*(\s*\([^ ]\+\)\s*\([^ ]\+\)\s*)/INPUT ( \1 \2 \1 )/g' "${LIBSTDCXX}" +fi diff --git a/tests/run_tests.sh b/tests/run_tests.sh index 5af64487..f638822d 100755 --- a/tests/run_tests.sh +++ b/tests/run_tests.sh @@ -172,5 +172,19 @@ if [ "${AUDITWHEEL_ARCH}" == "x86_64" ]; then fi fi +# https://github.com/pypa/manylinux/issues/1760 +g++ -o /tmp/repro -x c++ -D_GLIBCXX_ASSERTIONS -fPIC -Wl,--as-needed - << EOF +#include +#include + +int main(int argc, char* argv[]) +{ + std::array a = {1, 2, 3}; + printf("repro %d\n", a[0]); + return 0; +} +EOF +/tmp/repro + # final report echo "run_tests successful!" From bcd7a18756fb580271b89193357c88b5f0b333d2 Mon Sep 17 00:00:00 2001 From: mayeut Date: Sun, 23 Mar 2025 10:21:23 +0100 Subject: [PATCH 2/3] Update finalize.sh --- docker/build_scripts/finalize.sh | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/docker/build_scripts/finalize.sh b/docker/build_scripts/finalize.sh index 2aac75a6..3f52d6b2 100755 --- a/docker/build_scripts/finalize.sh +++ b/docker/build_scripts/finalize.sh @@ -106,6 +106,5 @@ LC_ALL=C "${MY_DIR}/update-system-packages.sh" # patch libstdc++.so (see https://github.com/pypa/manylinux/issues/1760) if [ "${AUDITWHEEL_POLICY}" == "manylinux_2_28" ]; then - LIBSTDCXX=$(find "${DEVTOOLSET_ROOTPATH}" -name 'libstdc++.so') - sed -i 's/INPUT\s*(\s*\([^ ]\+\)\s*\([^ ]\+\)\s*)/INPUT ( \1 \2 \1 )/g' "${LIBSTDCXX}" + find "${DEVTOOLSET_ROOTPATH}" -name 'libstdc++.so' -exec sed -i 's/INPUT\s*(\s*\([^ ]\+\)\s*\([^ ]\+\)\s*)/INPUT ( \1 \2 \1 )/g' {} \; fi From d6e0e6e17a2ac1db84e74f7e426f6b7e91baa4b3 Mon Sep 17 00:00:00 2001 From: mayeut Date: Sun, 23 Mar 2025 10:26:22 +0100 Subject: [PATCH 3/3] Update finalize.sh --- docker/build_scripts/finalize.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docker/build_scripts/finalize.sh b/docker/build_scripts/finalize.sh index 3f52d6b2..cc4acbdb 100755 --- a/docker/build_scripts/finalize.sh +++ b/docker/build_scripts/finalize.sh @@ -105,6 +105,6 @@ LC_ALL=C "${MY_DIR}/update-system-packages.sh" "${MY_DIR}/install-gcc-wrapper.sh" # patch libstdc++.so (see https://github.com/pypa/manylinux/issues/1760) -if [ "${AUDITWHEEL_POLICY}" == "manylinux_2_28" ]; then +if [ "${AUDITWHEEL_POLICY}" == "manylinux_2_28" ] || [ "${AUDITWHEEL_POLICY}" == "manylinux_2_34" ]; then find "${DEVTOOLSET_ROOTPATH}" -name 'libstdc++.so' -exec sed -i 's/INPUT\s*(\s*\([^ ]\+\)\s*\([^ ]\+\)\s*)/INPUT ( \1 \2 \1 )/g' {} \; fi