Doug - Neat! I took a different approach and got picolisp working on my
android phone and kindle fire by using terminal-ide (
http://code.google.com/p/terminal-ide/ ) as the shell and cross compiling
picoLisp with gcc-arm-linux-gnueabi on my linux box. I can post the binary
if anyone is interested.

I didn't do anything with it because terminal-ide (and it's busybox
compile) couldn't resolve DNS (didn't include a /etc/resolv.conf) and I
lost root at the time with my kindle fire.
http://forum.xda-developers.com/showthread.php?p=22103721 . I was
originally going to play around with scripting out something that involved
the network.

I kicked around shelling out to a java app to resolve DNS but then moved
onto another project. Other than that it worked great. It was nice to have
VIM around as well. I may go back to it at some point but didn't really
have a practical use for it on android especially since I could just ssh
into my linux if I wanted to tinker with picoLisp.

Thanks for sharing

On Mon, Feb 20, 2012 at 9:46 PM, Doug Snead <semaphore_2...@yahoo.com>wrote:

> More android + picolisp fun, this time with the full picolisp.  Using the
> android SDK and NDK, I hacked a picolisp/src/makefile to work for android's
> arm processor like this:
>
> ----------- makefile -----------
> [snip]
>
> CFLAGS := -c -O2  -pipe \
>         -falign-functions=64 -fomit-frame-pointer -fno-strict-aliasing \
>         -W -Wimplicit -Wreturn-type -Wunused -Wformat \
>         -Wuninitialized -Wstrict-prototypes \
>         -D_GNU_SOURCE  -D_FILE_OFFSET_BITS=64
> # ?? had: -m32
>
> NDK_ROOT = ~/android/android-ndk-r7
> NDK_BIN =
> $(NDK_ROOT)/toolchains/arm-linux-androideabi-4.4.3/prebuilt/linux-x86/bin
> SYS_ROOT = $(NDK_ROOT)/platforms/android-8/arch-arm/
> CC = $(NDK_BIN)/arm-linux-androideabi-gcc --sysroot=$(SYS_ROOT)
> LD = $(NDK_BIN)/arm-linux-androideabi-ld
> AR = $(NDK_BIN)/arm-linux-androideabi-ar
> RANLIB = $(NDK_BIN)/arm-linux-androideabi-ranlib
> STRIP = $(NDK_BIN)/arm-linux-androideabi-strip
>
>         OS = Arm
>         PICOLISP-FLAGS = -m32 -rdynamic
>         LIB-FLAGS = -lc -lm -ldl
>         DYNAMIC-LIB-FLAGS = -m32 -shared -export-dynamic
>
> [snip]
> ---------------------
>
> Then (to my surprise) picolisp and dynamic libraries were made,
>
> # file ../bin/picolisp  ../lib/ext  ../lib/ht ../lib/z3d
> ../bin/picolisp: ELF 32-bit LSB executable, ARM, version 1 (SYSV),
> dynamically linked (uses shared libs), stripped
> ../lib/ext:      ELF 32-bit LSB shared object, ARM, version 1 (SYSV),
> stripped
> ../lib/ht:       ELF 32-bit LSB shared object, ARM, version 1 (SYSV),
> stripped
> ../lib/z3d:      ELF 32-bit LSB shared object, ARM, version 1 (SYSV),
> stripped
>
> So far so good...
>
> Using this android approach generally,
>
>
> http://gimite.net/en/index.php?Run%20native%20executable%20in%20Android%20App
>
> I placed the picolisp executable in the assets dir and at run-time, copy
> it from assets to /data/data/ in the right place for that app.
>
> Since I'm using the emulator and I know where the executable was placed, I
> can run it using adb, for some command-line tests:
>
> # adb shell /data/data/com.mytest/picolisp '-de foo ("X") (println "X")'
> '-foo 123' -bye
> 123
>
> # adb shell /data/data/com.mytest/picolisp '-de foo ("X") (println (* "X"
> 2))'  '-foo 123' -bye
> 246
>
> # adb shell /data/data/com.mytest/picolisp '-de foo ("X") (println (* "X"
> 2))'  '-foo 12345' -bye
> 24690
>
> A bit cumbersome having to unpack the executable and other files from the
> app's .apk (zip archive) to run it ... but it can be done.  And no fiddling
> with bits ... no changes to the (full picolisp) source at all.
>
> Next step is to try to similarly unpack all the libraries and see if a
> picolisp database server application can be run. Then more testing.  And
> use that with android's browser, all within an android app.
>
> But I'm very confident that the full picolisp will run on the android from
> what I see so far!
>
> There are ways to call java from C also, so that opens up possibilities of
> using android java libraries from android picolisp too.
>
> Cheers,
>
> Doug
>
> --
> UNSUBSCRIBE: mailto:picolisp@software-lab.de?subjectUnsubscribe
>

Reply via email to