eProsima / Micro-XRCE-DDS

An XRCE DDS implementation. Looking for commercial support? Contact info@eprosima.com
Apache License 2.0
157 stars 17 forks source link

Build armeabi-v7a with Android NDK #135

Open TreeGrow opened 2 years ago

TreeGrow commented 2 years ago

Error

1647309507(1)

Build Environment

ubuntu 20.04

Order

git clone https://github.com/eProsima/Micro-XRCE-DDS.git cd Micro-XRCE-DDS-Agent mkdir build && cd build

cmake \ -DCMAKE_SYSTEM_NAME=Android \ -DCMAKE_TOOLCHAIN_FILE=/home/lxc/Android/Sdk/ndk/22.1.7171670/build/cmake/android.toolchain.cmake \ -DANDROID_PLATFORM=21 \ -DCMAKE_ANDROID_NDK=/home/lxc/Android/Sdk/ndk/22.1.7171670 \ -DCMAKE_ANDROID_STL_TYPE=c++_shared \ -DANDROID_STL=c++_shared \ -DCMAKE_MAKE_PROGRAM=/home/lxc/ninja \ -DCMAKE_BUILD_TYPE=Debug \ -DCMAKE_SYSTEM_NAME=Android \ -DCMAKE_SYSTEM_VERSION=21 \ -DANDROID_NATIVE_API_LEVEL=21 \ -DEPROSIMA_BUILD_EXAMPLES=ON \ -GNinja \ -DBUILD_SHARED_LIBS=ON \ -DCMAKE_ANDROID_NDK_TOOLCHAIN_VERSION=clang \ -DANDROID_TOOLCHAIN=clang \ -DCMAKE_GENERATOR="Ninja" \ -DTHIRDPARTY=ON \ -DANDROID_FUNCTION_LEVEL_LINKING=OFF \ -DANDROID_ABI=armeabi-v7a \ -DCMAKE_ANDROID_ARCH_ABI=armeabi-v7a \ ..

ninja

When tested, ANDROID_ABI builds when set to X86, armeabi reports an error

TreeGrow commented 2 years ago

Error Log

Compiling the C compiler identification source file "CMakeCCompilerId.c" failed. Compiler: /home/lxc/Android/Sdk/ndk/22.1.7171670/toolchains/llvm/prebuilt/linux-x86_64/bin/clang Build flags: -g;-DANDROID;-fdata-sections;-ffunction-sections;-funwind-tables;-fstack-protector-strong;-no-canonical-prefixes;-D_FORTIFY_SOURCE=2;-march=armv7-a;-mthumb;-Wformat;-Werror=format-security; Id flags:

The output was: 1 clang: warning: argument unused during compilation: '-mthumb' [-Wunused-command-line-argument] error: unknown target CPU 'armv7-a' note: valid target CPU values are: nocona, core2, penryn, bonnell, atom, silvermont, slm, goldmont, goldmont-plus, tremont, nehalem, corei7, westmere, sandybridge, corei7-avx, ivybridge, core-avx-i, haswell, core-avx2, broadwell, skylake, skylake-avx512, skx, cascadelake, cooperlake, cannonlake, icelake-client, icelake-server, tigerlake, knl, knm, k8, athlon64, athlon-fx, opteron, k8-sse3, athlon64-sse3, opteron-sse3, amdfam10, barcelona, btver1, btver2, bdver1, bdver2, bdver3, bdver4, znver1, znver2, x86-64

Compiling the C compiler identification source file "CMakeCCompilerId.c" failed. Compiler: /home/lxc/Android/Sdk/ndk/22.1.7171670/toolchains/llvm/prebuilt/linux-x86_64/bin/clang Build flags: -g;-DANDROID;-fdata-sections;-ffunction-sections;-funwind-tables;-fstack-protector-strong;-no-canonical-prefixes;-D_FORTIFY_SOURCE=2;-march=armv7-a;-mthumb;-Wformat;-Werror=format-security; Id flags: -c

The output was: 1 clang: warning: argument unused during compilation: '-mthumb' [-Wunused-command-line-argument] error: unknown target CPU 'armv7-a' note: valid target CPU values are: nocona, core2, penryn, bonnell, atom, silvermont, slm, goldmont, goldmont-plus, tremont, nehalem, corei7, westmere, sandybridge, corei7-avx, ivybridge, core-avx-i, haswell, core-avx2, broadwell, skylake, skylake-avx512, skx, cascadelake, cooperlake, cannonlake, icelake-client, icelake-server, tigerlake, knl, knm, k8, athlon64, athlon-fx, opteron, k8-sse3, athlon64-sse3, opteron-sse3, amdfam10, barcelona, btver1, btver2, bdver1, bdver2, bdver3, bdver4, znver1, znver2, x86-64

Compiling the C compiler identification source file "CMakeCCompilerId.c" failed. Compiler: /home/lxc/Android/Sdk/ndk/22.1.7171670/toolchains/llvm/prebuilt/linux-x86_64/bin/clang Build flags: -g;-DANDROID;-fdata-sections;-ffunction-sections;-funwind-tables;-fstack-protector-strong;-no-canonical-prefixes;-D_FORTIFY_SOURCE=2;-march=armv7-a;-mthumb;-Wformat;-Werror=format-security; Id flags: -Aa

The output was: 1 clang: warning: argument unused during compilation: '-mthumb' [-Wunused-command-line-argument] clang: warning: argument unused during compilation: '-Aa' [-Wunused-command-line-argument] error: unknown target CPU 'armv7-a' note: valid target CPU values are: nocona, core2, penryn, bonnell, atom, silvermont, slm, goldmont, goldmont-plus, tremont, nehalem, corei7, westmere, sandybridge, corei7-avx, ivybridge, core-avx-i, haswell, core-avx2, broadwell, skylake, skylake-avx512, skx, cascadelake, cooperlake, cannonlake, icelake-client, icelake-server, tigerlake, knl, knm, k8, athlon64, athlon-fx, opteron, k8-sse3, athlon64-sse3, opteron-sse3, amdfam10, barcelona, btver1, btver2, bdver1, bdver2, bdver3, bdver4, znver1, znver2, x86-64

Compiling the C compiler identification source file "CMakeCCompilerId.c" failed. Compiler: /home/lxc/Android/Sdk/ndk/22.1.7171670/toolchains/llvm/prebuilt/linux-x86_64/bin/clang Build flags: -g;-DANDROID;-fdata-sections;-ffunction-sections;-funwind-tables;-fstack-protector-strong;-no-canonical-prefixes;-D_FORTIFY_SOURCE=2;-march=armv7-a;-mthumb;-Wformat;-Werror=format-security; Id flags: -D__CLASSIC_C__

The output was: 1 clang: warning: argument unused during compilation: '-mthumb' [-Wunused-command-line-argument] error: unknown target CPU 'armv7-a' note: valid target CPU values are: nocona, core2, penryn, bonnell, atom, silvermont, slm, goldmont, goldmont-plus, tremont, nehalem, corei7, westmere, sandybridge, corei7-avx, ivybridge, core-avx-i, haswell, core-avx2, broadwell, skylake, skylake-avx512, skx, cascadelake, cooperlake, cannonlake, icelake-client, icelake-server, tigerlake, knl, knm, k8, athlon64, athlon-fx, opteron, k8-sse3, athlon64-sse3, opteron-sse3, amdfam10, barcelona, btver1, btver2, bdver1, bdver2, bdver3, bdver4, znver1, znver2, x86-64

Compiling the C compiler identification source file "CMakeCCompilerId.c" failed. Compiler: /home/lxc/Android/Sdk/ndk/22.1.7171670/toolchains/llvm/prebuilt/linux-x86_64/bin/clang Build flags: -g;-DANDROID;-fdata-sections;-ffunction-sections;-funwind-tables;-fstack-protector-strong;-no-canonical-prefixes;-D_FORTIFY_SOURCE=2;-march=armv7-a;-mthumb;-Wformat;-Werror=format-security; Id flags: --target=arm-arm-none-eabi;-mcpu=cortex-m3

The output was: 1 ld.lld: error: unable to find library -lc ld.lld: error: unable to find library -lm ld.lld: error: unable to find library -lclang_rt.builtins-arm clang: error: ld.lld command failed with exit co

pablogs9 commented 2 years ago

It seems that your compiler does not recognize your CPU architecture: error: unknown target CPU 'armv7-a'

TreeGrow commented 2 years ago

Hi @pablogs9 , I tried to compile arm64 V8a architecture, the compilation is completed successfully, but the generated so file is not arm64 V8a architecture, but x86-x64. What may be the problem? Is the configuration not effective? Or there is a problem with some parameter passing in the project. I want to know where the configuration file is?