diff options
-rw-r--r-- | .SRCINFO | 17 | ||||
-rw-r--r-- | PKGBUILD | 34 | ||||
-rw-r--r-- | build-fixes.patch | 160 |
3 files changed, 126 insertions, 85 deletions
@@ -1,7 +1,7 @@ pkgbase = python-onnxruntime pkgdesc = Cross-platform, high performance scoring engine for ML models - pkgver = 1.1.2 - pkgrel = 3 + pkgver = 1.2.0 + pkgrel = 2 url = https://github.com/microsoft/onnxruntime arch = x86_64 license = MIT @@ -15,25 +15,24 @@ pkgbase = python-onnxruntime makedepends = python-setuptools makedepends = cub makedepends = nlohmann-json + makedepends = chrono-date depends = protobuf depends = re2 depends = python-numpy - source = git+https://github.com/microsoft/onnxruntime#tag=v1.1.2 - source = git+https://github.com/HowardHinnant/date.git - source = eigen::git+https://github.com/eigenteam/eigen-git-mirror.git + source = git+https://github.com/microsoft/onnxruntime#tag=v1.2.0 + source = git+https://gitlab.com/libeigen/eigen.git source = git+https://github.com/google/gemmlowp.git source = git+https://github.com/google/nsync.git source = git+https://github.com/onnx/onnx.git + source = git+https://github.com/dcleblanc/SafeInt.git source = build-fixes.patch - source = nlohmann-json.diff sha512sums = SKIP sha512sums = SKIP sha512sums = SKIP sha512sums = SKIP sha512sums = SKIP sha512sums = SKIP - sha512sums = da8e27ff0011fb207ee8a6f8675160eb85cb8711f01050fa7454234242af141951cb5bba52fa50b98cf8567b8faa973565dfef37f4daa2219a42cf26e03c86b5 - sha512sums = 1c70cf6ae50e1aba97e4eec3da40b076c4cf1e6a48a92d189045fe700d71bfbcbef937183f917e6c37f4271ce39fef68d9d01e9630f3f928a0bb35df248f63a4 + sha512sums = 4457e19e3e91195ea2976a70e31a70d07b1b5e2279f1493a537c7d128aef5695e317cfdb84a87a0ca8d2d53ba15d72edf0f95905ecff7fbfb250e3a97944313c pkgname = python-onnxruntime @@ -43,6 +42,6 @@ pkgname = python-onnxruntime-cuda depends = python-numpy depends = cuda depends = cudnn - provides = python-onnxruntime=1.1.2 + provides = python-onnxruntime=1.2.0 conflicts = python-onnxruntime @@ -2,45 +2,43 @@ pkgbase=python-onnxruntime pkgname=(python-onnxruntime python-onnxruntime-cuda) -pkgver=1.1.2 +pkgver=1.2.0 pkgdesc='Cross-platform, high performance scoring engine for ML models' -pkgrel=3 +pkgrel=2 arch=(x86_64) url='https://github.com/microsoft/onnxruntime' license=(MIT) depends=(protobuf re2 python-numpy) -makedepends=(git cmake cuda cudnn gtest gmock pybind11 python-setuptools cub nlohmann-json) +makedepends=(git cmake cuda cudnn gtest gmock pybind11 python-setuptools cub nlohmann-json chrono-date) # not de-vendored libraries # eigen: API changes a lot since extra/eigen 3.3.7 to the commit onnxruntime uses -# onnx: onnxruntime requires headers, which are not installed in python-onnx +# onnx: onnxruntime uses different protobuf files than upstream onnx +# https://github.com/microsoft/onnxruntime/blob/v1.1.2/onnxruntime/core/protobuf/onnx-ml.proto#L250-L251 source=("git+https://github.com/microsoft/onnxruntime#tag=v$pkgver" - "git+https://github.com/HowardHinnant/date.git" - "eigen::git+https://github.com/eigenteam/eigen-git-mirror.git" + "git+https://gitlab.com/libeigen/eigen.git" "git+https://github.com/google/gemmlowp.git" "git+https://github.com/google/nsync.git" "git+https://github.com/onnx/onnx.git" - build-fixes.patch - nlohmann-json.diff) + "git+https://github.com/dcleblanc/SafeInt.git" + build-fixes.patch) sha512sums=('SKIP' 'SKIP' 'SKIP' 'SKIP' 'SKIP' 'SKIP' - 'da8e27ff0011fb207ee8a6f8675160eb85cb8711f01050fa7454234242af141951cb5bba52fa50b98cf8567b8faa973565dfef37f4daa2219a42cf26e03c86b5' - '1c70cf6ae50e1aba97e4eec3da40b076c4cf1e6a48a92d189045fe700d71bfbcbef937183f917e6c37f4271ce39fef68d9d01e9630f3f928a0bb35df248f63a4') + '4457e19e3e91195ea2976a70e31a70d07b1b5e2279f1493a537c7d128aef5695e317cfdb84a87a0ca8d2d53ba15d72edf0f95905ecff7fbfb250e3a97944313c') prepare() { cd onnxruntime # More protobuf debundling; inspired by https://github.com/microsoft/onnxruntime/pull/1928 - rm -v onnxruntime/core/util/protobuf_parsing_utils.{h,cc} + rm -v onnxruntime/core/util/protobuf_parsing_utils.h echo "#include <google/protobuf/io/zero_copy_stream_impl.h>" >> onnxruntime/core/util/protobuf_parsing_utils.h patch -Np1 -i ../build-fixes.patch - patch -Np1 -i ../nlohmann-json.diff git submodule init - for mod in date eigen gemmlowp nsync onnx ; do + for mod in eigen gemmlowp nsync onnx SafeInt; do git config submodule.cmake/external/$mod.url "$srcdir"/$mod git submodule update cmake/external/$mod done @@ -49,12 +47,13 @@ prepare() { } _build() { - # Uses the same compiler as CUDA, or there will be linker errors due to - # attempts on linking object files with libstdc++ from older GCC - CC=/opt/cuda/bin/gcc CXX=/opt/cuda/bin/g++ \ + # Use protobuf-lite instead of full protobuf to workaround symbol conflicts + # with onnx; see https://github.com/onnx/onnx/issues/1277 for details. cmake ../cmake \ -Donnxruntime_ENABLE_PYTHON=ON \ -DONNX_CUSTOM_PROTOC_EXECUTABLE=/usr/bin/protoc \ + -Donnxruntime_PREFER_SYSTEM_LIB=ON \ + -Donnxruntime_USE_FULL_PROTOBUF=OFF \ $@ make python ../setup.py build @@ -65,6 +64,9 @@ build() { _build cd "$srcdir"/onnxruntime/build-cuda + # Uses the same compiler as CUDA, or there will be linker errors due to + # attempts on linking object files with libstdc++ from older GCC + CC=/opt/cuda/bin/gcc CXX=/opt/cuda/bin/g++ \ _build -Donnxruntime_USE_CUDA=ON -Donnxruntime_CUDNN_HOME=/usr } diff --git a/build-fixes.patch b/build-fixes.patch index 2ab78eb750a2..f228eb8aec6e 100644 --- a/build-fixes.patch +++ b/build-fixes.patch @@ -1,70 +1,58 @@ diff --git a/cmake/CMakeLists.txt b/cmake/CMakeLists.txt -index 96c89fef..0e37e487 100644 +index 3cee60f3..3328fc06 100644 --- a/cmake/CMakeLists.txt +++ b/cmake/CMakeLists.txt -@@ -229,18 +229,10 @@ list(APPEND CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/external) - #2. if ONNX_CUSTOM_PROTOC_EXECUTABLE is not set, Compile everything(including protoc) from source code. - - --# use protobuf as a submodule --add_subdirectory(${PROJECT_SOURCE_DIR}/external/protobuf/cmake EXCLUDE_FROM_ALL) --set_target_properties(libprotobuf PROPERTIES FOLDER "External/Protobuf") --set_target_properties(libprotobuf-lite PROPERTIES FOLDER "External/Protobuf") --set_target_properties(libprotoc PROPERTIES FOLDER "External/Protobuf") --set_target_properties(protoc PROPERTIES FOLDER "External/Protobuf") --if (onnxruntime_USE_FULL_PROTOBUF) -- add_library(protobuf::libprotobuf ALIAS libprotobuf) --else() -- add_library(protobuf::libprotobuf ALIAS libprotobuf-lite) --endif() --add_executable(protobuf::protoc ALIAS protoc) -+find_package(PkgConfig) -+pkg_check_modules(PROTOBUF REQUIRED IMPORTED_TARGET GLOBAL protobuf) -+add_library(libprotobuf ALIAS PkgConfig::PROTOBUF) -+add_library(protobuf::libprotobuf ALIAS PkgConfig::PROTOBUF) - include(protobuf_function.cmake) +@@ -314,7 +314,7 @@ list(APPEND CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/external) + + if(onnxruntime_PREFER_SYSTEM_LIB) + set(protobuf_MODULE_COMPATIBLE ON) +- find_package(protobuf) ++ find_package(Protobuf) + endif() -@@ -282,8 +274,6 @@ set(ONNXRUNTIME_INCLUDE_DIR ${REPO_ROOT}/include/onnxruntime) +@@ -327,7 +327,7 @@ if(Protobuf_FOUND OR Protobuf_FOUND) + if(NOT Protobuf_USE_STATIC_LIBS) + #Indeed here should be a warning, not a fatal error. ONNX Runtime itself can work in such a + #setting but it may cause compatibility issue when ONNX Runtime is integrated with the other ONNX ecosystem softwares. +- message(FATAL_ERROR "Please enable Protobuf_USE_STATIC_LIBS") ++ message(WARNING "Please enable Protobuf_USE_STATIC_LIBS") + endif() + else() + set(PROTOBUF_LIB protobuf::libprotobuf-lite) +@@ -395,7 +395,7 @@ get_filename_component(REPO_ROOT "${REPO_ROOT}" ABSOLUTE) set(ONNXRUNTIME_INCLUDE_DIR ${REPO_ROOT}/include/onnxruntime) - add_subdirectory(external/date EXCLUDE_FROM_ALL) --add_subdirectory(external/re2 EXCLUDE_FROM_ALL) --set_target_properties(re2 PROPERTIES FOLDER "External/re2") - - # bounds checking behavior. - # throw instead of calling terminate if there's a bounds checking violation. -@@ -306,7 +296,7 @@ function(onnxruntime_add_include_to_target dst_target) - endforeach() - endfunction() - --set(onnxruntime_EXTERNAL_DEPENDENCIES onnx_proto re2) -+set(onnxruntime_EXTERNAL_DEPENDENCIES onnx_proto) - - # TVM - if (onnxruntime_USE_TVM) -@@ -620,15 +605,10 @@ if (onnxruntime_BUILD_UNIT_TESTS) - # turned ON by the previous step when building a shared lib - set(CMAKE_SKIP_BUILD_RPATH OFF) - # gtest and gmock -- add_subdirectory(${PROJECT_SOURCE_DIR}/external/googletest EXCLUDE_FROM_ALL) -- set_target_properties(gmock PROPERTIES FOLDER "External/GTest") -- set_target_properties(gmock_main PROPERTIES FOLDER "External/GTest") -- set_target_properties(gtest PROPERTIES FOLDER "External/GTest") -- set_target_properties(gtest_main PROPERTIES FOLDER "External/GTest") -- if(UNIX) -- target_compile_options(gmock PRIVATE "-w") -- target_compile_options(gtest PRIVATE "-w") -- endif() -+ pkg_check_modules(GTEST REQUIRED IMPORTED_TARGET GLOBAL gtest) -+ pkg_check_modules(GMOCK REQUIRED IMPORTED_TARGET GLOBAL gmock) -+ add_library(gtest ALIAS PkgConfig::GTEST) -+ add_library(gmock ALIAS PkgConfig::GMOCK) - include(onnxruntime_unittests.cmake) + +-add_subdirectory(external/date EXCLUDE_FROM_ALL) ++find_package(date REQUIRED) + + if(onnxruntime_PREFER_SYSTEM_LIB) + find_package(re2) +diff --git a/cmake/external/Findre2.cmake b/cmake/external/Findre2.cmake +new file mode 100644 +index 00000000..4c91696c +--- /dev/null ++++ b/cmake/external/Findre2.cmake +@@ -0,0 +1,3 @@ ++find_package(PkgConfig) ++pkg_check_modules(re2 REQUIRED IMPORTED_TARGET GLOBAL re2) ++add_library(re2::re2 ALIAS PkgConfig::re2) +diff --git a/cmake/onnxruntime_common.cmake b/cmake/onnxruntime_common.cmake +index d33e9e14..5770e818 100644 +--- a/cmake/onnxruntime_common.cmake ++++ b/cmake/onnxruntime_common.cmake +@@ -86,7 +86,7 @@ if (onnxruntime_USE_MIMALLOC_STL_ALLOCATOR OR onnxruntime_USE_MIMALLOC_ARENA_ALL + endif() endif() +-onnxruntime_add_include_to_target(onnxruntime_common date_interface safeint_interface) ++onnxruntime_add_include_to_target(onnxruntime_common date::date safeint_interface) + target_include_directories(onnxruntime_common PRIVATE ${CMAKE_CURRENT_BINARY_DIR} ${ONNXRUNTIME_ROOT} + PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}/external/nsync/public") + diff --git a/cmake/onnxruntime_python.cmake b/cmake/onnxruntime_python.cmake -index ace16b1b..c76ebde4 100644 +index 7dce1309..7102975b 100644 --- a/cmake/onnxruntime_python.cmake +++ b/cmake/onnxruntime_python.cmake @@ -1,7 +1,6 @@ @@ -75,11 +63,63 @@ index ace16b1b..c76ebde4 100644 FIND_PACKAGE(NumPy) if(NOT PYTHON_INCLUDE_DIR) -@@ -83,7 +82,6 @@ set(onnxruntime_pybind11_state_libs +@@ -99,7 +98,6 @@ endif() set(onnxruntime_pybind11_state_dependencies ${onnxruntime_EXTERNAL_DEPENDENCIES} -- pybind11 +- ${pybind11_dep} ) - + set_property(TARGET onnxruntime_pybind11_state APPEND_STRING PROPERTY LINK_FLAGS ${ONNXRUNTIME_SO_LINK_FLAG} ${onnxruntime_DELAYLOAD_FLAGS}) add_dependencies(onnxruntime_pybind11_state ${onnxruntime_pybind11_state_dependencies}) +diff --git a/cmake/onnxruntime_unittests.cmake b/cmake/onnxruntime_unittests.cmake +index d1bd347c..0c4b81e4 100644 +--- a/cmake/onnxruntime_unittests.cmake ++++ b/cmake/onnxruntime_unittests.cmake +@@ -40,7 +40,7 @@ function(AddTest) + else() + target_link_libraries(${_UT_TARGET} PRIVATE ${_UT_LIBS} GTest::gtest GTest::gmock ${onnxruntime_EXTERNAL_LIBRARIES}) + endif() +- onnxruntime_add_include_to_target(${_UT_TARGET} date_interface safeint_interface) ++ onnxruntime_add_include_to_target(${_UT_TARGET} date::date safeint_interface) + target_include_directories(${_UT_TARGET} PRIVATE ${TEST_INC_DIR}) + if (onnxruntime_USE_CUDA) + target_include_directories(${_UT_TARGET} PRIVATE ${CUDA_INCLUDE_DIRS} ${onnxruntime_CUDNN_HOME}/include) +diff --git a/onnxruntime/core/session/inference_session_utils.h b/onnxruntime/core/session/inference_session_utils.h +index 57159083..9fa7dce0 100644 +--- a/onnxruntime/core/session/inference_session_utils.h ++++ b/onnxruntime/core/session/inference_session_utils.h +@@ -6,7 +6,7 @@ + #include "core/session/inference_session.h" + #include "core/framework/session_options.h" + #include "core/common/common.h" +-#include "single_include/nlohmann/json.hpp" ++#include <nlohmann/json.hpp> + + using json = nlohmann::json; + +diff --git a/onnxruntime/test/providers/cpu/ml/linearregressor_test.cc b/onnxruntime/test/providers/cpu/ml/linearregressor_test.cc +index c6eb3f5f..2b6dff61 100644 +--- a/onnxruntime/test/providers/cpu/ml/linearregressor_test.cc ++++ b/onnxruntime/test/providers/cpu/ml/linearregressor_test.cc +@@ -73,7 +73,7 @@ TEST_P(LinearRegressorTest, LinearRegressorUniTarget) { + } + + // For PROBIT, all the output values are NaN. +-INSTANTIATE_TEST_SUITE_P( ++INSTANTIATE_TEST_CASE_P( + LinearRegressorTest, LinearRegressorTest, + testing::Values(LinearRegressorParam("NONE", {32.0f, 14.0f, -166.0f}, 1), + LinearRegressorParam("SOFTMAX", {32.0f, 14.0f, -166.0f}, 1), +diff --git a/onnxruntime/test/shared_lib/test_inference.cc b/onnxruntime/test/shared_lib/test_inference.cc +index 4b5b6731..08726f8b 100644 +--- a/onnxruntime/test/shared_lib/test_inference.cc ++++ b/onnxruntime/test/shared_lib/test_inference.cc +@@ -184,7 +184,7 @@ TEST(CApiTest, dim_param) { + ASSERT_EQ(strcmp(dim_param, ""), 0); + } + +-INSTANTIATE_TEST_SUITE_P(CApiTestWithProviders, ++INSTANTIATE_TEST_CASE_P(CApiTestWithProviders, + CApiTestWithProvider, + ::testing::Values(0, 1, 2, 3, 4)); + |