Skip to content

Commit 3d71293

Browse files
authored
fix: link libstdc++ with --as-needed on manylinux_2_{28,34} (#1761)
1 parent 734e34f commit 3d71293

File tree

2 files changed

+19
-0
lines changed

2 files changed

+19
-0
lines changed

Diff for: docker/build_scripts/finalize.sh

+5
Original file line numberDiff line numberDiff line change
@@ -103,3 +103,8 @@ LC_ALL=C "${MY_DIR}/update-system-packages.sh"
103103

104104
# wrap compilers (see https://github.com/pypa/manylinux/issues/1725)
105105
"${MY_DIR}/install-gcc-wrapper.sh"
106+
107+
# patch libstdc++.so (see https://github.com/pypa/manylinux/issues/1760)
108+
if [ "${AUDITWHEEL_POLICY}" == "manylinux_2_28" ] || [ "${AUDITWHEEL_POLICY}" == "manylinux_2_34" ]; then
109+
find "${DEVTOOLSET_ROOTPATH}" -name 'libstdc++.so' -exec sed -i 's/INPUT\s*(\s*\([^ ]\+\)\s*\([^ ]\+\)\s*)/INPUT ( \1 \2 \1 )/g' {} \;
110+
fi

Diff for: tests/run_tests.sh

+14
Original file line numberDiff line numberDiff line change
@@ -172,5 +172,19 @@ if [ "${AUDITWHEEL_ARCH}" == "x86_64" ]; then
172172
fi
173173
fi
174174

175+
# https://github.com/pypa/manylinux/issues/1760
176+
g++ -o /tmp/repro -x c++ -D_GLIBCXX_ASSERTIONS -fPIC -Wl,--as-needed - << EOF
177+
#include <array>
178+
#include <cstdio>
179+
180+
int main(int argc, char* argv[])
181+
{
182+
std::array<int, 3> a = {1, 2, 3};
183+
printf("repro %d\n", a[0]);
184+
return 0;
185+
}
186+
EOF
187+
/tmp/repro
188+
175189
# final report
176190
echo "run_tests successful!"

0 commit comments

Comments
 (0)