gemini-code-assist[bot] commented on code in PR #19617:
URL: https://github.com/apache/tvm/pull/19617#discussion_r3307109848
##########
apps/cpp_rpc/CMakeLists.txt:
##########
@@ -62,9 +62,9 @@ if (BUILD_FOR_ANDROID AND USE_HEXAGON)
endif()
if(BUILD_STATIC_RUNTIME)
- list(APPEND TVM_RPC_LINKER_LIBS -Wl,--whole-archive tvm_runtime
tvm_ffi_static -Wl,--no-whole-archive)
+ list(APPEND TVM_RPC_LINKER_LIBS -Wl,--whole-archive tvm_runtime
${TVM_RUNTIME_BACKEND_LIBS} tvm_ffi_static -Wl,--no-whole-archive)
else()
- list(APPEND TVM_RPC_LINKER_LIBS tvm_runtime)
+ list(APPEND TVM_RPC_LINKER_LIBS tvm_runtime -Wl,--no-as-needed
${TVM_RUNTIME_BACKEND_LIBS} -Wl,--as-needed)
endif()
Review Comment:

The linker flags `-Wl,--no-as-needed` and `-Wl,--as-needed` are specific to
GNU ld and compatible linkers. They are not supported by the MSVC linker on
Windows or the ld64 linker on macOS/iOS, which will cause build failures on
those platforms when `USE_CPP_RPC` is enabled.
We should conditionally apply these flags only on platforms that support
them (i.e., non-MSVC and non-Apple platforms).
```
else()
if(NOT MSVC AND NOT APPLE)
list(APPEND TVM_RPC_LINKER_LIBS tvm_runtime -Wl,--no-as-needed
${TVM_RUNTIME_BACKEND_LIBS} -Wl,--as-needed)
else()
list(APPEND TVM_RPC_LINKER_LIBS tvm_runtime ${TVM_RUNTIME_BACKEND_LIBS})
endif()
endif()
```
--
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]