From 6506173bdf7a273dad8118e8531531bcc1510f33 Mon Sep 17 00:00:00 2001 From: Simeon Manolov Date: Wed, 12 Nov 2025 23:25:28 +0200 Subject: [PATCH 01/11] onnxruntime --- .github/workflows/rebuildDependencies.yml | 45 +++++++++++++++++-- conan_patches/onnxruntime/conandata.yml | 9 ++++ .../onnxruntime/patches/android-64.diff | 31 +++++++++++++ .../onnxruntime/patches/msvc-x86.diff | 43 ++++++++++++++++++ conan_patches/onnxruntime/recipe.diff | 15 +++++++ conan_profiles/base/msvc-intel | 19 ++------ conan_profiles/base/msvc-win7 | 12 +++++ conan_profiles/base/msvc-win8 | 12 +++++ conan_profiles/ios-arm64 | 2 +- conan_profiles/macos-intel | 2 +- conan_profiles/msvc-x64 | 1 + conan_profiles/msvc-x64-win7 | 5 +++ conan_profiles/msvc-x86 | 1 + conan_profiles/msvc-x86-win7 | 5 +++ conanfile.py | 5 +++ 15 files changed, 186 insertions(+), 21 deletions(-) create mode 100644 conan_patches/onnxruntime/conandata.yml create mode 100644 conan_patches/onnxruntime/patches/android-64.diff create mode 100644 conan_patches/onnxruntime/patches/msvc-x86.diff create mode 100644 conan_patches/onnxruntime/recipe.diff create mode 100644 conan_profiles/base/msvc-win7 create mode 100644 conan_profiles/base/msvc-win8 create mode 100644 conan_profiles/msvc-x64-win7 create mode 100644 conan_profiles/msvc-x86-win7 diff --git a/.github/workflows/rebuildDependencies.yml b/.github/workflows/rebuildDependencies.yml index 5328c50..0e619d2 100644 --- a/.github/workflows/rebuildDependencies.yml +++ b/.github/workflows/rebuildDependencies.yml @@ -45,10 +45,18 @@ jobs: os: windows-latest conan_profiles: '["msvc-x64"]' conan_options: -o "&:target_pre_windows10=True" + - platform: windows-x64-win7 + os: windows-latest + conan_profiles: '["msvc-x64-win7"]' + conan_options: -o "&:target_pre_windows10=True" -o "&:with_onnxruntime=False" - platform: windows-x86 os: windows-latest conan_profiles: '["msvc-x86"]' conan_options: -o "&:target_pre_windows10=True" + - platform: windows-x86-win7 + os: windows-latest + conan_profiles: '["msvc-x86-win7"]' + conan_options: -o "&:target_pre_windows10=True" -o "&:with_onnxruntime=False" - platform: windows-arm64 os: windows-11-arm conan_profiles: '["msvc-arm64"]' @@ -119,6 +127,7 @@ jobs: - name: Build recipes with our patches run: | + set -x cciRepo='conan-center-index' branchName='master' recipePathQt='recipes/qt' @@ -134,13 +143,18 @@ jobs: git sparse-checkout set \ recipes/minizip \ recipes/flac \ + recipes/onnxruntime \ $recipePathQt \ git checkout + # Patch conan recipe to prevent dragging libcurl as a dependency + # (can't be done via VCMI's conanfile as onnxruntime is built beforehand) + git apply --ignore-whitespace ../conan_patches/onnxruntime/recipe.diff + # versions must be synced with: conan_patches//conandata.yml # if no custom patches are required for a package, it should be removed from here - for p in minizip/1.3.1 flac/1.4.2 ; do + for p in minizip/1.3.1 flac/1.4.2 onnxruntime/1.18.1 ; do IFS_OLD="$IFS" IFS=/ read package version <<<"$p" @@ -148,6 +162,8 @@ jobs: if [[ $package == qt ]] ; then packagePath="$recipePathQt/5.x.x" + elif [[ $package == onnxruntime ]] && ${{ contains(matrix.conan_options, 'with_onnxruntime=False') }} ; then + continue else packagePath="recipes/$package/all" fi @@ -219,8 +235,11 @@ jobs: - name: Remove build requirements' binaries run: | + set -x graphFile='graph.json' - packageListFile='pkglist.json' + hostPackagesFile='packages-host.json' + buildPackagesFile='packages-build.json' + buildFilteredPackagesFile='packages-build-filtered.txt' conan graph info . \ $CONAN_PROFILES \ @@ -229,12 +248,30 @@ jobs: --build=never \ --no-remote \ > "$graphFile" + conan list \ --graph "$graphFile" \ --graph-context=build-only \ --format=json \ - > "$packageListFile" - conan remove --list "$packageListFile" --confirm + > $buildPackagesFile + + conan list \ + --graph "$graphFile" \ + --graph-context=host \ + --format=json \ + > $hostPackagesFile + + # Some are both build and host requirements and must not be removed + # => exclude them from the list + cat $buildPackagesFile $hostPackagesFile | jq -s ' + .[0]["Local Cache"] as $build_packages + | (.[1]["Local Cache"] | keys) as $host_package_names + | $build_packages + | with_entries(select(.key as $k | $host_package_names | index($k) == null)) as $packages + | {"Local Cache": $packages} + ' > $buildFilteredPackagesFile + + conan remove --list "$buildFilteredPackagesFile" --confirm - name: Create list of built packages run: | diff --git a/conan_patches/onnxruntime/conandata.yml b/conan_patches/onnxruntime/conandata.yml new file mode 100644 index 0000000..3841cee --- /dev/null +++ b/conan_patches/onnxruntime/conandata.yml @@ -0,0 +1,9 @@ +patches: + "1.18.1": + - patch_file: "patches/android-64.diff" + patch_description: | + Fixes error for arm64-v8a targets: + onnxruntime/core/mlas/lib/mlasi.h:366:11: error: unknown type name 'bfloat16_t' + - patch_file: "patches/msvc-x86.diff" + patch_description: | + Fixes detection of x86 windows targets during cross-compilation. diff --git a/conan_patches/onnxruntime/patches/android-64.diff b/conan_patches/onnxruntime/patches/android-64.diff new file mode 100644 index 0000000..ab48aa7 --- /dev/null +++ b/conan_patches/onnxruntime/patches/android-64.diff @@ -0,0 +1,31 @@ +--- a/cmake/onnxruntime_mlas.cmake ++++ b/cmake/onnxruntime_mlas.cmake +@@ -352,7 +362,7 @@ else() + ${MLAS_SRC_DIR}/sqnbitgemm_kernel_neon.cpp + ) + set_source_files_properties(${MLAS_SRC_DIR}/sqnbitgemm_kernel_neon.cpp +- PROPERTIES COMPILE_FLAGS " -march=armv8.2-a+dotprod") ++ PROPERTIES COMPILE_FLAGS " -march=armv8.2-a+dotprod+bf16") + if (NOT APPLE) + set(mlas_platform_srcs + ${mlas_platform_srcs} +@@ -368,13 +378,13 @@ else() + ${MLAS_SRC_DIR}/qgemm_kernel_ummla.cpp + ${MLAS_SRC_DIR}/sbgemm_kernel_neon.cpp + ) +- set_source_files_properties(${MLAS_SRC_DIR}/aarch64/HalfGemmKernelNeon.S PROPERTIES COMPILE_FLAGS " -march=armv8.2-a+fp16 ") +- set_source_files_properties(${MLAS_SRC_DIR}/aarch64/QgemmS8S8KernelSmmla.S PROPERTIES COMPILE_FLAGS " -march=armv8.2-a+i8mm ") +- set_source_files_properties(${MLAS_SRC_DIR}/aarch64/QgemmU8X8KernelUmmla.S PROPERTIES COMPILE_FLAGS " -march=armv8.2-a+i8mm ") ++ set_source_files_properties(${MLAS_SRC_DIR}/aarch64/HalfGemmKernelNeon.S PROPERTIES COMPILE_FLAGS " -march=armv8.2-a+fp16+bf16 ") ++ set_source_files_properties(${MLAS_SRC_DIR}/aarch64/QgemmS8S8KernelSmmla.S PROPERTIES COMPILE_FLAGS " -march=armv8.2-a+i8mm+bf16 ") ++ set_source_files_properties(${MLAS_SRC_DIR}/aarch64/QgemmU8X8KernelUmmla.S PROPERTIES COMPILE_FLAGS " -march=armv8.2-a+i8mm+bf16 ") + set_source_files_properties(${MLAS_SRC_DIR}/aarch64/SbgemmKernelNeon.S PROPERTIES COMPILE_FLAGS " -march=armv8.2-a+bf16 ") +- set_source_files_properties(${MLAS_SRC_DIR}/activate_fp16.cpp PROPERTIES COMPILE_FLAGS " -march=armv8.2-a+fp16 ") +- set_source_files_properties(${MLAS_SRC_DIR}/dwconv.cpp PROPERTIES COMPILE_FLAGS " -march=armv8.2-a+fp16 ") +- set_source_files_properties(${MLAS_SRC_DIR}/pooling_fp16.cpp PROPERTIES COMPILE_FLAGS " -march=armv8.2-a+fp16 ") ++ set_source_files_properties(${MLAS_SRC_DIR}/activate_fp16.cpp PROPERTIES COMPILE_FLAGS " -march=armv8.2-a+fp16+bf16 ") ++ set_source_files_properties(${MLAS_SRC_DIR}/dwconv.cpp PROPERTIES COMPILE_FLAGS " -march=armv8.2-a+fp16+bf16 ") ++ set_source_files_properties(${MLAS_SRC_DIR}/pooling_fp16.cpp PROPERTIES COMPILE_FLAGS " -march=armv8.2-a+fp16+bf16 ") + set_source_files_properties(${MLAS_SRC_DIR}/sbgemm_kernel_neon.cpp PROPERTIES COMPILE_FLAGS " -march=armv8.2-a+bf16 ") + endif() + diff --git a/conan_patches/onnxruntime/patches/msvc-x86.diff b/conan_patches/onnxruntime/patches/msvc-x86.diff new file mode 100644 index 0000000..24bc32a --- /dev/null +++ b/conan_patches/onnxruntime/patches/msvc-x86.diff @@ -0,0 +1,43 @@ +--- a/cmake/adjust_global_compile_flags.cmake ++++ b/cmake/adjust_global_compile_flags.cmake +@@ -226,13 +226,17 @@ endmacro() + + #Set global compile flags for all the source code(including third_party code like protobuf) + #This section must be before any add_subdirectory, otherwise build may fail because /MD,/MT mismatch ++message(STATUS "MSVC=${MSVC} | CMAKE_VS_PLATFORM_NAME=${CMAKE_VS_PLATFORM_NAME} | CMAKE_C_COMPILER_ARCHITECTURE_ID=${CMAKE_C_COMPILER_ARCHITECTURE_ID} | CMAKE_SYSTEM_PROCESSOR=${CMAKE_SYSTEM_PROCESSOR}") + if (MSVC) + if (CMAKE_VS_PLATFORM_NAME) + # Multi-platform generator + set(onnxruntime_target_platform ${CMAKE_VS_PLATFORM_NAME}) ++ elseif (CMAKE_C_COMPILER_ARCHITECTURE_ID) ++ set(onnxruntime_target_platform ${CMAKE_C_COMPILER_ARCHITECTURE_ID}) + else() + set(onnxruntime_target_platform ${CMAKE_SYSTEM_PROCESSOR}) + endif() ++ message(STATUS "Temporary onnxruntime_target_platform=${onnxruntime_target_platform}") + if (onnxruntime_target_platform STREQUAL "ARM64") + set(onnxruntime_target_platform "ARM64") + enable_language(ASM_MARMASM) +@@ -241,18 +245,19 @@ if (MSVC) + elseif (onnxruntime_target_platform STREQUAL "ARM" OR CMAKE_GENERATOR MATCHES "ARM") + set(onnxruntime_target_platform "ARM") + enable_language(ASM_MARMASM) +- elseif (onnxruntime_target_platform STREQUAL "x64" OR onnxruntime_target_platform STREQUAL "x86_64" OR onnxruntime_target_platform STREQUAL "AMD64" OR CMAKE_GENERATOR MATCHES "Win64") ++ elseif (onnxruntime_target_platform MATCHES "[Xx]64" OR onnxruntime_target_platform MATCHES "[Xx]86_64" OR onnxruntime_target_platform STREQUAL "AMD64" OR CMAKE_GENERATOR MATCHES "Win64") + set(onnxruntime_target_platform "x64") + enable_language(ASM_MASM) +- elseif (onnxruntime_target_platform STREQUAL "Win32" OR onnxruntime_target_platform STREQUAL "x86" OR onnxruntime_target_platform STREQUAL "i386" OR onnxruntime_target_platform STREQUAL "i686") ++ elseif (onnxruntime_target_platform STREQUAL "Win32" OR onnxruntime_target_platform MATCHES "[Xx]86" OR onnxruntime_target_platform STREQUAL "i386" OR onnxruntime_target_platform STREQUAL "i686") + set(onnxruntime_target_platform "x86") + enable_language(ASM_MASM) + message("Enabling SAFESEH for x86 build") + set(CMAKE_ASM_MASM_FLAGS "${CMAKE_ASM_MASM_FLAGS} /safeseh") + else() +- message(FATAL_ERROR "Unknown CMAKE_SYSTEM_PROCESSOR: ${CMAKE_SYSTEM_PROCESSOR}") ++ message(FATAL_ERROR "Unknown onnxruntime_target_platform: ${onnxruntime_target_platform}") + endif() + ++ message(STATUS "Final onnxruntime_target_platform=${onnxruntime_target_platform}") + + #Always enable exception handling, even for Windows ARM + if (NOT onnxruntime_DISABLE_EXCEPTIONS) diff --git a/conan_patches/onnxruntime/recipe.diff b/conan_patches/onnxruntime/recipe.diff new file mode 100644 index 0000000..82f0a01 --- /dev/null +++ b/conan_patches/onnxruntime/recipe.diff @@ -0,0 +1,15 @@ +index 0757ecd..587294b 100644 +--- a/recipes/onnxruntime/all/conanfile.py ++++ b/recipes/onnxruntime/all/conanfile.py +@@ -34,6 +34,11 @@ class OnnxRuntimeConan(ConanFile): + "fPIC": True, + "with_xnnpack": False, + "with_cuda": False, ++ # Prevents libcurl dependency (fails to build due to system zlib) ++ # NOTE: ++ # 'use_system_tz_db' is specific to date/3.0.1 (version pinned by onnxruntime/1.18.1). ++ # Newer date recipes would need the tz_db=system option instead. ++ "date/*:use_system_tz_db": True, + } + short_paths = True + diff --git a/conan_profiles/base/msvc-intel b/conan_profiles/base/msvc-intel index cc47c4b..3e9abcc 100644 --- a/conan_profiles/base/msvc-intel +++ b/conan_profiles/base/msvc-intel @@ -3,22 +3,11 @@ include(msvc) [settings] # https://blog.knatten.org/2022/08/26/microsoft-c-versions-explained/ # https://learn.microsoft.com/en-us/cpp/overview/compiler-versions -# v142 / 14.29 / 19.29 -compiler.version=192 -compiler.update=9 +# https://github.com/actions/runner-images/blob/win25/20251102.77/images/windows/Windows2025-Readme.md#microsoft-visual-c +# v144 / 14.44 / 19.44 +compiler.version=194 +compiler.update=4 [conf] # VS 2022 tools.microsoft.msbuild:vs_version=17 - -# https://walbourn.github.io/a-brief-history-of-windows-sdks/ -# https://learn.microsoft.com/en-us/cpp/porting/modifying-winver-and-win32-winnt -# https://learn.microsoft.com/en-us/windows/win32/WinProg/using-the-windows-headers -{% set _WIN32_WINNT_WIN7 = '0x0601' %} -{% set NTDDI_WIN7 = '0x06010000' %} -{% set win7_defines = [ - '_WIN32_WINNT={}'.format(_WIN32_WINNT_WIN7), - 'WINVER={}'.format(_WIN32_WINNT_WIN7), - 'NTDDI_VERSION={}'.format(NTDDI_WIN7), -] %} -tools.build:defines={{ win7_defines }} diff --git a/conan_profiles/base/msvc-win7 b/conan_profiles/base/msvc-win7 new file mode 100644 index 0000000..109c1fd --- /dev/null +++ b/conan_profiles/base/msvc-win7 @@ -0,0 +1,12 @@ +[conf] +# https://walbourn.github.io/a-brief-history-of-windows-sdks/ +# https://learn.microsoft.com/en-us/cpp/porting/modifying-winver-and-win32-winnt +# https://learn.microsoft.com/en-us/windows/win32/WinProg/using-the-windows-headers +{% set _WIN32_WINNT_WIN7 = '0x0601' %} +{% set NTDDI_WIN7 = '0x06010000' %} +{% set win7_defines = [ + '_WIN32_WINNT={}'.format(_WIN32_WINNT_WIN7), + 'WINVER={}'.format(_WIN32_WINNT_WIN7), + 'NTDDI_VERSION={}'.format(NTDDI_WIN7), +] %} +tools.build:defines={{ win7_defines }} diff --git a/conan_profiles/base/msvc-win8 b/conan_profiles/base/msvc-win8 new file mode 100644 index 0000000..16fcbd1 --- /dev/null +++ b/conan_profiles/base/msvc-win8 @@ -0,0 +1,12 @@ +[conf] +# https://walbourn.github.io/a-brief-history-of-windows-sdks/ +# https://learn.microsoft.com/en-us/cpp/porting/modifying-winver-and-win32-winnt +# https://learn.microsoft.com/en-us/windows/win32/WinProg/using-the-windows-headers +{% set _WIN32_WINNT_WIN8 = '0x0602' %} +{% set NTDDI_WIN8 = '0x06020000' %} +{% set win8_defines = [ + '_WIN32_WINNT={}'.format(_WIN32_WINNT_WIN8), + 'WINVER={}'.format(_WIN32_WINNT_WIN8), + 'NTDDI_VERSION={}'.format(NTDDI_WIN8), +] %} +tools.build:defines={{ win8_defines }} diff --git a/conan_profiles/ios-arm64 b/conan_profiles/ios-arm64 index 238bbcf..7b3403d 100644 --- a/conan_profiles/ios-arm64 +++ b/conan_profiles/ios-arm64 @@ -1,5 +1,5 @@ include(base/ios) [settings] -os.version=12.0 +os.version=13.0 arch=armv8 diff --git a/conan_profiles/macos-intel b/conan_profiles/macos-intel index b527e05..569277d 100644 --- a/conan_profiles/macos-intel +++ b/conan_profiles/macos-intel @@ -1,5 +1,5 @@ include(base/macos) [settings] -os.version=10.13 +os.version=10.15 arch=x86_64 diff --git a/conan_profiles/msvc-x64 b/conan_profiles/msvc-x64 index 9b67e42..4c78792 100644 --- a/conan_profiles/msvc-x64 +++ b/conan_profiles/msvc-x64 @@ -1,4 +1,5 @@ include(base/msvc-intel) +include(base/msvc-win8) [settings] arch=x86_64 diff --git a/conan_profiles/msvc-x64-win7 b/conan_profiles/msvc-x64-win7 new file mode 100644 index 0000000..8f2b7b5 --- /dev/null +++ b/conan_profiles/msvc-x64-win7 @@ -0,0 +1,5 @@ +include(base/msvc-intel) +include(base/msvc-win7) + +[settings] +arch=x86_64 diff --git a/conan_profiles/msvc-x86 b/conan_profiles/msvc-x86 index 92261a9..40ef76f 100644 --- a/conan_profiles/msvc-x86 +++ b/conan_profiles/msvc-x86 @@ -1,4 +1,5 @@ include(base/msvc-intel) +include(base/msvc-win8) [settings] arch=x86 diff --git a/conan_profiles/msvc-x86-win7 b/conan_profiles/msvc-x86-win7 new file mode 100644 index 0000000..5e74924 --- /dev/null +++ b/conan_profiles/msvc-x86-win7 @@ -0,0 +1,5 @@ +include(base/msvc-intel) +include(base/msvc-win7) + +[settings] +arch=x86 diff --git a/conanfile.py b/conanfile.py index b359850..588f9bf 100644 --- a/conanfile.py +++ b/conanfile.py @@ -28,11 +28,13 @@ class VCMI(ConanFile): options = { "target_pre_windows10": [True, False], "with_ffmpeg": [True, False], + "with_onnxruntime": [True, False], "lua_lib": [None, "luajit", "lua"] } default_options = { "target_pre_windows10": False, "with_ffmpeg": True, + "with_onnxruntime": True, "lua_lib": "luajit", } @@ -87,6 +89,9 @@ def requirements(self): else: self.requires("qt/[~5.15.2]") + if self.options.with_onnxruntime: + self.requires("onnxruntime/1.18.1") + def validate(self): # FFmpeg if is_msvc(self) and self.options.with_ffmpeg and self.dependencies["ffmpeg"].options.shared != True: From 96f29dce8a58b1b2e3a5b2339ee33e4b1492d242 Mon Sep 17 00:00:00 2001 From: Simeon Manolov Date: Mon, 24 Nov 2025 09:47:51 +0200 Subject: [PATCH 02/11] macos-intel-10.13 and ios-12.0 compat --- .github/workflows/rebuildDependencies.yml | 5 +++-- conan_patches/onnx/conandata.yml | 7 +++++++ conan_patches/onnx/patches/apple-pre-2019.diff | 12 ++++++++++++ conan_profiles/ios-arm64 | 2 +- conan_profiles/macos-intel | 2 +- 5 files changed, 24 insertions(+), 4 deletions(-) create mode 100644 conan_patches/onnx/conandata.yml create mode 100644 conan_patches/onnx/patches/apple-pre-2019.diff diff --git a/.github/workflows/rebuildDependencies.yml b/.github/workflows/rebuildDependencies.yml index 0e619d2..fb045de 100644 --- a/.github/workflows/rebuildDependencies.yml +++ b/.github/workflows/rebuildDependencies.yml @@ -143,6 +143,7 @@ jobs: git sparse-checkout set \ recipes/minizip \ recipes/flac \ + recipes/onnx \ recipes/onnxruntime \ $recipePathQt \ @@ -154,7 +155,7 @@ jobs: # versions must be synced with: conan_patches//conandata.yml # if no custom patches are required for a package, it should be removed from here - for p in minizip/1.3.1 flac/1.4.2 onnxruntime/1.18.1 ; do + for p in minizip/1.3.1 flac/1.4.2 onnx/1.16.2 onnxruntime/1.18.1 ; do IFS_OLD="$IFS" IFS=/ read package version <<<"$p" @@ -162,7 +163,7 @@ jobs: if [[ $package == qt ]] ; then packagePath="$recipePathQt/5.x.x" - elif [[ $package == onnxruntime ]] && ${{ contains(matrix.conan_options, 'with_onnxruntime=False') }} ; then + elif [[ $package =~ ^onnx ]] && ${{ contains(matrix.conan_options, 'with_onnxruntime=False') }} ; then continue else packagePath="recipes/$package/all" diff --git a/conan_patches/onnx/conandata.yml b/conan_patches/onnx/conandata.yml new file mode 100644 index 0000000..68d8d9d --- /dev/null +++ b/conan_patches/onnx/conandata.yml @@ -0,0 +1,7 @@ +patches: + "1.16.2": + - patch_file: "patches/apple-pre-2019.diff" + patch_description: | + Fixes errors for older apple targets: + error: 'basic_fstream' is unavailable: introduced in macOS 10.15 + error: 'basic_fstream' is unavailable: introduced in iOS 13.0 diff --git a/conan_patches/onnx/patches/apple-pre-2019.diff b/conan_patches/onnx/patches/apple-pre-2019.diff new file mode 100644 index 0000000..34f02fe --- /dev/null +++ b/conan_patches/onnx/patches/apple-pre-2019.diff @@ -0,0 +1,12 @@ +--- a/onnx/common/file_utils.h ++++ b/onnx/common/file_utils.h +@@ -17,8 +17,7 @@ namespace ONNX_NAMESPACE { + + template + void LoadProtoFromPath(const std::string proto_path, T& proto) { +- std::filesystem::path proto_u8_path = std::filesystem::u8path(proto_path); +- std::fstream proto_stream(proto_u8_path, std::ios::in | std::ios::binary); ++ std::fstream proto_stream(proto_path, std::ios::in | std::ios::binary); + if (!proto_stream.good()) { + fail_check("Unable to open proto file: ", proto_path, ". Please check if it is a valid proto. "); + } diff --git a/conan_profiles/ios-arm64 b/conan_profiles/ios-arm64 index 7b3403d..238bbcf 100644 --- a/conan_profiles/ios-arm64 +++ b/conan_profiles/ios-arm64 @@ -1,5 +1,5 @@ include(base/ios) [settings] -os.version=13.0 +os.version=12.0 arch=armv8 diff --git a/conan_profiles/macos-intel b/conan_profiles/macos-intel index 569277d..b527e05 100644 --- a/conan_profiles/macos-intel +++ b/conan_profiles/macos-intel @@ -1,5 +1,5 @@ include(base/macos) [settings] -os.version=10.15 +os.version=10.13 arch=x86_64 From 56f3512738dfcdcfffc4010a3ce6100e3a6e35f9 Mon Sep 17 00:00:00 2001 From: Simeon Manolov Date: Mon, 24 Nov 2025 12:28:55 +0200 Subject: [PATCH 03/11] win7 compat --- .github/workflows/rebuildDependencies.yml | 8 --- conan_patches/onnxruntime/conandata.yml | 4 ++ conan_patches/onnxruntime/patches/win7.diff | 80 +++++++++++++++++++++ conan_profiles/base/msvc-intel | 12 ++++ conan_profiles/base/msvc-win7 | 12 ---- conan_profiles/base/msvc-win8 | 12 ---- conan_profiles/msvc-x64 | 1 - conan_profiles/msvc-x64-win7 | 5 -- conan_profiles/msvc-x86 | 1 - conan_profiles/msvc-x86-win7 | 5 -- 10 files changed, 96 insertions(+), 44 deletions(-) create mode 100644 conan_patches/onnxruntime/patches/win7.diff delete mode 100644 conan_profiles/base/msvc-win7 delete mode 100644 conan_profiles/base/msvc-win8 delete mode 100644 conan_profiles/msvc-x64-win7 delete mode 100644 conan_profiles/msvc-x86-win7 diff --git a/.github/workflows/rebuildDependencies.yml b/.github/workflows/rebuildDependencies.yml index fb045de..a0bb2fa 100644 --- a/.github/workflows/rebuildDependencies.yml +++ b/.github/workflows/rebuildDependencies.yml @@ -45,18 +45,10 @@ jobs: os: windows-latest conan_profiles: '["msvc-x64"]' conan_options: -o "&:target_pre_windows10=True" - - platform: windows-x64-win7 - os: windows-latest - conan_profiles: '["msvc-x64-win7"]' - conan_options: -o "&:target_pre_windows10=True" -o "&:with_onnxruntime=False" - platform: windows-x86 os: windows-latest conan_profiles: '["msvc-x86"]' conan_options: -o "&:target_pre_windows10=True" - - platform: windows-x86-win7 - os: windows-latest - conan_profiles: '["msvc-x86-win7"]' - conan_options: -o "&:target_pre_windows10=True" -o "&:with_onnxruntime=False" - platform: windows-arm64 os: windows-11-arm conan_profiles: '["msvc-arm64"]' diff --git a/conan_patches/onnxruntime/conandata.yml b/conan_patches/onnxruntime/conandata.yml index 3841cee..b4114a2 100644 --- a/conan_patches/onnxruntime/conandata.yml +++ b/conan_patches/onnxruntime/conandata.yml @@ -7,3 +7,7 @@ patches: - patch_file: "patches/msvc-x86.diff" patch_description: | Fixes detection of x86 windows targets during cross-compilation. + - patch_file: "patches/win7.diff" + patch_description: | + Fixes compile errors on for windows 7 targets: + error C3861: 'CreateFile2': identifier not found diff --git a/conan_patches/onnxruntime/patches/win7.diff b/conan_patches/onnxruntime/patches/win7.diff new file mode 100644 index 0000000..3a38731 --- /dev/null +++ b/conan_patches/onnxruntime/patches/win7.diff @@ -0,0 +1,80 @@ +--- a/onnxruntime/test/shared_lib/test_model_loading.cc ++++ b/onnxruntime/test/shared_lib/test_model_loading.cc +@@ -227,7 +227,7 @@ using ScopedFileDescriptor = ScopedResource; + + void FileMmap(const ORTCHAR_T* file_path, void*& mapped_base) { + #ifdef _WIN32 +- wil::unique_hfile file_handle{CreateFile2(file_path, GENERIC_READ, FILE_SHARE_READ, OPEN_EXISTING, NULL)}; ++ wil::unique_hfile file_handle{CreateFileW(file_path, FILE_READ_ATTRIBUTES, FILE_SHARE_READ, nullptr, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, nullptr)}; + ASSERT_TRUE(file_handle.get() != INVALID_HANDLE_VALUE); + + wil::unique_hfile file_mapping_handle{ +--- a/onnxruntime/core/platform/windows/env.cc ++++ b/onnxruntime/core/platform/windows/env.cc +@@ -314,7 +314,7 @@ PIDType WindowsEnv::GetSelfPid() const { + + Status WindowsEnv::GetFileLength(_In_z_ const ORTCHAR_T* file_path, size_t& length) const { + wil::unique_hfile file_handle{ +- CreateFile2(file_path, FILE_READ_ATTRIBUTES, FILE_SHARE_READ, OPEN_EXISTING, NULL)}; ++ CreateFileW(file_path, FILE_READ_ATTRIBUTES, FILE_SHARE_READ, nullptr, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, nullptr)}; + if (file_handle.get() == INVALID_HANDLE_VALUE) { + const auto error_code = GetLastError(); + return ORT_MAKE_STATUS(ONNXRUNTIME, FAIL, "open file ", ToUTF8String(Basename(file_path)), " fail, errcode = ", error_code, " - ", std::system_category().message(error_code)); +@@ -361,7 +361,7 @@ Status WindowsEnv::ReadFileIntoBuffer(_In_z_ const ORTCHAR_T* const file_path, c + ORT_RETURN_IF_NOT(offset >= 0, "offset < 0"); + ORT_RETURN_IF_NOT(length <= buffer.size(), "length > buffer.size()"); + wil::unique_hfile file_handle{ +- CreateFile2(file_path, GENERIC_READ, FILE_SHARE_READ, OPEN_EXISTING, NULL)}; ++ CreateFileW(file_path, FILE_READ_ATTRIBUTES, FILE_SHARE_READ, nullptr, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, nullptr)}; + if (file_handle.get() == INVALID_HANDLE_VALUE) { + const auto error_code = GetLastError(); + return ORT_MAKE_STATUS(ONNXRUNTIME, FAIL, "open file ", ToUTF8String(Basename(file_path)), " fail, errcode = ", error_code, " - ", std::system_category().message(error_code)); +@@ -414,7 +414,7 @@ Status WindowsEnv::MapFileIntoMemory(_In_z_ const ORTCHAR_T* file_path, + } + + wil::unique_hfile file_handle{ +- CreateFile2(file_path, GENERIC_READ, FILE_SHARE_READ, OPEN_EXISTING, NULL)}; ++ CreateFileW(file_path, FILE_READ_ATTRIBUTES, FILE_SHARE_READ, nullptr, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, nullptr)}; + if (file_handle.get() == INVALID_HANDLE_VALUE) { + const auto error_code = GetLastError(); + return ORT_MAKE_STATUS(ONNXRUNTIME, FAIL, +@@ -600,16 +600,14 @@ common::Status WindowsEnv::GetCanonicalPath( + PathString& canonical_path) const { + // adapted from MSVC STL std::filesystem::canonical() implementation + // https://github.com/microsoft/STL/blob/ed3cbf36416a385828e7a5987ca52cb42882d84b/stl/inc/filesystem#L2986 +- CREATEFILE2_EXTENDED_PARAMETERS param; +- memset(¶m, 0, sizeof(param)); +- param.dwSize = sizeof(CREATEFILE2_EXTENDED_PARAMETERS); +- param.dwFileFlags = FILE_FLAG_BACKUP_SEMANTICS; +- wil::unique_hfile file_handle{CreateFile2( +- path.c_str(), +- FILE_READ_ATTRIBUTES, +- FILE_SHARE_READ | FILE_SHARE_WRITE | FILE_SHARE_DELETE, +- OPEN_EXISTING, +- ¶m)}; ++ wil::unique_hfile file_handle{CreateFileW( ++ path.c_str(), // LPCWSTR lpFileName ++ FILE_READ_ATTRIBUTES, // DWORD dwDesiredAccess ++ FILE_SHARE_READ | FILE_SHARE_WRITE | FILE_SHARE_DELETE, // DWORD dwShareMode ++ nullptr, // LPSECURITY_ATTRIBUTES lpSecurityAttributes ++ OPEN_EXISTING, // DWORD dwCreationDisposition ++ FILE_FLAG_BACKUP_SEMANTICS, // DWORD dwFlagsAndAttributes ++ nullptr)}; // HANDLE hTemplateFile + + if (file_handle.get() == INVALID_HANDLE_VALUE) { + const auto error_code = GetLastError(); +--- a/onnxruntime/core/platform/windows/env_time.cc ++++ b/onnxruntime/core/platform/windows/env_time.cc +@@ -22,6 +22,12 @@ limitations under the License. + #include + #include + ++#ifndef GetSystemTimePreciseAsFileTime ++static void WINAPI GetSystemTimePreciseAsFileTime(LPFILETIME lpSystemTimeAsFileTime) { ++ GetSystemTimeAsFileTime(lpSystemTimeAsFileTime); ++} ++#endif ++ + namespace onnxruntime { + + namespace { diff --git a/conan_profiles/base/msvc-intel b/conan_profiles/base/msvc-intel index 3e9abcc..158bb8f 100644 --- a/conan_profiles/base/msvc-intel +++ b/conan_profiles/base/msvc-intel @@ -11,3 +11,15 @@ compiler.update=4 [conf] # VS 2022 tools.microsoft.msbuild:vs_version=17 + +# https://walbourn.github.io/a-brief-history-of-windows-sdks/ +# https://learn.microsoft.com/en-us/cpp/porting/modifying-winver-and-win32-winnt +# https://learn.microsoft.com/en-us/windows/win32/WinProg/using-the-windows-headers +{% set _WIN32_WINNT_WIN7 = '0x0601' %} +{% set NTDDI_WIN7 = '0x06010000' %} +{% set win7_defines = [ + '_WIN32_WINNT={}'.format(_WIN32_WINNT_WIN7), + 'WINVER={}'.format(_WIN32_WINNT_WIN7), + 'NTDDI_VERSION={}'.format(NTDDI_WIN7), +] %} +tools.build:defines={{ win7_defines }} diff --git a/conan_profiles/base/msvc-win7 b/conan_profiles/base/msvc-win7 deleted file mode 100644 index 109c1fd..0000000 --- a/conan_profiles/base/msvc-win7 +++ /dev/null @@ -1,12 +0,0 @@ -[conf] -# https://walbourn.github.io/a-brief-history-of-windows-sdks/ -# https://learn.microsoft.com/en-us/cpp/porting/modifying-winver-and-win32-winnt -# https://learn.microsoft.com/en-us/windows/win32/WinProg/using-the-windows-headers -{% set _WIN32_WINNT_WIN7 = '0x0601' %} -{% set NTDDI_WIN7 = '0x06010000' %} -{% set win7_defines = [ - '_WIN32_WINNT={}'.format(_WIN32_WINNT_WIN7), - 'WINVER={}'.format(_WIN32_WINNT_WIN7), - 'NTDDI_VERSION={}'.format(NTDDI_WIN7), -] %} -tools.build:defines={{ win7_defines }} diff --git a/conan_profiles/base/msvc-win8 b/conan_profiles/base/msvc-win8 deleted file mode 100644 index 16fcbd1..0000000 --- a/conan_profiles/base/msvc-win8 +++ /dev/null @@ -1,12 +0,0 @@ -[conf] -# https://walbourn.github.io/a-brief-history-of-windows-sdks/ -# https://learn.microsoft.com/en-us/cpp/porting/modifying-winver-and-win32-winnt -# https://learn.microsoft.com/en-us/windows/win32/WinProg/using-the-windows-headers -{% set _WIN32_WINNT_WIN8 = '0x0602' %} -{% set NTDDI_WIN8 = '0x06020000' %} -{% set win8_defines = [ - '_WIN32_WINNT={}'.format(_WIN32_WINNT_WIN8), - 'WINVER={}'.format(_WIN32_WINNT_WIN8), - 'NTDDI_VERSION={}'.format(NTDDI_WIN8), -] %} -tools.build:defines={{ win8_defines }} diff --git a/conan_profiles/msvc-x64 b/conan_profiles/msvc-x64 index 4c78792..9b67e42 100644 --- a/conan_profiles/msvc-x64 +++ b/conan_profiles/msvc-x64 @@ -1,5 +1,4 @@ include(base/msvc-intel) -include(base/msvc-win8) [settings] arch=x86_64 diff --git a/conan_profiles/msvc-x64-win7 b/conan_profiles/msvc-x64-win7 deleted file mode 100644 index 8f2b7b5..0000000 --- a/conan_profiles/msvc-x64-win7 +++ /dev/null @@ -1,5 +0,0 @@ -include(base/msvc-intel) -include(base/msvc-win7) - -[settings] -arch=x86_64 diff --git a/conan_profiles/msvc-x86 b/conan_profiles/msvc-x86 index 40ef76f..92261a9 100644 --- a/conan_profiles/msvc-x86 +++ b/conan_profiles/msvc-x86 @@ -1,5 +1,4 @@ include(base/msvc-intel) -include(base/msvc-win8) [settings] arch=x86 diff --git a/conan_profiles/msvc-x86-win7 b/conan_profiles/msvc-x86-win7 deleted file mode 100644 index 5e74924..0000000 --- a/conan_profiles/msvc-x86-win7 +++ /dev/null @@ -1,5 +0,0 @@ -include(base/msvc-intel) -include(base/msvc-win7) - -[settings] -arch=x86 From ef8b4b172e4d09e609380a40edc2de8a2a69e7f6 Mon Sep 17 00:00:00 2001 From: Simeon Manolov Date: Tue, 25 Nov 2025 02:39:07 +0200 Subject: [PATCH 04/11] Revert "win7 compat" This reverts commit 56f3512738dfcdcfffc4010a3ce6100e3a6e35f9. Removing CreateFile2 calls was insufficient to enable win7 support. There are win8+ API calls which are not straightforward to replace: onnxruntime\core\platform\windows\env_time.cc(31): error C2065: 'GetSystemTimePreciseAsFileTime': undeclared identifier --- .github/workflows/rebuildDependencies.yml | 8 +++ conan_patches/onnxruntime/conandata.yml | 4 -- conan_patches/onnxruntime/patches/win7.diff | 80 --------------------- conan_profiles/base/msvc-intel | 12 ---- conan_profiles/base/msvc-win7 | 12 ++++ conan_profiles/base/msvc-win8 | 12 ++++ conan_profiles/msvc-x64 | 1 + conan_profiles/msvc-x64-win7 | 5 ++ conan_profiles/msvc-x86 | 1 + conan_profiles/msvc-x86-win7 | 5 ++ 10 files changed, 44 insertions(+), 96 deletions(-) delete mode 100644 conan_patches/onnxruntime/patches/win7.diff create mode 100644 conan_profiles/base/msvc-win7 create mode 100644 conan_profiles/base/msvc-win8 create mode 100644 conan_profiles/msvc-x64-win7 create mode 100644 conan_profiles/msvc-x86-win7 diff --git a/.github/workflows/rebuildDependencies.yml b/.github/workflows/rebuildDependencies.yml index a0bb2fa..fb045de 100644 --- a/.github/workflows/rebuildDependencies.yml +++ b/.github/workflows/rebuildDependencies.yml @@ -45,10 +45,18 @@ jobs: os: windows-latest conan_profiles: '["msvc-x64"]' conan_options: -o "&:target_pre_windows10=True" + - platform: windows-x64-win7 + os: windows-latest + conan_profiles: '["msvc-x64-win7"]' + conan_options: -o "&:target_pre_windows10=True" -o "&:with_onnxruntime=False" - platform: windows-x86 os: windows-latest conan_profiles: '["msvc-x86"]' conan_options: -o "&:target_pre_windows10=True" + - platform: windows-x86-win7 + os: windows-latest + conan_profiles: '["msvc-x86-win7"]' + conan_options: -o "&:target_pre_windows10=True" -o "&:with_onnxruntime=False" - platform: windows-arm64 os: windows-11-arm conan_profiles: '["msvc-arm64"]' diff --git a/conan_patches/onnxruntime/conandata.yml b/conan_patches/onnxruntime/conandata.yml index b4114a2..3841cee 100644 --- a/conan_patches/onnxruntime/conandata.yml +++ b/conan_patches/onnxruntime/conandata.yml @@ -7,7 +7,3 @@ patches: - patch_file: "patches/msvc-x86.diff" patch_description: | Fixes detection of x86 windows targets during cross-compilation. - - patch_file: "patches/win7.diff" - patch_description: | - Fixes compile errors on for windows 7 targets: - error C3861: 'CreateFile2': identifier not found diff --git a/conan_patches/onnxruntime/patches/win7.diff b/conan_patches/onnxruntime/patches/win7.diff deleted file mode 100644 index 3a38731..0000000 --- a/conan_patches/onnxruntime/patches/win7.diff +++ /dev/null @@ -1,80 +0,0 @@ ---- a/onnxruntime/test/shared_lib/test_model_loading.cc -+++ b/onnxruntime/test/shared_lib/test_model_loading.cc -@@ -227,7 +227,7 @@ using ScopedFileDescriptor = ScopedResource; - - void FileMmap(const ORTCHAR_T* file_path, void*& mapped_base) { - #ifdef _WIN32 -- wil::unique_hfile file_handle{CreateFile2(file_path, GENERIC_READ, FILE_SHARE_READ, OPEN_EXISTING, NULL)}; -+ wil::unique_hfile file_handle{CreateFileW(file_path, FILE_READ_ATTRIBUTES, FILE_SHARE_READ, nullptr, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, nullptr)}; - ASSERT_TRUE(file_handle.get() != INVALID_HANDLE_VALUE); - - wil::unique_hfile file_mapping_handle{ ---- a/onnxruntime/core/platform/windows/env.cc -+++ b/onnxruntime/core/platform/windows/env.cc -@@ -314,7 +314,7 @@ PIDType WindowsEnv::GetSelfPid() const { - - Status WindowsEnv::GetFileLength(_In_z_ const ORTCHAR_T* file_path, size_t& length) const { - wil::unique_hfile file_handle{ -- CreateFile2(file_path, FILE_READ_ATTRIBUTES, FILE_SHARE_READ, OPEN_EXISTING, NULL)}; -+ CreateFileW(file_path, FILE_READ_ATTRIBUTES, FILE_SHARE_READ, nullptr, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, nullptr)}; - if (file_handle.get() == INVALID_HANDLE_VALUE) { - const auto error_code = GetLastError(); - return ORT_MAKE_STATUS(ONNXRUNTIME, FAIL, "open file ", ToUTF8String(Basename(file_path)), " fail, errcode = ", error_code, " - ", std::system_category().message(error_code)); -@@ -361,7 +361,7 @@ Status WindowsEnv::ReadFileIntoBuffer(_In_z_ const ORTCHAR_T* const file_path, c - ORT_RETURN_IF_NOT(offset >= 0, "offset < 0"); - ORT_RETURN_IF_NOT(length <= buffer.size(), "length > buffer.size()"); - wil::unique_hfile file_handle{ -- CreateFile2(file_path, GENERIC_READ, FILE_SHARE_READ, OPEN_EXISTING, NULL)}; -+ CreateFileW(file_path, FILE_READ_ATTRIBUTES, FILE_SHARE_READ, nullptr, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, nullptr)}; - if (file_handle.get() == INVALID_HANDLE_VALUE) { - const auto error_code = GetLastError(); - return ORT_MAKE_STATUS(ONNXRUNTIME, FAIL, "open file ", ToUTF8String(Basename(file_path)), " fail, errcode = ", error_code, " - ", std::system_category().message(error_code)); -@@ -414,7 +414,7 @@ Status WindowsEnv::MapFileIntoMemory(_In_z_ const ORTCHAR_T* file_path, - } - - wil::unique_hfile file_handle{ -- CreateFile2(file_path, GENERIC_READ, FILE_SHARE_READ, OPEN_EXISTING, NULL)}; -+ CreateFileW(file_path, FILE_READ_ATTRIBUTES, FILE_SHARE_READ, nullptr, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, nullptr)}; - if (file_handle.get() == INVALID_HANDLE_VALUE) { - const auto error_code = GetLastError(); - return ORT_MAKE_STATUS(ONNXRUNTIME, FAIL, -@@ -600,16 +600,14 @@ common::Status WindowsEnv::GetCanonicalPath( - PathString& canonical_path) const { - // adapted from MSVC STL std::filesystem::canonical() implementation - // https://github.com/microsoft/STL/blob/ed3cbf36416a385828e7a5987ca52cb42882d84b/stl/inc/filesystem#L2986 -- CREATEFILE2_EXTENDED_PARAMETERS param; -- memset(¶m, 0, sizeof(param)); -- param.dwSize = sizeof(CREATEFILE2_EXTENDED_PARAMETERS); -- param.dwFileFlags = FILE_FLAG_BACKUP_SEMANTICS; -- wil::unique_hfile file_handle{CreateFile2( -- path.c_str(), -- FILE_READ_ATTRIBUTES, -- FILE_SHARE_READ | FILE_SHARE_WRITE | FILE_SHARE_DELETE, -- OPEN_EXISTING, -- ¶m)}; -+ wil::unique_hfile file_handle{CreateFileW( -+ path.c_str(), // LPCWSTR lpFileName -+ FILE_READ_ATTRIBUTES, // DWORD dwDesiredAccess -+ FILE_SHARE_READ | FILE_SHARE_WRITE | FILE_SHARE_DELETE, // DWORD dwShareMode -+ nullptr, // LPSECURITY_ATTRIBUTES lpSecurityAttributes -+ OPEN_EXISTING, // DWORD dwCreationDisposition -+ FILE_FLAG_BACKUP_SEMANTICS, // DWORD dwFlagsAndAttributes -+ nullptr)}; // HANDLE hTemplateFile - - if (file_handle.get() == INVALID_HANDLE_VALUE) { - const auto error_code = GetLastError(); ---- a/onnxruntime/core/platform/windows/env_time.cc -+++ b/onnxruntime/core/platform/windows/env_time.cc -@@ -22,6 +22,12 @@ limitations under the License. - #include - #include - -+#ifndef GetSystemTimePreciseAsFileTime -+static void WINAPI GetSystemTimePreciseAsFileTime(LPFILETIME lpSystemTimeAsFileTime) { -+ GetSystemTimeAsFileTime(lpSystemTimeAsFileTime); -+} -+#endif -+ - namespace onnxruntime { - - namespace { diff --git a/conan_profiles/base/msvc-intel b/conan_profiles/base/msvc-intel index 158bb8f..3e9abcc 100644 --- a/conan_profiles/base/msvc-intel +++ b/conan_profiles/base/msvc-intel @@ -11,15 +11,3 @@ compiler.update=4 [conf] # VS 2022 tools.microsoft.msbuild:vs_version=17 - -# https://walbourn.github.io/a-brief-history-of-windows-sdks/ -# https://learn.microsoft.com/en-us/cpp/porting/modifying-winver-and-win32-winnt -# https://learn.microsoft.com/en-us/windows/win32/WinProg/using-the-windows-headers -{% set _WIN32_WINNT_WIN7 = '0x0601' %} -{% set NTDDI_WIN7 = '0x06010000' %} -{% set win7_defines = [ - '_WIN32_WINNT={}'.format(_WIN32_WINNT_WIN7), - 'WINVER={}'.format(_WIN32_WINNT_WIN7), - 'NTDDI_VERSION={}'.format(NTDDI_WIN7), -] %} -tools.build:defines={{ win7_defines }} diff --git a/conan_profiles/base/msvc-win7 b/conan_profiles/base/msvc-win7 new file mode 100644 index 0000000..109c1fd --- /dev/null +++ b/conan_profiles/base/msvc-win7 @@ -0,0 +1,12 @@ +[conf] +# https://walbourn.github.io/a-brief-history-of-windows-sdks/ +# https://learn.microsoft.com/en-us/cpp/porting/modifying-winver-and-win32-winnt +# https://learn.microsoft.com/en-us/windows/win32/WinProg/using-the-windows-headers +{% set _WIN32_WINNT_WIN7 = '0x0601' %} +{% set NTDDI_WIN7 = '0x06010000' %} +{% set win7_defines = [ + '_WIN32_WINNT={}'.format(_WIN32_WINNT_WIN7), + 'WINVER={}'.format(_WIN32_WINNT_WIN7), + 'NTDDI_VERSION={}'.format(NTDDI_WIN7), +] %} +tools.build:defines={{ win7_defines }} diff --git a/conan_profiles/base/msvc-win8 b/conan_profiles/base/msvc-win8 new file mode 100644 index 0000000..16fcbd1 --- /dev/null +++ b/conan_profiles/base/msvc-win8 @@ -0,0 +1,12 @@ +[conf] +# https://walbourn.github.io/a-brief-history-of-windows-sdks/ +# https://learn.microsoft.com/en-us/cpp/porting/modifying-winver-and-win32-winnt +# https://learn.microsoft.com/en-us/windows/win32/WinProg/using-the-windows-headers +{% set _WIN32_WINNT_WIN8 = '0x0602' %} +{% set NTDDI_WIN8 = '0x06020000' %} +{% set win8_defines = [ + '_WIN32_WINNT={}'.format(_WIN32_WINNT_WIN8), + 'WINVER={}'.format(_WIN32_WINNT_WIN8), + 'NTDDI_VERSION={}'.format(NTDDI_WIN8), +] %} +tools.build:defines={{ win8_defines }} diff --git a/conan_profiles/msvc-x64 b/conan_profiles/msvc-x64 index 9b67e42..4c78792 100644 --- a/conan_profiles/msvc-x64 +++ b/conan_profiles/msvc-x64 @@ -1,4 +1,5 @@ include(base/msvc-intel) +include(base/msvc-win8) [settings] arch=x86_64 diff --git a/conan_profiles/msvc-x64-win7 b/conan_profiles/msvc-x64-win7 new file mode 100644 index 0000000..8f2b7b5 --- /dev/null +++ b/conan_profiles/msvc-x64-win7 @@ -0,0 +1,5 @@ +include(base/msvc-intel) +include(base/msvc-win7) + +[settings] +arch=x86_64 diff --git a/conan_profiles/msvc-x86 b/conan_profiles/msvc-x86 index 92261a9..40ef76f 100644 --- a/conan_profiles/msvc-x86 +++ b/conan_profiles/msvc-x86 @@ -1,4 +1,5 @@ include(base/msvc-intel) +include(base/msvc-win8) [settings] arch=x86 diff --git a/conan_profiles/msvc-x86-win7 b/conan_profiles/msvc-x86-win7 new file mode 100644 index 0000000..5e74924 --- /dev/null +++ b/conan_profiles/msvc-x86-win7 @@ -0,0 +1,5 @@ +include(base/msvc-intel) +include(base/msvc-win7) + +[settings] +arch=x86 From 75c2c1e68c436d5960bd9ce15bef456968c24edc Mon Sep 17 00:00:00 2001 From: Simeon Manolov Date: Tue, 25 Nov 2025 22:36:36 +0200 Subject: [PATCH 05/11] lower compiler version for win7 --- conan_profiles/base/msvc | 1 - conan_profiles/base/msvc-intel | 13 ------------- conan_profiles/base/msvc-win7 | 13 +++++++++++++ conan_profiles/base/msvc-win8 | 13 +++++++++++++ conan_profiles/msvc-arm64 | 2 +- conan_profiles/msvc-x64 | 1 - conan_profiles/msvc-x64-win7 | 1 - conan_profiles/msvc-x86 | 1 - conan_profiles/msvc-x86-win7 | 1 - 9 files changed, 27 insertions(+), 19 deletions(-) delete mode 100644 conan_profiles/base/msvc-intel diff --git a/conan_profiles/base/msvc b/conan_profiles/base/msvc index bf2b1a1..8d6f964 100644 --- a/conan_profiles/base/msvc +++ b/conan_profiles/base/msvc @@ -6,7 +6,6 @@ include(common) compiler=msvc compiler.cppstd={{ vars.cppstd }} compiler.runtime=dynamic -compiler.version=194 os=Windows [options] diff --git a/conan_profiles/base/msvc-intel b/conan_profiles/base/msvc-intel deleted file mode 100644 index 3e9abcc..0000000 --- a/conan_profiles/base/msvc-intel +++ /dev/null @@ -1,13 +0,0 @@ -include(msvc) - -[settings] -# https://blog.knatten.org/2022/08/26/microsoft-c-versions-explained/ -# https://learn.microsoft.com/en-us/cpp/overview/compiler-versions -# https://github.com/actions/runner-images/blob/win25/20251102.77/images/windows/Windows2025-Readme.md#microsoft-visual-c -# v144 / 14.44 / 19.44 -compiler.version=194 -compiler.update=4 - -[conf] -# VS 2022 -tools.microsoft.msbuild:vs_version=17 diff --git a/conan_profiles/base/msvc-win7 b/conan_profiles/base/msvc-win7 index 109c1fd..5d99a7c 100644 --- a/conan_profiles/base/msvc-win7 +++ b/conan_profiles/base/msvc-win7 @@ -1,4 +1,17 @@ +include(msvc) + +[settings] +# https://blog.knatten.org/2022/08/26/microsoft-c-versions-explained/ +# https://learn.microsoft.com/en-us/cpp/overview/compiler-versions +# https://github.com/actions/runner-images/blob/win25/20251102.77/images/windows/Windows2025-Readme.md#microsoft-visual-c +# v142 / 14.29 / 19.29 +compiler.version=192 +compiler.update=9 + [conf] +# VS 2022 +tools.microsoft.msbuild:vs_version=17 + # https://walbourn.github.io/a-brief-history-of-windows-sdks/ # https://learn.microsoft.com/en-us/cpp/porting/modifying-winver-and-win32-winnt # https://learn.microsoft.com/en-us/windows/win32/WinProg/using-the-windows-headers diff --git a/conan_profiles/base/msvc-win8 b/conan_profiles/base/msvc-win8 index 16fcbd1..6727dc4 100644 --- a/conan_profiles/base/msvc-win8 +++ b/conan_profiles/base/msvc-win8 @@ -1,4 +1,17 @@ +include(msvc) + +[settings] +# https://blog.knatten.org/2022/08/26/microsoft-c-versions-explained/ +# https://learn.microsoft.com/en-us/cpp/overview/compiler-versions +# https://github.com/actions/runner-images/blob/win25/20251102.77/images/windows/Windows2025-Readme.md#microsoft-visual-c +# v144 / 14.44 / 19.44 +compiler.version=194 +compiler.update=4 + [conf] +# VS 2022 +tools.microsoft.msbuild:vs_version=17 + # https://walbourn.github.io/a-brief-history-of-windows-sdks/ # https://learn.microsoft.com/en-us/cpp/porting/modifying-winver-and-win32-winnt # https://learn.microsoft.com/en-us/windows/win32/WinProg/using-the-windows-headers diff --git a/conan_profiles/msvc-arm64 b/conan_profiles/msvc-arm64 index f2995cb..797b4ac 100644 --- a/conan_profiles/msvc-arm64 +++ b/conan_profiles/msvc-arm64 @@ -1,4 +1,4 @@ -include(base/msvc) +include(base/msvc-win8) [settings] arch=armv8 diff --git a/conan_profiles/msvc-x64 b/conan_profiles/msvc-x64 index 4c78792..c5be0bf 100644 --- a/conan_profiles/msvc-x64 +++ b/conan_profiles/msvc-x64 @@ -1,4 +1,3 @@ -include(base/msvc-intel) include(base/msvc-win8) [settings] diff --git a/conan_profiles/msvc-x64-win7 b/conan_profiles/msvc-x64-win7 index 8f2b7b5..4c7ba5a 100644 --- a/conan_profiles/msvc-x64-win7 +++ b/conan_profiles/msvc-x64-win7 @@ -1,4 +1,3 @@ -include(base/msvc-intel) include(base/msvc-win7) [settings] diff --git a/conan_profiles/msvc-x86 b/conan_profiles/msvc-x86 index 40ef76f..527f641 100644 --- a/conan_profiles/msvc-x86 +++ b/conan_profiles/msvc-x86 @@ -1,4 +1,3 @@ -include(base/msvc-intel) include(base/msvc-win8) [settings] diff --git a/conan_profiles/msvc-x86-win7 b/conan_profiles/msvc-x86-win7 index 5e74924..596349a 100644 --- a/conan_profiles/msvc-x86-win7 +++ b/conan_profiles/msvc-x86-win7 @@ -1,4 +1,3 @@ -include(base/msvc-intel) include(base/msvc-win7) [settings] From 80b722aeeb8398f69f6402c41a20c32b43de6aa3 Mon Sep 17 00:00:00 2001 From: Simeon Manolov Date: Thu, 27 Nov 2025 07:35:10 +0200 Subject: [PATCH 06/11] try suggested patch from PR review --- .github/workflows/rebuildDependencies.yml | 8 -- conan_patches/onnxruntime/conandata.yml | 4 + conan_patches/onnxruntime/patches/win7.diff | 123 ++++++++++++++++++ conan_patches/onnxruntime/recipe.diff | 12 +- conan_profiles/base/msvc | 1 + conan_profiles/base/{msvc-win7 => msvc-intel} | 1 - conan_profiles/base/msvc-win8 | 25 ---- conan_profiles/msvc-arm64 | 2 +- conan_profiles/msvc-x64 | 2 +- conan_profiles/msvc-x64-win7 | 4 - conan_profiles/msvc-x86 | 2 +- conan_profiles/msvc-x86-win7 | 4 - 12 files changed, 142 insertions(+), 46 deletions(-) create mode 100644 conan_patches/onnxruntime/patches/win7.diff rename conan_profiles/base/{msvc-win7 => msvc-intel} (86%) delete mode 100644 conan_profiles/base/msvc-win8 delete mode 100644 conan_profiles/msvc-x64-win7 delete mode 100644 conan_profiles/msvc-x86-win7 diff --git a/.github/workflows/rebuildDependencies.yml b/.github/workflows/rebuildDependencies.yml index fb045de..a0bb2fa 100644 --- a/.github/workflows/rebuildDependencies.yml +++ b/.github/workflows/rebuildDependencies.yml @@ -45,18 +45,10 @@ jobs: os: windows-latest conan_profiles: '["msvc-x64"]' conan_options: -o "&:target_pre_windows10=True" - - platform: windows-x64-win7 - os: windows-latest - conan_profiles: '["msvc-x64-win7"]' - conan_options: -o "&:target_pre_windows10=True" -o "&:with_onnxruntime=False" - platform: windows-x86 os: windows-latest conan_profiles: '["msvc-x86"]' conan_options: -o "&:target_pre_windows10=True" - - platform: windows-x86-win7 - os: windows-latest - conan_profiles: '["msvc-x86-win7"]' - conan_options: -o "&:target_pre_windows10=True" -o "&:with_onnxruntime=False" - platform: windows-arm64 os: windows-11-arm conan_profiles: '["msvc-arm64"]' diff --git a/conan_patches/onnxruntime/conandata.yml b/conan_patches/onnxruntime/conandata.yml index 3841cee..b4114a2 100644 --- a/conan_patches/onnxruntime/conandata.yml +++ b/conan_patches/onnxruntime/conandata.yml @@ -7,3 +7,7 @@ patches: - patch_file: "patches/msvc-x86.diff" patch_description: | Fixes detection of x86 windows targets during cross-compilation. + - patch_file: "patches/win7.diff" + patch_description: | + Fixes compile errors on for windows 7 targets: + error C3861: 'CreateFile2': identifier not found diff --git a/conan_patches/onnxruntime/patches/win7.diff b/conan_patches/onnxruntime/patches/win7.diff new file mode 100644 index 0000000..648d621 --- /dev/null +++ b/conan_patches/onnxruntime/patches/win7.diff @@ -0,0 +1,123 @@ +--- a/onnxruntime/test/shared_lib/test_model_loading.cc ++++ b/onnxruntime/test/shared_lib/test_model_loading.cc +@@ -227,7 +227,7 @@ using ScopedFileDescriptor = ScopedResource; + + void FileMmap(const ORTCHAR_T* file_path, void*& mapped_base) { + #ifdef _WIN32 +- wil::unique_hfile file_handle{CreateFile2(file_path, GENERIC_READ, FILE_SHARE_READ, OPEN_EXISTING, NULL)}; ++ wil::unique_hfile file_handle{CreateFileW(file_path, GENERIC_READ, FILE_SHARE_READ, nullptr, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, nullptr)}; + ASSERT_TRUE(file_handle.get() != INVALID_HANDLE_VALUE); + + wil::unique_hfile file_mapping_handle{ +--- a/onnxruntime/core/platform/windows/env.cc ++++ b/onnxruntime/core/platform/windows/env.cc +@@ -314,7 +314,7 @@ PIDType WindowsEnv::GetSelfPid() const { + + Status WindowsEnv::GetFileLength(_In_z_ const ORTCHAR_T* file_path, size_t& length) const { + wil::unique_hfile file_handle{ +- CreateFile2(file_path, FILE_READ_ATTRIBUTES, FILE_SHARE_READ, OPEN_EXISTING, NULL)}; ++ CreateFileW(file_path, FILE_READ_ATTRIBUTES, FILE_SHARE_READ, nullptr, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, nullptr)}; + if (file_handle.get() == INVALID_HANDLE_VALUE) { + const auto error_code = GetLastError(); + return ORT_MAKE_STATUS(ONNXRUNTIME, FAIL, "open file ", ToUTF8String(Basename(file_path)), " fail, errcode = ", error_code, " - ", std::system_category().message(error_code)); +@@ -361,7 +361,7 @@ Status WindowsEnv::ReadFileIntoBuffer(_In_z_ const ORTCHAR_T* const file_path, c + ORT_RETURN_IF_NOT(offset >= 0, "offset < 0"); + ORT_RETURN_IF_NOT(length <= buffer.size(), "length > buffer.size()"); + wil::unique_hfile file_handle{ +- CreateFile2(file_path, GENERIC_READ, FILE_SHARE_READ, OPEN_EXISTING, NULL)}; ++ CreateFileW(file_path, GENERIC_READ, FILE_SHARE_READ, nullptr, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, nullptr)}; + if (file_handle.get() == INVALID_HANDLE_VALUE) { + const auto error_code = GetLastError(); + return ORT_MAKE_STATUS(ONNXRUNTIME, FAIL, "open file ", ToUTF8String(Basename(file_path)), " fail, errcode = ", error_code, " - ", std::system_category().message(error_code)); +@@ -414,7 +414,7 @@ Status WindowsEnv::MapFileIntoMemory(_In_z_ const ORTCHAR_T* file_path, + } + + wil::unique_hfile file_handle{ +- CreateFile2(file_path, GENERIC_READ, FILE_SHARE_READ, OPEN_EXISTING, NULL)}; ++ CreateFileW(file_path, GENERIC_READ, FILE_SHARE_READ, nullptr, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, nullptr)}; + if (file_handle.get() == INVALID_HANDLE_VALUE) { + const auto error_code = GetLastError(); + return ORT_MAKE_STATUS(ONNXRUNTIME, FAIL, +@@ -600,16 +600,14 @@ common::Status WindowsEnv::GetCanonicalPath( + PathString& canonical_path) const { + // adapted from MSVC STL std::filesystem::canonical() implementation + // https://github.com/microsoft/STL/blob/ed3cbf36416a385828e7a5987ca52cb42882d84b/stl/inc/filesystem#L2986 +- CREATEFILE2_EXTENDED_PARAMETERS param; +- memset(¶m, 0, sizeof(param)); +- param.dwSize = sizeof(CREATEFILE2_EXTENDED_PARAMETERS); +- param.dwFileFlags = FILE_FLAG_BACKUP_SEMANTICS; +- wil::unique_hfile file_handle{CreateFile2( +- path.c_str(), +- FILE_READ_ATTRIBUTES, +- FILE_SHARE_READ | FILE_SHARE_WRITE | FILE_SHARE_DELETE, +- OPEN_EXISTING, +- ¶m)}; ++ wil::unique_hfile file_handle{CreateFileW( ++ path.c_str(), // LPCWSTR lpFileName ++ FILE_READ_ATTRIBUTES, // DWORD dwDesiredAccess ++ FILE_SHARE_READ | FILE_SHARE_WRITE | FILE_SHARE_DELETE, // DWORD dwShareMode ++ nullptr, // LPSECURITY_ATTRIBUTES lpSecurityAttributes ++ OPEN_EXISTING, // DWORD dwCreationDisposition ++ FILE_FLAG_BACKUP_SEMANTICS, // DWORD dwFlagsAndAttributes ++ nullptr)}; // HANDLE hTemplateFile + + if (file_handle.get() == INVALID_HANDLE_VALUE) { + const auto error_code = GetLastError(); +--- a/onnxruntime/core/platform/windows/env_time.cc ++++ b/onnxruntime/core/platform/windows/env_time.cc +@@ -18,6 +18,7 @@ limitations under the License. + + #include + #include ++#include + #include + #include + #include +@@ -28,14 +29,10 @@ namespace { + + class WindowsEnvTime : public EnvTime { + public: +- WindowsEnvTime() : GetSystemTimePreciseAsFileTime_(GetSystemTimePreciseAsFileTime) {} ++ WindowsEnvTime() = default; + + uint64_t NowMicros() override { +- if (GetSystemTimePreciseAsFileTime_ != NULL) { +- // GetSystemTimePreciseAsFileTime function is only available in latest +- // versions of Windows, so we need to check for its existence here. +- // All std::chrono clocks on Windows proved to return +- // values that may repeat, which is not good enough for some uses. ++ // System time in 100-ns ticks since 1601-01-01 + constexpr int64_t kUnixEpochStartTicks = 116444736000000000i64; + constexpr int64_t kFtToMicroSec = 10; + +@@ -43,7 +40,8 @@ class WindowsEnvTime : public EnvTime { + // just any microseconds because it is often used as an argument + // to TimedWait() on condition variable + FILETIME system_time; +- GetSystemTimePreciseAsFileTime_(&system_time); ++ // Get current system time as FILETIME (available on all supported Windows versions) ++ GetSystemTimeAsFileTime(&system_time); + + LARGE_INTEGER li; + li.LowPart = system_time.dwLowDateTime; +@@ -54,16 +52,11 @@ class WindowsEnvTime : public EnvTime { + li.QuadPart /= kFtToMicroSec; + return li.QuadPart; + } +- using namespace std::chrono; +- return duration_cast(system_clock::now().time_since_epoch()) +- .count(); +- } +- +- void SleepForMicroseconds(int64_t micros) { Sleep(static_cast(micros) / 1000); } + +- private: +- typedef VOID(WINAPI* FnGetSystemTimePreciseAsFileTime)(LPFILETIME); +- FnGetSystemTimePreciseAsFileTime GetSystemTimePreciseAsFileTime_; ++ void SleepForMicroseconds(int64_t micros) { ++ DWORD ms = static_cast((micros + 999) / 1000); ++ Sleep(ms); ++ } + }; + + } // namespace diff --git a/conan_patches/onnxruntime/recipe.diff b/conan_patches/onnxruntime/recipe.diff index 82f0a01..c067315 100644 --- a/conan_patches/onnxruntime/recipe.diff +++ b/conan_patches/onnxruntime/recipe.diff @@ -1,4 +1,5 @@ -index 0757ecd..587294b 100644 +diff --git a/recipes/onnxruntime/all/conanfile.py b/recipes/onnxruntime/all/conanfile.py +index 0757ecdc0..bb8cca8bf 100644 --- a/recipes/onnxruntime/all/conanfile.py +++ b/recipes/onnxruntime/all/conanfile.py @@ -34,6 +34,11 @@ class OnnxRuntimeConan(ConanFile): @@ -13,3 +14,12 @@ index 0757ecd..587294b 100644 } short_paths = True +@@ -47,7 +52,7 @@ class OnnxRuntimeConan(ConanFile): + def _compilers_minimum_version(self): + return { + "Visual Studio": "17", +- "msvc": "193", ++ "msvc": "192", + "gcc": "9", + "clang": "5", + "apple-clang": "10", diff --git a/conan_profiles/base/msvc b/conan_profiles/base/msvc index 8d6f964..bf2b1a1 100644 --- a/conan_profiles/base/msvc +++ b/conan_profiles/base/msvc @@ -6,6 +6,7 @@ include(common) compiler=msvc compiler.cppstd={{ vars.cppstd }} compiler.runtime=dynamic +compiler.version=194 os=Windows [options] diff --git a/conan_profiles/base/msvc-win7 b/conan_profiles/base/msvc-intel similarity index 86% rename from conan_profiles/base/msvc-win7 rename to conan_profiles/base/msvc-intel index 5d99a7c..cc47c4b 100644 --- a/conan_profiles/base/msvc-win7 +++ b/conan_profiles/base/msvc-intel @@ -3,7 +3,6 @@ include(msvc) [settings] # https://blog.knatten.org/2022/08/26/microsoft-c-versions-explained/ # https://learn.microsoft.com/en-us/cpp/overview/compiler-versions -# https://github.com/actions/runner-images/blob/win25/20251102.77/images/windows/Windows2025-Readme.md#microsoft-visual-c # v142 / 14.29 / 19.29 compiler.version=192 compiler.update=9 diff --git a/conan_profiles/base/msvc-win8 b/conan_profiles/base/msvc-win8 deleted file mode 100644 index 6727dc4..0000000 --- a/conan_profiles/base/msvc-win8 +++ /dev/null @@ -1,25 +0,0 @@ -include(msvc) - -[settings] -# https://blog.knatten.org/2022/08/26/microsoft-c-versions-explained/ -# https://learn.microsoft.com/en-us/cpp/overview/compiler-versions -# https://github.com/actions/runner-images/blob/win25/20251102.77/images/windows/Windows2025-Readme.md#microsoft-visual-c -# v144 / 14.44 / 19.44 -compiler.version=194 -compiler.update=4 - -[conf] -# VS 2022 -tools.microsoft.msbuild:vs_version=17 - -# https://walbourn.github.io/a-brief-history-of-windows-sdks/ -# https://learn.microsoft.com/en-us/cpp/porting/modifying-winver-and-win32-winnt -# https://learn.microsoft.com/en-us/windows/win32/WinProg/using-the-windows-headers -{% set _WIN32_WINNT_WIN8 = '0x0602' %} -{% set NTDDI_WIN8 = '0x06020000' %} -{% set win8_defines = [ - '_WIN32_WINNT={}'.format(_WIN32_WINNT_WIN8), - 'WINVER={}'.format(_WIN32_WINNT_WIN8), - 'NTDDI_VERSION={}'.format(NTDDI_WIN8), -] %} -tools.build:defines={{ win8_defines }} diff --git a/conan_profiles/msvc-arm64 b/conan_profiles/msvc-arm64 index 797b4ac..f2995cb 100644 --- a/conan_profiles/msvc-arm64 +++ b/conan_profiles/msvc-arm64 @@ -1,4 +1,4 @@ -include(base/msvc-win8) +include(base/msvc) [settings] arch=armv8 diff --git a/conan_profiles/msvc-x64 b/conan_profiles/msvc-x64 index c5be0bf..9b67e42 100644 --- a/conan_profiles/msvc-x64 +++ b/conan_profiles/msvc-x64 @@ -1,4 +1,4 @@ -include(base/msvc-win8) +include(base/msvc-intel) [settings] arch=x86_64 diff --git a/conan_profiles/msvc-x64-win7 b/conan_profiles/msvc-x64-win7 deleted file mode 100644 index 4c7ba5a..0000000 --- a/conan_profiles/msvc-x64-win7 +++ /dev/null @@ -1,4 +0,0 @@ -include(base/msvc-win7) - -[settings] -arch=x86_64 diff --git a/conan_profiles/msvc-x86 b/conan_profiles/msvc-x86 index 527f641..92261a9 100644 --- a/conan_profiles/msvc-x86 +++ b/conan_profiles/msvc-x86 @@ -1,4 +1,4 @@ -include(base/msvc-win8) +include(base/msvc-intel) [settings] arch=x86 diff --git a/conan_profiles/msvc-x86-win7 b/conan_profiles/msvc-x86-win7 deleted file mode 100644 index 596349a..0000000 --- a/conan_profiles/msvc-x86-win7 +++ /dev/null @@ -1,4 +0,0 @@ -include(base/msvc-win7) - -[settings] -arch=x86 From 2e849f7319380c670937700ebb1f384c075ccbc0 Mon Sep 17 00:00:00 2001 From: Simeon Manolov Date: Thu, 4 Dec 2025 14:10:11 +0200 Subject: [PATCH 07/11] address PR comment --- .github/workflows/rebuildDependencies.yml | 4 ---- 1 file changed, 4 deletions(-) diff --git a/.github/workflows/rebuildDependencies.yml b/.github/workflows/rebuildDependencies.yml index a0bb2fa..1c99a89 100644 --- a/.github/workflows/rebuildDependencies.yml +++ b/.github/workflows/rebuildDependencies.yml @@ -119,7 +119,6 @@ jobs: - name: Build recipes with our patches run: | - set -x cciRepo='conan-center-index' branchName='master' recipePathQt='recipes/qt' @@ -155,8 +154,6 @@ jobs: if [[ $package == qt ]] ; then packagePath="$recipePathQt/5.x.x" - elif [[ $package =~ ^onnx ]] && ${{ contains(matrix.conan_options, 'with_onnxruntime=False') }} ; then - continue else packagePath="recipes/$package/all" fi @@ -228,7 +225,6 @@ jobs: - name: Remove build requirements' binaries run: | - set -x graphFile='graph.json' hostPackagesFile='packages-host.json' buildPackagesFile='packages-build.json' From 9616cbeb4d994743a66fd8d2f8de3d1215aac262 Mon Sep 17 00:00:00 2001 From: Simeon Manolov Date: Mon, 8 Dec 2025 06:34:19 +0200 Subject: [PATCH 08/11] move date/*:use_system_tz_db to conan profile --- conan_patches/onnxruntime/recipe.diff | 12 ------------ conan_profiles/base/common | 5 +++++ 2 files changed, 5 insertions(+), 12 deletions(-) diff --git a/conan_patches/onnxruntime/recipe.diff b/conan_patches/onnxruntime/recipe.diff index c067315..0f8de88 100644 --- a/conan_patches/onnxruntime/recipe.diff +++ b/conan_patches/onnxruntime/recipe.diff @@ -2,18 +2,6 @@ diff --git a/recipes/onnxruntime/all/conanfile.py b/recipes/onnxruntime/all/cona index 0757ecdc0..bb8cca8bf 100644 --- a/recipes/onnxruntime/all/conanfile.py +++ b/recipes/onnxruntime/all/conanfile.py -@@ -34,6 +34,11 @@ class OnnxRuntimeConan(ConanFile): - "fPIC": True, - "with_xnnpack": False, - "with_cuda": False, -+ # Prevents libcurl dependency (fails to build due to system zlib) -+ # NOTE: -+ # 'use_system_tz_db' is specific to date/3.0.1 (version pinned by onnxruntime/1.18.1). -+ # Newer date recipes would need the tz_db=system option instead. -+ "date/*:use_system_tz_db": True, - } - short_paths = True - @@ -47,7 +52,7 @@ class OnnxRuntimeConan(ConanFile): def _compilers_minimum_version(self): return { diff --git a/conan_profiles/base/common b/conan_profiles/base/common index 5179ed5..af8b599 100644 --- a/conan_profiles/base/common +++ b/conan_profiles/base/common @@ -225,3 +225,8 @@ pcre2/*:build_pcre2grep=False sqlite3/*:build_executable=False opusfile/*:http=False zstd/*:build_programs=False + +# Prevents libcurl dependency (fails to build due to system zlib) +# NOTE: use_system_tz_db is specific to date/3.0.1 +# Newer date recipes would need the tz_db=system option instead. +date/*:use_system_tz_db=True From e8f64c67d4d1b530e8e53f67d49b187541a7dea7 Mon Sep 17 00:00:00 2001 From: Simeon Manolov Date: Mon, 8 Dec 2025 12:10:36 +0200 Subject: [PATCH 09/11] address review comments --- .github/workflows/rebuildDependencies.yml | 15 ++++++++------- conan_profiles/base/common | 2 +- 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/.github/workflows/rebuildDependencies.yml b/.github/workflows/rebuildDependencies.yml index 1c99a89..e15c2bf 100644 --- a/.github/workflows/rebuildDependencies.yml +++ b/.github/workflows/rebuildDependencies.yml @@ -225,6 +225,7 @@ jobs: - name: Remove build requirements' binaries run: | + set -x graphFile='graph.json' hostPackagesFile='packages-host.json' buildPackagesFile='packages-build.json' @@ -252,13 +253,13 @@ jobs: # Some are both build and host requirements and must not be removed # => exclude them from the list - cat $buildPackagesFile $hostPackagesFile | jq -s ' - .[0]["Local Cache"] as $build_packages - | (.[1]["Local Cache"] | keys) as $host_package_names - | $build_packages - | with_entries(select(.key as $k | $host_package_names | index($k) == null)) as $packages - | {"Local Cache": $packages} - ' > $buildFilteredPackagesFile + python3 -c ' + import json, sys + build_dict = json.load(open(sys.argv[1]))["Local Cache"] # => {"pkg1": {...}, "pkg2": {...}, ...} + host_list = json.load(open(sys.argv[2]))["Local Cache"] # => ["pkg1", "pkg2", ...] + filtered_dict = {k: v for k, v in build_dict.items() if k not in host_list} + json.dump({"Local Cache": filtered_dict}, open(sys.argv[3], "w")) + ' "$buildPackagesFile" "$hostPackagesFile" "$buildFilteredPackagesFile" conan remove --list "$buildFilteredPackagesFile" --confirm diff --git a/conan_profiles/base/common b/conan_profiles/base/common index af8b599..4729750 100644 --- a/conan_profiles/base/common +++ b/conan_profiles/base/common @@ -226,7 +226,7 @@ sqlite3/*:build_executable=False opusfile/*:http=False zstd/*:build_programs=False -# Prevents libcurl dependency (fails to build due to system zlib) +# Prevents onnxruntime->date->libcurl dependency # NOTE: use_system_tz_db is specific to date/3.0.1 # Newer date recipes would need the tz_db=system option instead. date/*:use_system_tz_db=True From 889c12161a94eb0d02294aade671becd2c173979 Mon Sep 17 00:00:00 2001 From: Simeon Manolov Date: Tue, 9 Dec 2025 14:01:52 +0200 Subject: [PATCH 10/11] remove debug line --- .github/workflows/rebuildDependencies.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/rebuildDependencies.yml b/.github/workflows/rebuildDependencies.yml index e15c2bf..bf5d122 100644 --- a/.github/workflows/rebuildDependencies.yml +++ b/.github/workflows/rebuildDependencies.yml @@ -225,7 +225,6 @@ jobs: - name: Remove build requirements' binaries run: | - set -x graphFile='graph.json' hostPackagesFile='packages-host.json' buildPackagesFile='packages-build.json' From 0fc6e7a5c3c696b6db6294aa4375d4bca8974672 Mon Sep 17 00:00:00 2001 From: Simeon Manolov Date: Tue, 9 Dec 2025 21:01:03 +0200 Subject: [PATCH 11/11] fix comment --- .github/workflows/rebuildDependencies.yml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.github/workflows/rebuildDependencies.yml b/.github/workflows/rebuildDependencies.yml index bf5d122..6f1d175 100644 --- a/.github/workflows/rebuildDependencies.yml +++ b/.github/workflows/rebuildDependencies.yml @@ -140,8 +140,7 @@ jobs: git checkout - # Patch conan recipe to prevent dragging libcurl as a dependency - # (can't be done via VCMI's conanfile as onnxruntime is built beforehand) + # Patch conan recipe to support msvc version 192 git apply --ignore-whitespace ../conan_patches/onnxruntime/recipe.diff # versions must be synced with: conan_patches//conandata.yml