Skip to content

Commit 356fc41

Browse files
etafpytorchmergebot
authored andcommitted
[Intel GPU] Avoid target_link_libraries twice for torch_xpu_ops which will potentially cause multiple definition symbol linker error. (pytorch#139024)
[Intel GPU] Avoid target_link_libraries twice for torch_xpu_ops which will potentially cause multiple definition symbol linker error. Pull Request resolved: pytorch#139024 Approved by: https://github.com/EikanWang, https://github.com/fengyuan14, https://github.com/jansel
1 parent 6ad52db commit 356fc41

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

caffe2/CMakeLists.txt

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1084,12 +1084,12 @@ if(USE_XPU)
10841084
target_link_libraries(torch_xpu PRIVATE torch_xpu_ops)
10851085
if(MSVC)
10861086
# Windows
1087-
target_link_libraries(torch_xpu PRIVATE
1088-
"-WHOLEARCHIVE:\"$<TARGET_FILE:torch_xpu_ops>\"")
1087+
target_link_options(torch_xpu PRIVATE
1088+
"-WHOLEARCHIVE:$<TARGET_FILE:torch_xpu_ops>")
10891089
else()
10901090
# Linux
1091-
target_link_libraries(torch_xpu PRIVATE
1092-
"-Wl,--whole-archive,\"$<TARGET_FILE:torch_xpu_ops>\" -Wl,--no-whole-archive")
1091+
target_link_options(torch_xpu PRIVATE
1092+
"-Wl,--whole-archive,$<TARGET_FILE:torch_xpu_ops>,--no-whole-archive")
10931093
endif()
10941094

10951095
# Set cached ${ATen_XPU_INCLUDE_DIRS} to torch

0 commit comments

Comments
 (0)