From 15d7b507302a5e8061231dbfac24079471d2559b Mon Sep 17 00:00:00 2001 From: Francisco Ramirez de Anton Date: Fri, 26 Dec 2025 15:57:32 +0100 Subject: [PATCH 1/2] Using only ONNX::onnx and removing invalid config --- recipes/onnxruntime/all/cmake/onnxruntime_external_deps.cmake | 2 +- recipes/onnxruntime/all/conanfile.py | 4 ---- 2 files changed, 1 insertion(+), 5 deletions(-) diff --git a/recipes/onnxruntime/all/cmake/onnxruntime_external_deps.cmake b/recipes/onnxruntime/all/cmake/onnxruntime_external_deps.cmake index 083ed6d63fc82..0933db8cb9808 100644 --- a/recipes/onnxruntime/all/cmake/onnxruntime_external_deps.cmake +++ b/recipes/onnxruntime/all/cmake/onnxruntime_external_deps.cmake @@ -98,7 +98,7 @@ endif() set(onnxruntime_EXTERNAL_LIBRARIES ${onnxruntime_EXTERNAL_LIBRARIES_XNNPACK} ${WIL_TARGET} nlohmann_json::nlohmann_json - onnx onnx_proto ${PROTOBUF_LIB} re2::re2 Boost::mp11 safeint_interface + onnx ${PROTOBUF_LIB} re2::re2 Boost::mp11 safeint_interface flatbuffers::flatbuffers ${GSL_TARGET} ${ABSEIL_LIBS} date::date ${ONNXRUNTIME_CPUINFO_TARGETS} Eigen3::Eigen) diff --git a/recipes/onnxruntime/all/conanfile.py b/recipes/onnxruntime/all/conanfile.py index 1ca86b1576807..30a1fc4a50bba 100644 --- a/recipes/onnxruntime/all/conanfile.py +++ b/recipes/onnxruntime/all/conanfile.py @@ -81,10 +81,6 @@ def validate(self): raise ConanInvalidConfiguration( f"{self.ref} requires onnx compiled with `-o onnx:disable_static_registration=True`." ) - if onnx.options.get_safe("shared"): - # Commented here: https://github.com/onnx/onnx/pull/7505#issuecomment-3601468150 - raise ConanInvalidConfiguration("There are link errors using 'onnx/*:shared=True'," - " use '-o onnx/*:shared=False' instead.") def validate_build(self): if self.settings.os == "Windows" and self.dependencies["abseil"].options.shared: From 95437ae3aa52b9e2db4a948ef8fa33e50b7fa4c5 Mon Sep 17 00:00:00 2001 From: Francisco Ramirez de Anton Date: Fri, 26 Dec 2025 18:13:09 +0100 Subject: [PATCH 2/2] Defining Python_EXECUTABLE --- recipes/onnxruntime/all/conanfile.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/recipes/onnxruntime/all/conanfile.py b/recipes/onnxruntime/all/conanfile.py index 30a1fc4a50bba..595ed7753ca8c 100644 --- a/recipes/onnxruntime/all/conanfile.py +++ b/recipes/onnxruntime/all/conanfile.py @@ -1,5 +1,4 @@ import os -import sys from conan import ConanFile from conan.errors import ConanInvalidConfiguration @@ -98,7 +97,9 @@ def generate(self): tc = CMakeToolchain(self) # disable downloading dependencies to ensure conan ones are used tc.variables["FETCHCONTENT_FULLY_DISCONNECTED"] = True - + if self.options.shared: + import sys + tc.variables["Python_EXECUTABLE"] = sys.executable.replace("\\", "/") tc.variables["onnxruntime_BUILD_SHARED_LIB"] = self.options.shared tc.variables["onnxruntime_USE_FULL_PROTOBUF"] = not self.dependencies["protobuf"].options.lite tc.variables["onnxruntime_USE_XNNPACK"] = self.options.with_xnnpack