问题
I need to invoke the Rebol language interpreter from the Android Terminal Emulator as a command that runs a script file (e.g. rebol script-name.reb
).
So I'm not looking for an .APK app that launches only into the Rebol REPL, like that in https://github.com/angerangel/r3bazaar. I'd like to be able to run it as a shell command.
回答1:
I cross-compiled r3 for android and seems ok.
Here is the binary and here the source.
Thanks @HostileFork for help and sources.
回答2:
You can do this with a native ARM build of Rebol that hasn't been put into an .APK or worrying about SL4A. However, you can't use the current ARM console binary on http://rebolsource.net because Android uses (amongst other things) a a custom C library called "Bionic". (Thanks for pointing this out, @earl.) So you'll have to build with a toolchain targeting Android specifically, such as the Android NDK.
Once you have that binary, the trick is to get from downloading it to being able to put execution privileges on it. Android mounts /sdcard/
without allowing you to set execution privileges. The workaround from Building and running native code utilities on Android without ADB or rooting is to create a new file with cat
(as opposed to copying) under /data/
.
For an "it would work if not for Bionic/etc." version: I used the browser to download the ARM console binary from http://rebolsource.net. Following the directions from the document, I did:
$ cd /data/data/jackpal.androidterm/shared_prefs
$ cat /sdcard/Download/r3-linux-arm-g4d9840f.bin > rebol
$ chmod 755 ./rebol
$ ls -l
This successfully got me to see:
-rw-rw---- u0_a102 u0_a102 148 2014-02-02 20:35 jackpal.androidterm_preferences.xml
-rwxr-xr-x u0_a102 u0_a102 444960 2014-02-02 21:15 rebol
But due to the library issues, when I run ./rebol
I get:
/system/bin/sh: /data/data/jackpal.androidterm/shared_prefs/rebol: No such file or directory
With a proper NDK build, that should work.
来源:https://stackoverflow.com/questions/21518156/how-to-invoke-rebol-interpreter-from-the-android-terminal-emulator