[QNN EP] Fix cmake build crashes in static_lib mode and ort_core prebuilt path - #744
Merged
Merged
Conversation
qti-mbadnara
requested review from
qti-ashwshan,
qti-chuteng,
qti-jkilpatrick,
qti-kromero,
qti-yuduo,
tirupath-qti and
yath1
as code owners
August 19, 2026 01:31
Collaborator
|
I thought QNN EP is always built as shared lib. Why |
Collaborator
Author
It is used for Android builds. |
qti-yuduo
approved these changes
Aug 19, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Fixes two cmake defects that crash the build when using
--use_qnn static_libvia the ort_core prebuilt path: an unguardedcmake -E copyon an emptyQNN_LIB_FILESlist, and a missing--skip_submodule_syncflag that causesbuild.pyto rungit submodule syncon a non-git source tree.Motivation & Context
Both issues manifest only in the
onnxruntime_prebuilt.cmakeExternalProject build path and were worked around locally by commenting out code and manually patching the build command — fragile fixes invisible to CI.Issue 1 — empty
QNN_LIB_FILEScopyQNN_LIB_FILESis populated by afile(GLOB ...)inside anif(MSVC OR Linux)block inmicrosoft/onnxruntime cmake/CMakeLists.txt. On Android / static_lib builds that block is skipped, leaving the variable undefined (empty list).In
cmake/onnxruntime_unittests.cmake(upstream), the block that copies QNN libraries to the Java native-test directory is guarded only byif(onnxruntime_USE_QNN). WithQNN_LIB_FILESempty, CMake generates:cmake -E copyrequires at least one source argument before the destination. With zero sources it prints its usage banner and exits non-zero, crashing the build.Issue 2 — missing
--skip_submodule_syncort_core is fetched as a URL zip archive (
microsoft/onnxruntime v1.27.0) — the extracted tree has no.gitdirectory.build.pyunconditionally runsgit submodule sync --recursiveregardless, crashing with:build.pyexposes--skip_submodule_syncexactly for this scenario, but it was never appended toORT_BUILD_COMMANDin this repo.