[CMake] Problems with cross compile for android
Daniel Kroker
dk at ventas.de
Wed May 22 08:23:07 EDT 2019
Hello,
i have some problems with cross compile for android.
i need to build libssh for android.
If i run CMake like:
cmake .. -DCMAKE_SYSTEM_NAME=Android
-DCMAKE_ANDROID_STANDALONE_TOOLCHAIN=/home/da/Android/standalone-toolchain-4.9
-DCMAKE_SYSTEM_VERSION=21
i get the following error:
-mtune=xscale -funwind-tables -no-canonical-prefixes -g -fPIE -pie
-Wl,--gc-sections -Wl,-z,nocopyreloc
CMakeFiles/cmTC_88c04.dir/testCCompiler.c.o -o cmTC_88c04
/home/da/Android/standalone-toolchain-4.9/lib/gcc/arm-linux-androideabi/4.9.x/../../../../arm-linux-androideabi/bin/ld:
error: cannot open crtbegin_dynamic.o: No such file or directory
/home/da/Android/standalone-toolchain-4.9/lib/gcc/arm-linux-androideabi/4.9.x/../../../../arm-linux-androideabi/bin/ld:
error: cannot open crtend_android.o: No such file or directory
external/jemalloc/src/jemalloc.c:1422: error: undefined reference to
'pthread_atfork'
external/jemalloc/src/jemalloc.c:1422: error: undefined reference to
'pthread_atfork'
external/jemalloc/src/jemalloc.c:1422: error: undefined reference to
'pthread_atfork'
external/jemalloc/src/jemalloc.c:1422: error: undefined reference to
'pthread_atfork'
external/jemalloc/src/jemalloc.c:1358: error: undefined reference to
'atexit'
clang80: error: linker command failed with exit code 1 (use -v to
see invocation)
make[1]: *** [CMakeFiles/cmTC_88c04.dir/build.make:87: cmTC_88c04]
Error 1
make[1]: Leaving directory
'/home/da/Downloads/libssh-0.7.4/build/CMakeFiles/CMakeTmp'
make: *** [Makefile:121: cmTC_88c04/fast] Error 2
if i run
cmake .. -G "Unix Makefiles" -DCMAKE_BUILD_TYPE=Release
-DCMAKE_SYSTEM_NAME=Android
-DCMAKE_TOOLCHAIN_FILE=$ANDROID_NDK_ROOT/build/cmake/android.toolchain.cmake
-DANDROID_STL_TYPE=gnustl_static -DCMAKE_SYSTEM_VERSION=21
-DANDROID_TOOLCHAIN=clang -DANDROID_PLATFORM=android-21
-DANDROID_ABI=arm64-v8a
i get the following message:
-- Performing Test HAVE_COMPILER__FUNCTION__ - Failed
-- Check if the system is big endian
-- Searching 16 bit integer
-- Looking for sys/types.h
-- Looking for sys/types.h - not found
-- Looking for stdint.h
-- Looking for stdint.h - not found
-- Looking for stddef.h
-- Looking for stddef.h - not found
-- Check size of unsigned short
-- Check size of unsigned short - failed
-- Check size of unsigned int
-- Check size of unsigned int - failed
-- Check size of unsigned long
-- Check size of unsigned long - failed
CMake Error at /usr/share/cmake-3.13/Modules/TestBigEndian.cmake:49
(message):
no suitable type found
Call Stack (most recent call first):
ConfigureChecks.cmake:271 (test_big_endian)
CMakeLists.txt:80 (include)
looks like that he doesnt find any header file.
Whats the best way to cross compile under linux for android?
Thanks for any suggestions.
Regards
Daniel
More information about the CMake
mailing list