Wanting to exercise purely native unit tests on the Android device, I
had the idea of cross-compiling GoogleTest (aka, gtest see
http://code.google.com/p/googletest/wiki/Primer ) using the NDK tool
chain as described in /android-ndk-r5b/docs/STANDALONE-
TOOLCHAIN.html. Then push the executable across using adb and run
from the adb shell. This should work right?
I got close (I think) but stumped by object files and library with no
symbols. I used 'nm' to look at things and it is always coming up
empty. I am using the Makefile provided with gtest though tinkered
with it more and more trying to fix the problem.
I tried using both methods in 'STANDALONE-TOOLCHAIN.html', the latter
(3/ Invoking the compiler, the easy way) is the one that got me this
close:
Jim-Walseths-MacBook-Pro:make jimwalseth$ make sample1_unittest
arm-linux-androideabi-g++ -I../include -g -mthumb -c ../samples/
sample1.cc
arm-linux-androideabi-g++ -I../include -g -mthumb -c ../samples/
sample1_unittest.cc
arm-linux-androideabi-g++ -I../include -I.. -g -mthumb -c \
../src/gtest-all.cc
arm-linux-androideabi-g++ -I../include -I.. -g -mthumb -c \
../src/gtest_main.cc
ar -rv gtest_main.a gtest-all.o gtest_main.o
ar: creating archive gtest_main.a
a - gtest-all.o
a - gtest_main.o
arm-linux-androideabi-g++ -I../include -g -mthumb sample1.o
sample1_unittest.o gtest_main.a -o sample1_unittest
gtest_main.a: could not read symbols: Archive has no index; run ranlib
to add one
collect2: ld returned 1 exit status
make: *** [sample1_unittest] Error 1