Then I don't understand why the interpreter is called on by Emscripten's Python scripts if it's not needed. Also, I'll see if I can submit the patches upstream (after cleaning them up a little bit).
Now for an Update on getting everything running rootless in the Android Terminal Emulator: Well, I was going get everything to work with Android Terminal Emulator but since I can't cut and paste to Android Emulator I wanted something that can run bash scripts so I went with Terminal IDE (as an added bonus I get vim to edit with). So to get Python working Terminal IDE you need to: 1)Install Python4Android (We only need it to extract neccassary files to the sdcard.) 2)Extract the PythonAPK.apk file then extract ./PythonAPK.apk_FILES/res/raw/python_27.zip and push it's files /data/data/com.spartacusrex.spartacuside/files/ Push the ./PythonAPK.apk_FILES/lib/armeabi/libcom_googlecode_android_scripting_Exec.so to /data/data/com.spartacusrex.spartacuside/lib/ (I believe this is their hack to get the modules working in Android). 3)Push the built fastcomp, node along with Emscripten's files to /data/data/com.spartacusrex.spartacuside/files/ In Terminal IDE's ~/ (/data/data/com.spartacusrex.spartacuside/files/) Put the following .bashrc (I think I might have overwrote the default one when I pushed it there): export PYTHONHOME=/data/data/com.spartacusrex.spartacuside/files/python export PYTHONPATH=/sdcard/com.android.python27/extras/python:/data/data/com. spartacusrex.spartacuside/files/python/lib/python2.7/lib-dynload:/data/data/ com.spartacusrex.spartacuside/files/python/lib/python2.7 export PATH=$PYTHONHOME/bin:$PATH export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/data/data/com.spartacusrex. spartacuside/files/python/lib:/data/data/com.spartacusrex.spartacuside/files /python/lib/python2.7/lib-dynload Then put this in .emscripten: import os LLVM_ROOT='/data/data/com.spartacusrex.spartacuside/files/fastcomp/bin' NODE_JS='/data/data/com.spartacusrex.spartacuside/files/node/bin/node' PYTHON='/data/data/com.spartacusrex.spartacuside/files/python/bin/python' EMSCRIPTEN_ROOT= '/data/data/com.spartacusrex.spartacuside/files/emscripten-1.22.1' TEMP_DIR = '/data/data/com.spartacusrex.spartacuside/files/tmp' COMPILER_ENGINE = NODE_JS JS_ENGINES = [NODE_JS] And everything works just as well as it did in ADB Shell; no root required. Note I've yet to test on an actual phone yet but I'm confident that the Android Emulator's permissions restrictions are being fully applied here based on a test I did by trying to load a path outside of TerminalIDE (and failing). On Sunday, August 31, 2014 5:20:56 PM UTC-5, JF Bastien wrote: > > I may be misunderstanding what you're doing, but if you're generating > JavaScript code then you shouldn't need MC JIT or the interpreter: the > JavaScript code gets emitted from LLVM IR, whereas MC JIT and the > interpreter consume LLVM IR to generate ARM instructions or interpret the > IR. It's a bit clunky that they're built into fastcomp, but disentangling > then from the build wasn't worth it, and it's nice to keep the compiler > fully functional (not just having one possible backend). > > As Alon said it would be great if you sent your patches for the bionic > build to upstream LLVM, feel free to add me to the code review. These parts > probably haven't changed much upstream versus the current fastcomp base > (LLVM 3.4). I'm in the process of updating the branch to LLVM 3.5 (which > should be stable soon), so any patch you send upstream will be very close > to my soon-to-be-update version (and in the future we'll be updating things > more frequently than every LLVM release). > > > On Sat, Aug 30, 2014 at 11:51 PM, jrbrusseau via emscripten-discuss < > [email protected] <javascript:>> wrote: > >> Success!!! >> >> I did a little searching and found out that lli's default jit doesn't >> work very well on Arm so I tried to switch it to using mc-jit instead. It >> took me forever to figure out the python script I needed to edit in order >> to add the -use-mcjit flag to lli (tools/gen_struct_info.py). But sadly I >> got a message saying "No available targets are compatible with this >> triple, see -version for the available targets." I'm not sure why if it was >> to do with how I built fastcomp or if it's just and order version because I >> was under the impression that mc-jit was well supported on armv7-a. But I >> discovered another option in lli: -force-interpreter. So I used that flag >> and it works! I tested hello_world.c again and it generated a working html >> and js file. >> >> Next, I need to get everything to work in Android Terminal Emulator so I >> can actually use it on a phone without rooting. I also would like to figure >> out if I can rebuild fastcomp to support mc-jit. >> >> Just so this post doesn't feel so empty, here's some output from running >> "EMCC_DEBUG=1 python >> /data/data/com.android.python27/files/emscripten-1.22.1/emcc hello_world.c >> -o hello.html" bare in mind this is still the notoriously slow android >> emulator: >> DEBUG root: JAVA not defined in ~/.emscripten, using "java" >> WARNING root: invocation: /data/data/com.android.python27/files/ >> emscripten-1.22.1/emcc hello_world.c -o hello.html (in /data) >> WARNING root: did not see a source tree above the LLVM root directory >> (guessing >> based on directory of /data/data/com.android.python27/files/fastcomp/bin/ >> llc), could not verify version numbers match >> INFO root: (Emscripten: Running sanity checks) >> WARNING root: java does not seem to exist, required for closure compiler >> . -O2 and above will fail. You need to define JAVA in ~/.emscripten >> DEBUG root: compiling to bitcode >> DEBUG root: emcc step "parse arguments and setup" took 0.16 seconds >> DEBUG root: compiling source file: hello_world.c >> DEBUG root: running: /data/data/com.android.python27/files/fastcomp/ >> bin/clang -target asmjs-unknown-emscripten -D__EMSCRIPTEN_major__=1 - >> D__EMSCRIPTEN_minor__=22 -D__EMSCRIPTEN_tiny__=1 -Werror=implicit- >> function-declaration -nostdinc -Xclang -nobuiltininc -Xclang -nostdsysteminc >> -Xclang -isystem/data/data/com.android.python27/files/emscripten-1.22.1/ >> system/local/include -Xclang -isystem/data/data/com.android.python27/ >> files/emscripten-1.22.1/system/include/compat -Xclang -isystem/data/data/ >> com.android.python27/files/emscripten-1.22.1/system/include -Xclang - >> isystem/data/data/com.android.python27/files/emscripten-1.22.1/system/ >> include/emscripten -Xclang -isystem/data/data/com.android.python27/files/ >> emscripten-1.22.1/system/include/libc -Xclang -isystem/data/data/com. >> android.python27/files/emscripten-1.22.1/system/lib/libc/musl/arch/js - >> Xclang -isystem/data/data/com.android.python27/files/emscripten-1.22.1/ >> system/include/gfx -Xclang -isystem/data/data/com.android.python27/files/ >> emscripten-1.22.1/system/include/SDL -Xclang -isystem/data/data/com. >> android.python27/files/emscripten-1.22.1/system/include/libcxx -emit-llvm >> -c hello_world.c -o /data/data/com.android.python27/files/temp/tmpjeesGs/ >> hello_world_0.o >> DEBUG root: emcc step "bitcodeize inputs" took 0.56 seconds >> DEBUG root: emcc step "process inputs" took 0.01 seconds >> DEBUG root: will generate JavaScript >> DEBUG root: including libc >> DEBUG root: emcc step "calculate system libraries" took 0.44 seconds >> DEBUG root: linking: [ >> '/data/data/com.android.python27/files/temp/tmpjeesGs/hello_world_0.o', >> '/data/.emscripten_cache/libc.bc'] >> DEBUG root: emcc: llvm-linking: [ >> '/data/data/com.android.python27/files/temp/tmpjeesGs/hello_world_0.o', >> '/data/.emscripten_cache/libc.bc'] to /data/data/com.android.python27/ >> files/temp/tmpjeesGs/hello.bc >> DEBUG root: emcc step "link" took 0.95 seconds >> DEBUG root: saving intermediate processing steps to /data/data/com. >> android.python27/files/temp/emscripten_temp >> DEBUG root: emcc: LLVM opts: -internalize -internalize-public-api-list >> =main,malloc,free -globaldce -pnacl-abi-simplify-preopt -pnacl-abi- >> simplify-postopt -enable-emscripten-cxx-exceptions >> DEBUG root: emcc step "post-link" took 0.85 seconds >> DEBUG root: LLVM => JS >> DEBUG root: JAVA not defined in ~/.emscripten, using "java" >> DEBUG root: emscript: llvm backend: /data/data/com.android.python27/ >> files/fastcomp/bin/llc /data/data/com.android.python27/files/temp/ >> tmpjeesGs/hello.bc -march=js -filetype=asm -o /data/data/com.android. >> python27/files/temp/emscripten_temp/tmp0lvRuU.4.js -emscripten-assertions >> =1 -emscripten-no-aliasing-function-pointers -O0 -emscripten-max-setjmps= >> 20 >> DEBUG root: emscript: llvm backend took 0.889282941818 seconds >> DEBUG root: emscript: js compiler glue >> DEBUG root: emscript: glue took 15.9426500797 seconds >> DEBUG root: asm text sizes[[105216, 1849, 25], 24, 130, 1210, 0, 0, 29 >> , 274, 234, 679, 1372] >> DEBUG root: emscript: final python processing took 0.154012918472 >> seconds >> DEBUG root: emcc step "emscript (llvm=>js)" took 20.06 seconds >> DEBUG root: emcc step "source transforms" took 0.01 seconds >> DEBUG root: emcc step "js opts" took 0.01 seconds >> DEBUG root: generating HTML >> DEBUG root: emcc step "final emitting" took 4.67 seconds >> DEBUG root: total time: 27.72 seconds >> >> >> >> >> On Thursday, July 17, 2014 7:47:42 AM UTC-5, [email protected] wrote: >> >>> I fascinated with the idea of using Android code editor/IDE (like >>> DroidEdit or AIDE) to program C++ applications while on a phone. >>> >>> I was wondering if there is a way to run emscripten on Android. Can I >>> compile emscripten to android? Has anyone tried it? >>> >>> >>> -- >> You received this message because you are subscribed to the Google Groups >> "emscripten-discuss" group. >> To unsubscribe from this group and stop receiving emails from it, send an >> email to [email protected] <javascript:>. >> For more options, visit https://groups.google.com/d/optout. >> > > -- You received this message because you are subscribed to the Google Groups "emscripten-discuss" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. For more options, visit https://groups.google.com/d/optout.
