[onnxruntime] build error on x64-windows
Package: onnxruntime:[email protected]
Host Environment
- Host: x64-windows
- Compiler: MSVC 19.44.35221.0
- CMake Version: 3.31.10
- vcpkg-tool version: 2025-10-16-71538f2694db93da4668782d094768ba74c45991 vcpkg-scripts version: 656be05781 2025-12-04 (10 hours ago)
To Reproduce
vcpkg install onnxruntime
Failure logs
CMake Warning at ports/onnxruntime/portfile.cmake:2 (message):
The port requires 'onnx' port build with CMake option
ONNX_DISABLE_STATIC_REGISTRATION=ON
Call Stack (most recent call first):
scripts/ports.cmake:206 (include)
Downloading https://github.com/microsoft/onnxruntime/archive/v1.23.2.tar.gz -> microsoft-onnxruntime-v1.23.2.tar.gz
Successfully downloaded microsoft-onnxruntime-v1.23.2.tar.gz
-- Extracting source D:/Coding/vcpkg/downloads/microsoft-onnxruntime-v1.23.2.tar.gz
CMake Error at scripts/cmake/vcpkg_execute_required_process.cmake:127 (message):
Command failed: D:/Coding/vcpkg/downloads/tools/cmake-3.31.10-windows/cmake-3.31.10-windows-x86_64/bin/cmake.exe -E tar xjf D:/Coding/vcpkg/downloads/microsoft-onnxruntime-v1.23.2.tar.gz
Working Directory: D:/Coding/vcpkg/buildtrees/onnxruntime/src/v1.23.2-58f875a967.clean.tmp
Error code: 1
See logs for more information:
D:\Coding\vcpkg\buildtrees\onnxruntime\extract-err.log
Call Stack (most recent call first):
scripts/cmake/vcpkg_extract_source_archive.cmake:120 (vcpkg_execute_required_process)
scripts/cmake/vcpkg_extract_source_archive_ex.cmake:8 (vcpkg_extract_source_archive)
scripts/cmake/vcpkg_from_github.cmake:127 (vcpkg_extract_source_archive_ex)
ports/onnxruntime/portfile.cmake:10 (vcpkg_from_github)
scripts/ports.cmake:206 (include)
D:\Coding\vcpkg\buildtrees\onnxruntime\extract-err.log
CMake Error: Problem with archive_write_header(): Invalid empty pathname
CMake Error: Current file:
CMake Error: Problem extracting tar: D:/Coding/vcpkg/downloads/microsoft-onnxruntime-v1.23.2.tar.gz
I can see many similar issues already exist, all of them are about
Command failed: D:/Coding/vcpkg/downloads/tools/cmake-3.31.10-windows/cmake-3.31.10-windows-x86_64/bin/cmake.exe -E tar xjf D:/Coding/vcpkg/downloads/microsoft-onnxruntime-v1.23.2.tar.gz
But I have tried vcpkg install onnxruntime --x-abi-tools-use-exact-versions and the problem remains.
and I am sure that the downloaded 'microsoft-onnxruntime-v1.23.2.tar.gz' is not corrupted.
I have found the cause:
In the tar.gz file, there is a folder named microsoft-onnxruntime-v1.23.2.tar.gz\onnxruntime-1.23.2\winml\test\collateral\models\UnicodePath\こんにちは maçã.
If you extract it directly from the console using tar xjf microsoft-onnxruntime-v1.23.2.tar.gz, there is no error, but the folder name becomes 銇撱倱銇仭銇_ma莽茫. So, tar xjf in Win10 actually works, but the handling of Unicode paths is not perfect.
If you extract it using cmake-3.31.10-windows-x86_64/bin/cmake.exe -E tar xvf microsoft-onnxruntime-v1.23.2.tar.gz, you will encounter errors like:
CMake Error: Problem with archive_write_header(): Invalid empty pathname
CMake Error: Current file:
CMake Error: Problem extracting tar: microsoft-onnxruntime-v1.23.2.tar.gz
The latest CMake 4.2 also fails on this.
However tar xf works 100% fine with tar from git:
tools\git-2.7.4-windows\usr\bin\tar xf microsoft-onnxruntime-v1.23.2.tar.gz
Maybe CMake should update its own tar.
me too
PS C:\Users\ghost\vcpkg> .\vcpkg.exe install onnxruntime
Computing installation plan...
The following packages will be built and installed:
onnxruntime:[email protected]
Detecting compiler hash for triplet x64-windows...
-- Automatically setting %HTTP(S)_PROXY% environment variables to "127.0.0.1:52345".
Compiler found: C:/Program Files/Microsoft Visual Studio/18/Community/VC/Tools/MSVC/14.50.35717/bin/Hostx64/x64/cl.exe
Restored 0 package(s) from C:\Users\ghost\AppData\Local\vcpkg\archives in 82 us. Use --debug to see more details.
Installing 1/1 onnxruntime:[email protected]...
Building onnxruntime:[email protected]...
CMake Warning at ports/onnxruntime/portfile.cmake:2 (message):
The port requires 'onnx' port build with CMake option
ONNX_DISABLE_STATIC_REGISTRATION=ON
Call Stack (most recent call first):
scripts/ports.cmake:206 (include)
Downloading https://github.com/microsoft/onnxruntime/archive/v1.23.2.tar.gz -> microsoft-onnxruntime-v1.23.2.tar.gz
Successfully downloaded microsoft-onnxruntime-v1.23.2.tar.gz
-- Extracting source C:/Users/ghost/vcpkg/downloads/microsoft-onnxruntime-v1.23.2.tar.gz
CMake Error at scripts/cmake/vcpkg_execute_required_process.cmake:127 (message):
Command failed: "C:/Program Files/CMake/bin/cmake.exe" -E tar xjf C:/Users/ghost/vcpkg/downloads/microsoft-onnxruntime-v1.23.2.tar.gz
Working Directory: C:/Users/ghost/vcpkg/buildtrees/onnxruntime/src/v1.23.2-58f875a967.clean.tmp
Error code: 1
See logs for more information:
C:\Users\ghost\vcpkg\buildtrees\onnxruntime\extract-err.log
Call Stack (most recent call first):
scripts/cmake/vcpkg_extract_source_archive.cmake:120 (vcpkg_execute_required_process)
scripts/cmake/vcpkg_extract_source_archive_ex.cmake:8 (vcpkg_extract_source_archive)
scripts/cmake/vcpkg_from_github.cmake:127 (vcpkg_extract_source_archive_ex)
ports/onnxruntime/portfile.cmake:10 (vcpkg_from_github)
scripts/ports.cmake:206 (include)
error: building onnxruntime:x64-windows failed with: BUILD_FAILED
See https://learn.microsoft.com/vcpkg/troubleshoot/build-failures?WT.mc_id=vcpkg_inproduct_cli for more information.
Elapsed time to handle onnxruntime:x64-windows: 37 s
Please ensure you're using the latest port files with `git pull` and `vcpkg update`.
Then check for known issues at:
https://github.com/microsoft/vcpkg/issues?q=is%3Aissue+is%3Aopen+in%3Atitle+onnxruntime
You can submit a new issue at:
https://github.com/microsoft/vcpkg/issues/new?title=%5Bonnxruntime%5D%20build%20error%20on%20x64-windows&body=Copy%20issue%20body%20from%20C%3A%2FUsers%2Fghost%2Fvcpkg%2Finstalled%2Fvcpkg%2Fissue_body.md
@luncliff @BillyONeal Any ideas? Is it possible to use tar from git to extract the tar.gz file? The CMake tar seems buggy and outdated.