ARM-software / ComputeLibrary

The Compute Library is a set of computer vision and machine learning functions optimised for both Arm CPUs and GPUs using SIMD technologies.
MIT License
2.81k stars 774 forks source link

Build fails with android-ndk-r27b toolkit #1141

Open culhatsker opened 1 week ago

culhatsker commented 1 week ago

Version: main, v24.08

Platform: armv7a

Operating System: Android

Problem description:

ComputeLibrary wouldn't build for neon=1 arch=armv7a os=android with Android NDK r27b (LTS, latest at this moment), r26d (prevoius LTS)

Build system would report

In file included from src/core/CPP/CPPTypes.cpp:31:
./src/core/NEON/kernels/arm_gemm/utils.hpp:186:11: error: unknown register name 'x0' in asm
  186 |         : "x0"
      |           ^
./src/core/NEON/kernels/arm_gemm/utils.hpp:203:11: error: unknown register name 'x1' in asm
  203 |         : "x1"
      |           ^

How to reproduce (on Linux):

# assuming we're in the sources directory and scons is installed

# download Android NDK:
wget https://dl.google.com/android/repository/android-ndk-r27b-linux.zip
unzip android-ndk-r27b-linux.zip
export ANDROID_NDK=$(realpath ./android-ndk-r27b)

# start the build
scons neon=1 arch=armv7a estate=32 --jobs=16 os=android build=cross_compile \
compiler_prefix="$ANDROID_NDK/toolchains/llvm/prebuilt/linux-x86_64/bin/" \
extra_cxx_flags=--target=armv7-none-linux-androideabi21

We did not encounter this issue before v24.08

So I suppose the issue is in these changes https://github.com/ARM-software/ComputeLibrary/compare/v24.07...v24.08 More precisely, in file utils.hpp around line 174 There used to be a #if defined(__aarch64__) condition for the code that is failing now.

ramelg01 commented 3 days ago

Hi @culhatsker
This patch solves the problem.