From 83bea428ae643743c49e5ea5fdc3ae06c96799db Mon Sep 17 00:00:00 2001 From: Mariusz Reichert Date: Tue, 21 Apr 2026 15:55:59 +0200 Subject: [PATCH] onnxruntime: patch CoreML EP external data path bug (port-version 4) --- .../18-fix-coreml-external-data-path.patch | 15 +++++++++++++++ ports/onnxruntime/portfile.cmake | 1 + ports/onnxruntime/vcpkg.json | 2 +- versions/o-/onnxruntime.json | 5 +++++ 4 files changed, 22 insertions(+), 1 deletion(-) create mode 100644 ports/onnxruntime/18-fix-coreml-external-data-path.patch diff --git a/ports/onnxruntime/18-fix-coreml-external-data-path.patch b/ports/onnxruntime/18-fix-coreml-external-data-path.patch new file mode 100644 index 0000000..61582b0 --- /dev/null +++ b/ports/onnxruntime/18-fix-coreml-external-data-path.patch @@ -0,0 +1,15 @@ +diff --git a/onnxruntime/core/framework/tensorprotoutils.cc b/onnxruntime/core/framework/tensorprotoutils.cc +index e36be3f..6336e3 100644 +--- a/onnxruntime/core/framework/tensorprotoutils.cc ++++ b/onnxruntime/core/framework/tensorprotoutils.cc +@@ -359,7 +359,9 @@ Status TensorProtoWithExternalDataToTensorProto( + } else { + // Load the external data into memory + std::vector unpacked_data; +- ORT_RETURN_IF_ERROR(ReadExternalDataForTensor(ten_proto, model_path, unpacked_data)); ++ // ReadExternalDataForTensor expects a directory, not a file path. ++ // Fix: use parent_path() to match UnpackInitializerData(). See microsoft/onnxruntime#28005. ++ ORT_RETURN_IF_ERROR(ReadExternalDataForTensor(ten_proto, model_path.parent_path(), unpacked_data)); + + // Set the raw data in the new tensor + onnxruntime::utils::SetRawDataInTensorProto(result, unpacked_data.data(), unpacked_data.size()); diff --git a/ports/onnxruntime/portfile.cmake b/ports/onnxruntime/portfile.cmake index d5150cb..d2d696b 100644 --- a/ports/onnxruntime/portfile.cmake +++ b/ports/onnxruntime/portfile.cmake @@ -25,6 +25,7 @@ if(VCPKG_CMAKE_SYSTEM_NAME STREQUAL "Darwin" OR VCPKG_CMAKE_SYSTEM_NAME STREQUAL "07-fix-coreml-export.patch" "08-fix-coreml-proto-include.patch" "13-fix-coreml-availability.patch" + "18-fix-coreml-external-data-path.patch" ) endif() diff --git a/ports/onnxruntime/vcpkg.json b/ports/onnxruntime/vcpkg.json index 76e8af6..8316616 100644 --- a/ports/onnxruntime/vcpkg.json +++ b/ports/onnxruntime/vcpkg.json @@ -2,7 +2,7 @@ "$schema": "https://raw.githubusercontent.com/microsoft/vcpkg-tool/main/docs/vcpkg.schema.json", "name": "onnxruntime", "version": "1.24.2", - "port-version": 3, + "port-version": 4, "description": "ONNX Runtime: cross-platform, high performance ML inferencing and training accelerator", "homepage": "https://onnxruntime.ai/", "license": "MIT", diff --git a/versions/o-/onnxruntime.json b/versions/o-/onnxruntime.json index 50f9fe0..2822dcc 100644 --- a/versions/o-/onnxruntime.json +++ b/versions/o-/onnxruntime.json @@ -1,5 +1,10 @@ { "versions": [ + { + "git-tree": "e33569d0c4b4b745e3bd4d5b681ec2f0220fb56b", + "version": "1.24.2", + "port-version": 4 + }, { "git-tree": "23a8fa3703552cda8888d59cccc2872da882c41a", "version": "1.24.2",