crystax / android-platform-ndk

CrystaX NDK - Native Development Kit for Android
https://www.crystax.net/android/ndk
302 stars 52 forks source link

arm-linux-androideabi/bin/ld: error: cannot find -lcrystax #11

Closed pcboy closed 8 years ago

pcboy commented 8 years ago

Hi,

I'm trying to compile some open source code using CMake. I'm using the toolchain.cmake in $NDK/cmake/ by simply doing: cmake -DCMAKE_TOOLCHAIN_FILE=$NDK/cmake/toolchain.cmake -DANDROID_ABI=armeabi-v7a Sadly it doesn't work. During the CMake configure I get this error:

Compiling the CXX compiler identification source file "CMakeCXXCompilerId.cpp" failed.
Compiler: /Users/admin/Downloads/crystax-ndk-10.3.2/toolchains/arm-linux-androideabi-5/prebuilt/darwin-x86_64/bin/arm-linux-androideabi-g++ 
Build flags: -fexceptions;-frtti;-Wno-psabi;--sysroot=/Users/admin/Downloads/crystax-ndk-10.3.2/platforms/android-16/arch-arm;-funwind-tables;-finline-limit=64;-fsigned-char;-no-canonical-prefixes;-march=armv7-a;-mhard-float;-mfpu=vfpv3-d16;-fdata-sections;-ffunction-sections;-Wa,--noexecstack;
Id flags: 

The output was:
1
/Users/admin/Downloads/crystax-ndk-10.3.2/toolchains/arm-linux-androideabi-5/prebuilt/darwin-x86_64/bin/../lib/gcc/arm-linux-androideabi/5.4/../../../../arm-linux-androideabi/bin/ld: **error: cannot find -lcrystax**
/Users/admin/Downloads/crystax-ndk-10.3.2/toolchains/arm-linux-androideabi-5/prebuilt/darwin-x86_64/bin/../lib/gcc/arm-linux-androideabi/5.4/../../../../arm-linux-androideabi/bin/ld: error: /var/folders/gv/x9c3ckh14bq9c1m_y84k6lz40000gp/T//cc4ceuIb.o uses VFP register arguments, output does not
/Users/admin/Downloads/crystax-ndk-10.3.2/toolchains/arm-linux-androideabi-5/prebuilt/darwin-x86_64/bin/../lib/gcc/arm-linux-androideabi/5.4/../../../../arm-linux-androideabi/bin/ld: error: /Users/admin/Downloads/crystax-ndk-10.3.2/toolchains/arm-linux-androideabi-5/prebuilt/darwin-x86_64/bin/../lib/gcc/arm-linux-androideabi/5.4/armv7-a/hard/libgcc.a(unwind-arm.o) uses VFP register arguments, output does not
/Users/admin/Downloads/crystax-ndk-10.3.2/toolchains/arm-linux-androideabi-5/prebuilt/darwin-x86_64/bin/../lib/gcc/arm-linux-androideabi/5.4/../../../../arm-linux-androideabi/bin/ld: error: /Users/admin/Downloads/crystax-ndk-10.3.2/toolchains/arm-linux-androideabi-5/prebuilt/darwin-x86_64/bin/../lib/gcc/arm-linux-androideabi/5.4/armv7-a/hard/libgcc.a(pr-support.o) uses VFP register arguments, output does not
/Users/admin/Downloads/crystax-ndk-10.3.2/platforms/android-16/arch-arm/usr/lib/crtbegin_dynamic.o:crtbrand.c:function _start: error: undefined reference to '__libc_init'
/Users/admin/Downloads/crystax-ndk-10.3.2/platforms/android-16/arch-arm/usr/lib/crtbegin_dynamic.o:crtbrand.c:function atexit: error: undefined reference to '__cxa_atexit'
/Volumes/HD2/cislave/workspace/ndk-build-all/HOST/darwin/LABEL/ndk-build/toolchain/build/../gcc/gcc-5/libgcc/unwind-arm-common.inc:289: error: undefined reference to 'abort'
/Volumes/HD2/cislave/workspace/ndk-build-all/HOST/darwin/LABEL/ndk-build/toolchain/build/../gcc/gcc-5/libgcc/unwind-arm-common.inc:346: error: undefined reference to 'memcpy'
/Volumes/HD2/cislave/workspace/ndk-build-all/HOST/darwin/LABEL/ndk-build/toolchain/build/../gcc/gcc-5/libgcc/unwind-arm-common.inc:376: error: undefined reference to 'memcpy'
/Volumes/HD2/cislave/workspace/ndk-build-all/HOST/darwin/LABEL/ndk-build/toolchain/build/../gcc/gcc-5/libgcc/unwind-arm-common.inc:505: error: undefined reference to 'abort'
/Volumes/HD2/cislave/workspace/ndk-build-all/HOST/darwin/LABEL/ndk-build/toolchain/build/../gcc/gcc-5/libgcc/config/arm/pr-support.c:384: error: undefined reference to 'abort'

I get the same error either on Linux and OSX. To install crystax NDK I simply extracted the crystax-ndk-10.3.2-b903-darwin-x86_64.tar.xz archive. I'm using version 10.3.2-b903. I tried to do an export LDFLAGS="-L$NDK/sources/crystax/libs/armeabi-v7a/" sadly it didn't work. :(

pcboy commented 8 years ago

I achieved to compile my code by generating a standalone toolchain first with: $NDK/build/tools/make-standalone-toolchain.sh --platform=android-9 --install-dir=/tmp/my-toolchain And then: cmake -DCMAKE_TOOLCHAIN_FILE=$NDK/cmake/toolchain.cmake -DANDROID_ABI=armeabi-v7a -DCMAKE_CXX_FLAGS="-std=c++11" -DBUILD_WITH_STANDALONE_TOOLCHAIN=ON -DANDROID_STANDALONE_TOOLCHAIN=/tmp/my-toolchain/

Note: when I generated the standalone toolchain the boost headers were not copied to my toolchain. So I had to do: cp -rf $NDK/boost/1.61.0/include/boost/ /tmp/my-toolchain/sysroot/usr/include/