Skip to content

Conversation

@smanolloff
Copy link

@smanolloff smanolloff commented Nov 23, 2025

This PR contains changes needed to migrate MMAI from libtorch to onnxruntime as @Laserlicht suggested here

It adds onnxruntime/1.18.1 requirement with several patches address android-arm64 and windows-x86 compilation errors, as well as conan recipe errors from transitive dependencies.

Please take a look and let me know if you have any comments.

The changes were tested with VCMI (develop branch) on MacOS 15 (arm), Windows 10 (x64), iOS 18 and Android 13 without noticing any issue.

This reverts commit 56f3512.

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
@smanolloff
Copy link
Author

smanolloff commented Nov 25, 2025

Added conan patch which allows to keep macos-intel 10.13 and ios 12.0 min OS versions.
Unfortunately, my attempt at compiling onnxruntime on win7 was not successful: there are other calls such as GetSystemTimePreciseAsFileTime which are not available in the windows 7 API and are seem more difficult to replace. So the win7 / win8 build split remains.

@GeorgeK1ng
Copy link

GeorgeK1ng commented Nov 25, 2025

I think there is issue with FILE_READ_ATTRIBUTES vs GENERIC_READ in W7 patch?

Also keeping 192 which means v142 toolset is needed to keep proper support for builded components for Windows 7.

@smanolloff
Copy link
Author

I think there is issue with FILE_READ_ATTRIBUTES vs GENERIC_READ in W7 patch?

A hasty copy-paste on my side it seems, but that's irrelevant as I reverted the commit due to other compile errors.

Also keeping 192 which means v142 toolset is needed to keep proper support for builded components for Windows 7.

Thanks for pointing that out, I was under the impression "if it compiles, it runs" :) The compiler version is back to 192 for windows 7 now.

@GeorgeK1ng
Copy link

GeorgeK1ng commented Nov 26, 2025

Seems your patches were almost close. This should be Windows 7 compatible patch https://github.com/GeorgeK1ng/vcmi-dependencies/actions/runs/19713613028 - compiled just fine. So you need to grab there Windows 7 patch and recipe ones to allow v142 toolset.

@smanolloff smanolloff force-pushed the mmai branch 2 times, most recently from 0e42897 to 76afc17 Compare November 27, 2025 09:33
@smanolloff
Copy link
Author

smanolloff commented Nov 27, 2025

@GeorgeK1ng Thank you! I have added your suggested patch, finally the win7/win8 split is removed - the last remaining conan change in the PR has been dealt with.

Copy link
Collaborator

@kambala-decapitator kambala-decapitator left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please also update PR description to match the current state

# Some are both build and host requirements and must not be removed
# => exclude them from the list
cat $buildPackagesFile $hostPackagesFile | jq -s '
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

unclear why this is needed, no info in PR description

Copy link
Author

@smanolloff smanolloff Nov 29, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If a package is both a build and a host requirement, the old logic removes it. This leads to Missing prebuilt package error because conan is invoked with build=never in the VCMI build. In this case, zlib and protobuf were build requirements and were removed, which made them "missing" during VCMI build. This graph might help:
graph-msvc-x64.html

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't fully understand why build-context package is required on "client" side if everything has already been built. What's the role of protobuf, is protoc running at CMake configure or build time?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🤷 I am not an onnxruntime developer, I am not aware of such details.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

no, I mean is protobuf used in VCMI CMake project? I don't think I saw anything like that in the PR.

will check about this build-context requirement.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

now I got it: the same packages were in both build and host contexts, hence anything that's in host must be excluded from build.

I think rewriting this "magic" jq expression in Python code would be much easier to understand.

@IvanSavenko
Copy link
Member

@kambala-decapitator any further comments?

@kambala-decapitator
Copy link
Collaborator

will check over the weekend

Copy link
Author

@smanolloff smanolloff left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the feedback. I will apply the suggested changes.

# Some are both build and host requirements and must not be removed
# => exclude them from the list
cat $buildPackagesFile $hostPackagesFile | jq -s '
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🤷 I am not an onnxruntime developer, I am not aware of such details.

@smanolloff
Copy link
Author

@kambala-decapitator I have made the requested changes. Please let me know if you have other suggestions.

# 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
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please also mention that it's about onnxruntime package

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants