Android/NSPR
From MozillaWiki
< Android
NSPR for Android
Building
As mentioned on the main Android page, create a nspr directory, configure nspr, and build it:
$ mkdir nspr $ cd nspr $ $moz/nsprpub/configure \ --target=arm-android-eabi \ --with-android-ndk=$NDK $ make -s
bug 542113 "Add support for building NSPR on Android" resolves some build issues.
Tests
If you get errors compiling NSPR tests, this patch from the bug 542113 may help.
Running
Copy all the tests to /data/local/nspr on the device or emulator using
$ adb push $file /data/local/nspr
Copy the libraries as well:
$ adb push $objdir/nsprpub/pr/src/libnspr4.so /data/local/nspr $ adb push $objdir/nsprpub/lib/libc/src/libplc4.so /data/local/nspr
Run the shell, add the nspr dir to the LD_LIBRARY_PATH environment variable, and you are ready to go:
$ adb shell # cd /data/local/nspr # LD_LIBRARY_PATH=$LD_LIBRARY_PATH:. # ./env -d PASSED
Results
Detailed test results are here.
Debugging
Use gdb/gdbserver as described on the main page, just instead of attaching to a process, run it with gdbserver:
(Host)$ adb forward tcp:1234 tcp:1234 (Device)# gdbserver localhost:1234 ./<testname> (Host)$ $NDK/build/prebuilt/linux-x86/arm-eabi-4.2.1/bin/arm-eabi-gdb (Host)(gdb) FILE <testname> (Host)(gdb) target remote localhost:1234