Hello!
I just succesfully compiled gtest for ndk-r5b, trying to use it.
I created a standalone toolchain, then edited gtest's Makefile variables like this:
**************
# this file is in ${project}/test-ndk/make subdir
# gtest dir is ${project}/test-ndk/
MY_JNI_DIR = ../../jni/mylib
CXX = ../my-toolchain/bin/arm-linux-androideabi-g++
AR = ../my-toolchain/bin/arm-linux-androideabi-ar
# Flags passed to the preprocessor.
CPPFLAGS += -I$(GTEST_DIR)/include -I$(MY_JNI_DIR)
# Flags passed to the C++ compiler.
CXXFLAGS += -Wall -Wextra -mthumb -Os
LDFLAGS += -llog -ljnigraphics
*************
As can be told from above, my app uses libjnigraphics.
So I wrote a basic test case and now I get this when compiling with the above makefile:
../my-toolchain/bin/arm-linux-androideabi-g++ -I../gtest/include -I../../jni/mylib -Wall -Wextra -mthumb -Os -llog -ljnigraphics mylib.o mylib_test.o gtest_main.a -o myapp_test
../my-toolchain/bin/../lib/gcc/arm-linux-androideabi/4.4.3/../../../../arm-linux-androideabi/bin/ld: warning: libandroid_runtime.so, needed by ../my-toolchain/bin/../sysroot/usr/lib/libjnigraphics.so, not found (try using -rpath or -rpath-link)
../my-toolchain/bin/../lib/gcc/arm-linux-androideabi/4.4.3/../../../../arm-linux-androideabi/bin/ld: warning: libskia.so, needed by ../my-toolchain/bin/../sysroot/usr/lib/libjnigraphics.so, not found (try using -rpath or -rpath-link)
../my-toolchain/bin/../sysroot/usr/lib/libjnigraphics.so: undefined reference to `SkBitmap::unlockPixels() const'
../my-toolchain/bin/../sysroot/usr/lib/libjnigraphics.so: undefined reference to `GraphicsJNI::getNativeBitmap(_JNIEnv*, _jobject*)'
../my-toolchain/bin/../sysroot/usr/lib/libjnigraphics.so: undefined reference to `SkBitmap::lockPixels() const'
Only starting with NDK, so not sure where to dig from here.
I guess the problem is that ld path isn't set up correctly, but I can't figure out what the proper one would be. I did some grepping for android_runtime in $NDK dir, no hints found so far...
The very basic test with -ljnigraphics removed from LDFLAGS compiles fine and runs fine when copied to device.
Also jni/mylib which is actually linking to -ljnigraphics and uses Android.mk builds fine with ndk-build run from project dir.
Any hints?