You are viewing a plain text version of this content. The canonical link for it is here.
Posted to discuss-archive@tvm.apache.org by "MasterJH5574 (via GitHub)" <gi...@apache.org> on 2026/06/17 01:26:06 UTC
[PR] [CI] Static-link libstdc++ for Linux wheel builds [tvm]
MasterJH5574 opened a new pull request, #19804:
URL: https://github.com/apache/tvm/pull/19804
The Linux manylinux_2_28 wheels fail their cibuildwheel test step with "undefined symbol: ...basic_string..._M_replace_cold@GLIBCXX_3.4.30" when importing tvm. The C++20 baseline requires a newer gcc-toolset (GCC 14 in the current manylinux image), whose libstdc++ emits symbols newer than the manylinux runtime baseline. Because auditwheel does not bundle libstdc++, the wheel ends up with a runtime dependency on a libstdc++ that the test/host environment does not provide.
Add LDFLAGS="-static-libstdc++ -static-libgcc" to the Linux wheel build environment so the C++ runtime is linked statically into libtvm.so / libtvm_runtime.so, removing the dynamic libstdc++ dependency. macOS (libc++) and Windows (MSVC STL) are unaffected.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: discuss-archive-unsubscribe@tvm.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: discuss-archive-unsubscribe@tvm.apache.org
For additional commands, e-mail: discuss-archive-help@tvm.apache.org
Re: [PR] [CI] Static-link libstdc++ for Linux wheel builds [tvm]
Posted by "gemini-code-assist[bot] (via GitHub)" <gi...@apache.org>.
gemini-code-assist[bot] commented on code in PR #19804:
URL: https://github.com/apache/tvm/pull/19804#discussion_r3425017717
##########
.github/actions/build-wheel-for-publish/action.yml:
##########
@@ -130,9 +130,13 @@ runs:
CIBW_ENVIRONMENT_MACOS: >-
CMAKE_PREFIX_PATH="/opt/llvm"
CMAKE_ARGS="-DUSE_LLVM='/opt/llvm/bin/llvm-config --link-static' -DZLIB_USE_STATIC_LIBS=ON -DCMAKE_PREFIX_PATH=/opt/llvm ${{ inputs.cmake_defines }}"
+ # Statically link libstdc++/libgcc on Linux: the C++20 gcc-toolset (>=12) emits
+ # libstdc++ symbols newer than the manylinux_2_28 runtime baseline (e.g.
+ # _M_replace_cold @ GLIBCXX_3.4.30), so the wheel would otherwise fail to load.
CIBW_ENVIRONMENT_LINUX: >-
CMAKE_PREFIX_PATH="/opt/llvm"
LIBRARY_PATH="/opt/llvm/lib"
+ LDFLAGS="-static-libstdc++ -static-libgcc"
Review Comment:

While adding LDFLAGS="-static-libstdc++ -static-libgcc" here statically links the C++ runtime for libtvm.so and libtvm_runtime.so built during the main wheel build, the CUDA runtime sidecar libtvm_runtime_cuda.so (specified in TVM_PACKAGE_EXTRA_LIBS) is built separately via ci/scripts/package/manylinux_build_libtvm_runtime_cuda.sh. If libtvm_runtime_cuda.so is built in a container with a newer GCC/toolset, it will still dynamically link against the newer libstdc++ and fail to load on older host environments with the same undefined symbol error. To address this, also statically link libstdc++ and libgcc when building libtvm_runtime_cuda.so by passing -DCMAKE_SHARED_LINKER_FLAGS="-static-libstdc++ -static-libgcc" to the cmake command in ci/scripts/package/manylinux_build_libtvm_runtime_cuda.sh.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: discuss-archive-unsubscribe@tvm.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: discuss-archive-unsubscribe@tvm.apache.org
For additional commands, e-mail: discuss-archive-help@tvm.apache.org
Re: [PR] [CI] Static-link libstdc++ for Linux wheel builds [tvm]
Posted by "MasterJH5574 (via GitHub)" <gi...@apache.org>.
MasterJH5574 commented on PR #19804:
URL: https://github.com/apache/tvm/pull/19804#issuecomment-4725091034
Decided to revert the c++20 baseline switch for now. Closing this PR.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: discuss-archive-unsubscribe@tvm.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: discuss-archive-unsubscribe@tvm.apache.org
For additional commands, e-mail: discuss-archive-help@tvm.apache.org
Re: [PR] [CI] Static-link libstdc++ for Linux wheel builds [tvm]
Posted by "MasterJH5574 (via GitHub)" <gi...@apache.org>.
MasterJH5574 closed pull request #19804: [CI] Static-link libstdc++ for Linux wheel builds
URL: https://github.com/apache/tvm/pull/19804
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: discuss-archive-unsubscribe@tvm.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: discuss-archive-unsubscribe@tvm.apache.org
For additional commands, e-mail: discuss-archive-help@tvm.apache.org