ermig1979 / Simd

C++ image processing and machine learning library with using of SIMD: SSE, AVX, AVX-512, AMX for x86/x64, VMX(Altivec) and VSX(Power7) for PowerPC, NEON for ARM.
http://ermig1979.github.io/Simd
MIT License
2.03k stars 406 forks source link

Android build problems #175

Closed marton78 closed 2 years ago

marton78 commented 2 years ago

Hi,

Can you please help me with building for Android? I set the following variables in my CMakeLists.txt:

set(SIMD_TOOLCHAIN   ${ANDROID_CXX_COMPILER})
set(SIMD_AVX512      OFF CACHE BOOL "AVX-512 (AVX-512F, AVX-512CD, AVX-512VL, AVX-512DQ, AVX-512BW) enable")
set(SIMD_AVX512VNNI  OFF CACHE BOOL "AVX-512-VNNI enable")
set(SIMD_TEST        OFF CACHE BOOL "Test framework enable")
set(SIMD_INFO        ON  CACHE BOOL "Print build information")
set(SIMD_PERF        OFF CACHE BOOL "Internal performance statistic" )
set(SIMD_SHARED      OFF CACHE BOOL "Build as SHARED library" )
set(SIMD_GET_VERSION OFF CACHE BOOL "Get Simd Library version")
set(SIMD_SYNET       OFF CACHE BOOL "Synet optimizations enable")
set(SIMD_INT8_DEBUG  OFF CACHE BOOL "Synet INT8 debug enable" )
set(SIMD_HIDE        ON  CACHE BOOL "Hide internal functions of Simd Library" )
add_subdirectory(external/Simd/prj/cmake)

The build process outputs:

C/C++: prodDebug|armeabi-v7a :Simd Library:
C/C++: prodDebug|armeabi-v7a :Build type: 'Debug'
C/C++: prodDebug|armeabi-v7a :Target: armv7-a
C/C++: prodDebug|armeabi-v7a :Library type: STATIC
C/C++: prodDebug|armeabi-v7a :Toolchain: /Users/marton/Library/Android/sdk/ndk/21.4.7075529/toolchains/llvm/prebuilt/darwin-x86_64/bin/clang++
C/C++: prodDebug|armeabi-v7a :Compiler ID: Clang
C/C++: prodDebug|armeabi-v7a :Compiler Version: 9.0.9
C/C++: prodDebug|armeabi-v7a :Test framework: OFF
C/C++: prodDebug|armeabi-v7a :Performance statistic: OFF
C/C++: prodDebug|armeabi-v7a :Synet: OFF
C/C++: prodDebug|armeabi-v7a :Debug INT8: OFF
C/C++: prodDebug|armeabi-v7a :Hide internal: ON

[...]

C/C++: ninja: Entering directory `/Users/marton/kenkou/SDK-Android/headless-api/.cxx/Debug/70911605/armeabi-v7a'
C/C++: clang++: error: no such file or directory: '7-a'

What am I doing wrong?

ermig1979 commented 2 years ago

Hi!

Could you try to set SIMD_TARGET="arm".

marton78 commented 2 years ago

I have added

+set(SIMD_TARGET      arm)
set(SIMD_TOOLCHAIN   ${ANDROID_CXX_COMPILER})

but it doesn't make a difference.

ermig1979 commented 2 years ago

Can you give me more information about your platform and used toolchain?

marton78 commented 2 years ago

Sure. I'm on Mac OSX and use Android Studio with NDK. The exact toolchain is written above in the bug.

ermig1979 commented 2 years ago

Unfortunately I haven't got access to MacOS. So I can't reproduce this bug. I check correctness of Simd building for Windows and Linux. I'm sorry but the working of the library on another platforms is not guaranteed.