aboutsummaryrefslogtreecommitdiff
path: root/misc/onnx/files/patch-CMakeLists.txt
diff options
context:
space:
mode:
Diffstat (limited to 'misc/onnx/files/patch-CMakeLists.txt')
-rw-r--r--misc/onnx/files/patch-CMakeLists.txt28
1 files changed, 28 insertions, 0 deletions
diff --git a/misc/onnx/files/patch-CMakeLists.txt b/misc/onnx/files/patch-CMakeLists.txt
new file mode 100644
index 000000000000..f1e4a2c51f35
--- /dev/null
+++ b/misc/onnx/files/patch-CMakeLists.txt
@@ -0,0 +1,28 @@
+-- remove visibility settings to fix run-time of PyTorch with ONNX
+-- 'import torch' fails otherwise with undefined symbols from ONNX
+-- https://github.com/pytorch/pytorch/issues/167525
+
+--- CMakeLists.txt.orig 2025-11-11 00:00:00 UTC
++++ CMakeLists.txt
+@@ -419,8 +419,8 @@ foreach(_proto_src ${ONNX_PROTO_SRCS})
+ endforeach()
+
+ # Hide all symbols we don't need
+-set_target_properties(onnx_proto PROPERTIES CXX_VISIBILITY_PRESET hidden)
+-set_target_properties(onnx_proto PROPERTIES VISIBILITY_INLINES_HIDDEN 1)
++#set_target_properties(onnx_proto PROPERTIES CXX_VISIBILITY_PRESET hidden)
++#set_target_properties(onnx_proto PROPERTIES VISIBILITY_INLINES_HIDDEN 1)
+
+ set(LINKED_PROTOBUF_TARGET protobuf::libprotobuf)
+ if(ONNX_USE_LITE_PROTO)
+@@ -459,8 +459,8 @@ if(CMAKE_SYSTEM_NAME STREQUAL "AIX")
+ else()
+ add_library(onnx ${ONNX_SRCS})
+ endif()
+-set_target_properties(onnx PROPERTIES CXX_VISIBILITY_PRESET hidden)
+-set_target_properties(onnx PROPERTIES VISIBILITY_INLINES_HIDDEN ON)
++#set_target_properties(onnx PROPERTIES CXX_VISIBILITY_PRESET hidden)
++#set_target_properties(onnx PROPERTIES VISIBILITY_INLINES_HIDDEN ON)
+
+ target_link_libraries(onnx PUBLIC onnx_proto)
+ add_onnx_global_defines(onnx)