Skip to content

Fix ARM64 cross-compilation target platform detection#27309

Open
ingyukoh wants to merge 1 commit intomicrosoft:mainfrom
ingyukoh:fix/arm64-cross-compile-cpuinfo
Open

Fix ARM64 cross-compilation target platform detection#27309
ingyukoh wants to merge 1 commit intomicrosoft:mainfrom
ingyukoh:fix/arm64-cross-compile-cpuinfo

Conversation

@ingyukoh
Copy link
Contributor

When cross-compiling from x86 to ARM64, CMAKE_SYSTEM_PROCESSOR may incorrectly reflect the
build host instead of the target architecture. This causes cpuinfo linking errors:

cpuinfo_initialize (and friends) are not found when linking

Description

When CMAKE_CROSSCOMPILING is true, detect the target architecture from the cross-compiler's
-dumpmachine output instead of relying on CMAKE_SYSTEM_PROCESSOR.

Motivation and Context

Fixes #25201

Users cross-compiling with aarch64-linux-gnu-gcc would get the wrong
onnxruntime_target_platform because the code used the build host's architecture instead of
the compiler's target.

When cross-compiling, CMAKE_SYSTEM_PROCESSOR may incorrectly reflect
the build host instead of the target. Use the compiler's -dumpmachine
output to detect the actual target architecture.

Fixes microsoft#25201
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.

[Build] Issue when cross-compiling for ARM64

1 participant