Supporting ONNX Runtime on Windows 7
The project involves AI-related components and relies on ONNX Runtime. After downloading a precompiled version from the official website, it ran successfully during testing.
However, during actual deployment, it was found that Windows 7 was not supported, with errors indicating missing api-ms-core-...
DLLs. As a result, I had to modify ONNX Runtime manually.
ONNX Runtime : A cross-platform, high-performance machine learning inferencing and training accelerator. https://github.com/microsoft/onnxruntime
The last version supporting Windows 7 and Windows 8 is likely v1.11.1 , as later versions do not provide support. This creates challenges for client software requiring a minimum of Windows 7 & Windows 8 . A modified version has been created to ensure compatibility with these operating systems. For commercial use, please contact 526926911@qq.com for authorization.
- Windows 7 (2009)
- Windows 8 (2012)
- Windows 8.1 (2013)
- Windows 10 (2015)
- Windows 11 (2021)
- Windows Server versions : 2008, 2012, 2016, 2019, 2022, etc.
https://github.com/microsoft/onnxruntime/releases/tag/v1.20.0
- onnxruntime-win-x64-1.20.0.zip
- onnxruntime-win-x86-1.20.0.zip
The runtime environment has been modified based on these two versions to include full support.
Issue: api-ms-win-core-heap-l2-1-0.dll missing on Windows Server 2012 R2 #15025 microsoft/onnxruntime#15025
"Windows builds are not compatible with Windows 8.x in this release. Please use v1.11 for now." Great news! Dependency Walker analysis of
onnxruntime.dll v1.11.1
shows no dependency onapi-ms-win-core-heap-l2-1-0.dll
.
Solution: You can implement the required support for Windows 7 yourself. Detailed instructions are available here: https://github.com/yycmagic/onnxruntime-for-win7
Reference:
- Avoid using LocalFree on FormatMessageW buffer #10796 microsoft/onnxruntime#10796
To ensure full functionality, several additional adjustments are required.
Sample code and examples can be found here:
Command:
fns_candy_style_transfer.exe <model_path> <input_image_path> <output_image_path> [cpu|cuda|dml]
Unsigned PE Files, The following files are unsigned:
-
x64\api-ms-win-core-heap-l2-1-0.dll
-
x64\api-ms-win-core-libraryloader-l1-2-0.dll
-
x64\api-ms-win-core-path-l1-1-0.dll
-
x64\api-ms-win-eventing-provider-l1-1-0.dll
-
x64\fastkn64.dll
-
x64\onnxrt64.dll
-
x64\onnxruntime.dll
-
x86\api-ms-win-core-heap-l2-1-0.dll
-
x86\api-ms-win-core-libraryloader-l1-2-0.dll
-
x86\api-ms-win-core-path-l1-1-0.dll
-
x86\api-ms-win-eventing-provider-l1-1-0.dll
-
x86\fastkn32.dll
-
x86\onnxrt32.dll
-
x86\onnxruntime.dll
- Download onnxruntime-win-x64-1.20.0.zip and onnxruntime-win-x86-1.20.0.zip .
- Place the files in the project root and extract them.
Directory structure:
onnxruntime-win-1.20.0\demo\fns_candy_style_transfer.sln
onnxruntime-win-x64-1.20.0\include
onnxruntime-win-x86-1.20.0\include
onnxruntime-win-x64-1.20.0.zip
onnxruntime-win-x86-1.20.0.zip
- Open
fns_candy_style_transfer.sln
and build the project.
Build output:
onnxruntime-win-1.20.0\demo\Debug\fns_candy_style_transfer.exe
onnxruntime-win-1.20.0\demo\Debug64\fns_candy_style_transfer.exe
onnxruntime-win-1.20.0\demo\Release\fns_candy_style_transfer.exe
onnxruntime-win-1.20.0\demo\Release64\fns_candy_style_transfer.exe
- Run the executable:
fns_candy_style_transfer.exe candy.onnx image.png result.png