Description
Describe the issue
We are using linux-x86 to build for linux-arm64. There is an issue in how cpuinfo is included and built.
See
onnxruntime/cmake/onnxruntime_common.cmake
Line 196 in 739e737
The onnxruntime_target_platform is set up to be aarch64, but this is not checked before running clang -dumpmachine
...which of course doesn't help when running on an x86 machine but targeting an aarch64 machine. ARM64 or ARM need to be defined for the proper inclusion and build of cpuinfo. (See lines 213-221)
One easy way to fix this is to add
if (onnxruntime_target_platform STREQUAL "aarch64")
set(ARM64 TRUE)
before testing the dumpmachine_output.
As an aside, the parameter --arm64 is only checked when building on Windows.
Urgency
No response
Target platform
linux-aarch64
Build script
python3 tools/ci_build/build.py \
--cmake_extra_defines CMAKE_TOOLCHAIN_FILE="<toolchain-targeting-linux-aarch64" \
--build_dir "$build_dir" \
--config $build_type \
--compile_no_warning_as_error \
--build_shared_lib \
--target onnxruntime_perf_test \
--parallel \
--use_cache \
--use_qnn static_lib \
--qnn_home="$QNN_SDK" \
--skip_tests
$@
Note: We have worked around the issue by adding ARM64=TRUE to the cmake_extra_defines.
Error / output
cpuinfo_initialize (and friends) are not found when linking.
Visual Studio Version
No response
GCC / Compiler Version
No response