diff options
author | David Elsing <david.elsing@posteo.net> | 2024-08-04 22:15:54 +0000 |
---|---|---|
committer | Ludovic Courtès <ludo@gnu.org> | 2024-09-06 11:46:25 +0200 |
commit | 595cc594b65ffe4a55c8b8d53a91a841cf056103 (patch) | |
tree | e07864d9d077f9e4c1f86c48b051d225b56cd8c6 /gnu/packages/patches | |
parent | 852c75a125273f4d3c3e540497f3b5e825468362 (diff) |
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>
Diffstat (limited to 'gnu/packages/patches')
-rw-r--r-- | gnu/packages/patches/onnx-shared-libraries.patch | 18 | ||||
-rw-r--r-- | gnu/packages/patches/onnx-skip-model-downloads.patch | 16 | ||||
-rw-r--r-- | gnu/packages/patches/onnx-use-system-googletest.patch | 57 |
3 files changed, 18 insertions, 73 deletions
diff --git a/gnu/packages/patches/onnx-shared-libraries.patch b/gnu/packages/patches/onnx-shared-libraries.patch index 00583b35da..5a3fd658d0 100644 --- a/gnu/packages/patches/onnx-shared-libraries.patch +++ b/gnu/packages/patches/onnx-shared-libraries.patch @@ -1,13 +1,12 @@ -These linker options for the 'onnx_cpp2py_export.cpython-38-*-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'. +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 cede3073..52f846ed 100644 +index b666eec4..1525b219 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt -@@ -475,11 +475,10 @@ if(BUILD_ONNX_PYTHON) +@@ -585,16 +585,15 @@ if(BUILD_ONNX_PYTHON) PRIVATE $<TARGET_OBJECTS:onnx>) else() # Assume everything else is like gcc @@ -15,10 +14,15 @@ index cede3073..52f846ed 100644 - 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") ++ "-Wl,-rpath=${CMAKE_INSTALL_PREFIX}/lib") endif() target_link_libraries(onnx_cpp2py_export PRIVATE onnx) diff --git a/gnu/packages/patches/onnx-skip-model-downloads.patch b/gnu/packages/patches/onnx-skip-model-downloads.patch index 4ab55b4ceb..55925a3ebf 100644 --- a/gnu/packages/patches/onnx-skip-model-downloads.patch +++ b/gnu/packages/patches/onnx-skip-model-downloads.patch @@ -1,16 +1,14 @@ -A few tests require downloading models from URLs such as - <https://s3.amazonaws.com/download.onnx/models/opset_9/zfnet512.tar.gz>. -Skip those. +A few tests require downloading models. Skip those. diff --git a/onnx/backend/test/runner/__init__.py b/onnx/backend/test/runner/__init__.py -index 049ed57b..f236f1bf 100644 +index 5b60e7c0..838c7ba5 100644 --- a/onnx/backend/test/runner/__init__.py +++ b/onnx/backend/test/runner/__init__.py -@@ -202,6 +202,7 @@ class Runner(object): - print('Start downloading model {} from {}'.format( - model_test.model_name, - model_test.url)) +@@ -236,6 +236,7 @@ class Runner: + print( + f"Start downloading model {model_test.model_name} from {model_test.url}" + ) + raise unittest.SkipTest('Skipping download') urlretrieve(model_test.url, download_file.name) - print('Done') + print("Done") with tarfile.open(download_file.name) as t: diff --git a/gnu/packages/patches/onnx-use-system-googletest.patch b/gnu/packages/patches/onnx-use-system-googletest.patch deleted file mode 100644 index 5dfcbc6dc3..0000000000 --- a/gnu/packages/patches/onnx-use-system-googletest.patch +++ /dev/null @@ -1,57 +0,0 @@ -ONNX will build googletest from a Git checkout. Patch CMake to use our -googletest package and enable tests by default. - -diff --git a/CMakeLists.txt b/CMakeLists.txt -index 0aa9fda2..a573170c 100644 ---- a/CMakeLists.txt -+++ b/CMakeLists.txt -@@ -22,7 +22,7 @@ option(BUILD_ONNX_PYTHON "Build Python binaries" OFF) - option(ONNX_GEN_PB_TYPE_STUBS "Generate protobuf python type stubs" ON) - option(ONNX_WERROR "Build with Werror" OFF) - option(ONNX_COVERAGE "Build with coverage instrumentation" OFF) --option(ONNX_BUILD_TESTS "Build ONNX C++ APIs Tests" OFF) -+option(ONNX_BUILD_TESTS "Build ONNX C++ APIs Tests" ON) - option(ONNX_USE_LITE_PROTO "Use lite protobuf instead of full." OFF) - option(ONNXIFI_ENABLE_EXT "Enable onnxifi extensions." OFF) - if(NOT DEFINED ONNX_ML) -@@ -82,8 +82,10 @@ if(CMAKE_SYSTEM_NAME STREQUAL "AIX") - endif() - - if(ONNX_BUILD_TESTS) -- list(APPEND CMAKE_MODULE_PATH ${ONNX_ROOT}/cmake/external) -- include(googletest) -+ find_package(GTest REQUIRED) -+ if(NOT GTest_FOUND) -+ message(FATAL_ERROR "cannot find googletest") -+ endif() - endif() - - if((ONNX_USE_LITE_PROTO AND TARGET protobuf::libprotobuf-lite) OR ((NOT ONNX_USE_LITE_PROTO) AND TARGET protobuf::libprotobuf)) -diff --git a/cmake/unittest.cmake b/cmake/unittest.cmake -index e29a93ff..ae146390 100644 ---- a/cmake/unittest.cmake -+++ b/cmake/unittest.cmake -@@ -6,8 +6,8 @@ include(${ONNX_ROOT}/cmake/Utils.cmake) - - find_package(Threads) - --set(${UT_NAME}_libs ${googletest_STATIC_LIBRARIES}) --set(${ONNXIFI_TEST_DRIVER}_libs ${googletest_STATIC_LIBRARIES}) -+set(${UT_NAME}_libs ${GTEST_LIBRARIES}) -+set(${ONNXIFI_TEST_DRIVER}_libs ${GTEST_LIBRARIES}) - - list(APPEND ${UT_NAME}_libs onnx) - list(APPEND ${UT_NAME}_libs onnx_proto) -@@ -31,10 +31,10 @@ function(AddTest) - list(REMOVE_DUPLICATES _UT_SOURCES) - - add_executable(${_UT_TARGET} ${_UT_SOURCES}) -- add_dependencies(${_UT_TARGET} onnx onnx_proto googletest) -+ add_dependencies(${_UT_TARGET} onnx onnx_proto) - - target_include_directories(${_UT_TARGET} -- PUBLIC ${googletest_INCLUDE_DIRS} -+ PUBLIC ${GTEST_INCLUDE_DIRS} - ${ONNX_INCLUDE_DIRS} - ${PROTOBUF_INCLUDE_DIRS} - ${ONNX_ROOT} |