Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Build armeabi-v7a with Android NDK #135

Open
TreeGrow opened this issue Mar 15, 2022 · 3 comments
Open

Build armeabi-v7a with Android NDK #135

TreeGrow opened this issue Mar 15, 2022 · 3 comments

Comments

@TreeGrow
Copy link

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
Copy link
Author

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
Copy link
Member

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

@TreeGrow
Copy link
Author

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?

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

No branches or pull requests

2 participants