guix/gnu/packages/patches/onnx-shared-libraries.patch
David Elsing 595cc594b6
gnu: onnx: Update to 1.16.2.
* gnu/packages/machine-learning.scm (onnx): Update to 1.16.2.
[source]: Remove patch.
[build-system]: Move to pyproject-build-system.
[arguments]<#:tests?>: Disable for systems where python-nbval is not
supported.
<#:phases>: Remove 'relax-requirements' phase.  Pass "-DONNX_BUILD_TESTS" to
CMake depending on tests?.
[native-inputs]: Add python-fb-re2 and python-parameterized-next.  Remove
python-nbval on unsupported systems.
* gnu/packages/patches/onnx-shared-libraries.patch: Adjust patch.
* gnu/packages/patches/onnx-skip-model-downloads.patch: Adjust patch.
* gnu/packages/patches/onnx-use-system-googletest.patch: Remove file.
* gnu/local.mk (dist_patch_DATA): Remove it.

Co-authored-by: Andy Tai <atai@atai.org>
2024-09-06 11:46:25 +02:00

28 lines
1.4 KiB
Diff

These linker options for the 'onnx_cpp2py_export.cpython-310-*-gnu.so' (or
similar) extension are meant to be used when building 'libonn.a', a static
archive. This patch adapts the link flags to linking with 'libonnx.so'.
diff --git a/CMakeLists.txt b/CMakeLists.txt
index b666eec4..1525b219 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -585,16 +585,15 @@ if(BUILD_ONNX_PYTHON)
PRIVATE $<TARGET_OBJECTS:onnx>)
else()
# Assume everything else is like gcc
- target_link_libraries(onnx_cpp2py_export
- PRIVATE "-Wl,--whole-archive" $<TARGET_FILE:onnx>
- "-Wl,--no-whole-archive")
+ target_link_libraries(onnx_cpp2py_export PRIVATE onnx)
# Prevent "undefined symbol: _ZNSt10filesystem7__cxx114path14_M_split_cmptsEv"
# (std::filesystem::__cxx11::path::_M_split_cmpts()) on gcc 8
if (CMAKE_CXX_STANDARD EQUAL 17 AND CMAKE_COMPILER_IS_GNUCC AND CMAKE_CXX_COMPILER_VERSION VERSION_LESS 9.0)
target_link_libraries(onnx_cpp2py_export PRIVATE "-lstdc++fs")
endif()
set_target_properties(onnx_cpp2py_export
- PROPERTIES LINK_FLAGS "-Wl,--exclude-libs,ALL")
+ PROPERTIES LINK_FLAGS
+ "-Wl,-rpath=${CMAKE_INSTALL_PREFIX}/lib")
endif()
target_link_libraries(onnx_cpp2py_export PRIVATE onnx)