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:
   ![high](https://www.gstatic.com/codereviewagent/high-priority.svg)
   
   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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to