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 emscripten-disc...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
If LLVM+clang, node.js and python work on android, then emscripten should.- Alon
On Thu, Jul 17, 2014 at 5:47 AM, jrbrusseau via emscripten-discuss <emscripte...@googlegroups.com> 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 emscripten-discuss+unsub...@googlegroups.com.
/home/bobajeff/Downloads/emscripten-fastcomp-1.22.1/lib/Support/Unix/Process.inc:39:24: fatal error: sys/unistd.h: No such file or directory /home/bobajeff/Downloads/emscripten-fastcomp-1.22.1/lib/ExecutionEngine/JIT/JITMemoryManager.cpp:831:66: error: 'open64' was not declared in this scope
--
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 emscripten-disc...@googlegroups.com.
mkdir build
cd build
export PLATFORM_PREFIX=/home/bobajeff/android-ext
export NDK_PATH=/home/bobajeff/Downloads/android-ndk-r10
export NDK_PLATFORM=android-9
export PATH=$PLATFORM_PREFIX/bin:$PATH
make
KEEP_SYMBOLS=1 make install
KEEP_SYMBOLS=1 make DESTDIR=/home/bobajeff/clangandroid install
adt-bundle-linux-x86-20140702/sdk/platform-tools/adb install Term.apk
adt-bundle-linux-x86-20140702/sdk/platform-tools/adb push /home/bobajeff/clangandroid/home/bobajeff/android-ext /data/data/jackpal.androidterm/shared_prefs
adt-bundle-linux-x86-20140702/sdk/platform-tools/adb push system/ /data/data/jackpal.androidterm/shared_prefs
bin/clang --save-temps hello_world.c -isystem/data/data/jackpal.androidterm/shared_prefs/include/libc -E
clang: warning: argument unused during compilation: '--save-temps'
# 1 "hello_world.c"
# 1 "<built-in>" 1
# 1 "<built-in>" 3
# 151 "<built-in>" 3
# 1 "<command line>" 1
# 1 "<built-in>" 2
# 1 "hello_world.c" 2
# 1 "/data/data/jackpal.androidterm/shared_prefs/include/libc/stdio.h" 1 3
# 1 "/data/data/jackpal.androidterm/shared_prefs/include/libc/features.h" 1 3
# 9 "/data/data/jackpal.androidterm/shared_prefs/include/libc/stdio.h" 2 3
# 22 "/data/data/jackpal.androidterm/shared_prefs/include/libc/stdio.h" 3
# 1 "/data/data/jackpal.androidterm/shared_prefs/include/libc/bits/alltypes.h" 1 3
typedef __builtin_va_list va_list;
typedef __builtin_va_list __isoc_va_list;
# 111 "/data/data/jackpal.androidterm/shared_prefs/include/libc/bits/alltypes.h" 3
typedef unsigned int size_t;
# 126 "/data/data/jackpal.androidterm/shared_prefs/include/libc/bits/alltypes.h" 3
typedef int ssize_t;
# 213 "/data/data/jackpal.androidterm/shared_prefs/include/libc/bits/alltypes.h" 3
typedef int off_t;
# 361 "/data/data/jackpal.androidterm/shared_prefs/include/libc/bits/alltypes.h" 3
typedef struct _IO_FILE FILE;
# 23 "/data/data/jackpal.androidterm/shared_prefs/include/libc/stdio.h" 2 3
# 50 "/data/data/jackpal.androidterm/shared_prefs/include/libc/stdio.h" 3
typedef union _G_fpos64_t {
char __opaque[16];
double __align;
} fpos_t;
extern FILE *const stdin;
extern FILE *const stdout;
extern FILE *const stderr;
FILE *fopen(const char *restrict, const char *restrict);
FILE *freopen(const char *restrict, const char *restrict, FILE *restrict);
int fclose(FILE *);
int remove(const char *);
int rename(const char *, const char *);
int feof(FILE *);
int ferror(FILE *);
int fflush(FILE *);
void clearerr(FILE *);
int fseek(FILE *, long, int);
long ftell(FILE *);
void rewind(FILE *);
int fgetpos(FILE *restrict, fpos_t *restrict);
int fsetpos(FILE *, const fpos_t *);
size_t fread(void *restrict, size_t, size_t, FILE *restrict);
size_t fwrite(const void *restrict, size_t, size_t, FILE *restrict);
int fgetc(FILE *);
int getc(FILE *);
int getchar(void);
int ungetc(int, FILE *);
int fputc(int, FILE *);
int putc(int, FILE *);
int putchar(int);
char *fgets(char *restrict, int, FILE *restrict);
char *gets(char *);
int fputs(const char *restrict, FILE *restrict);
int puts(const char *);
int printf(const char *restrict, ...);
int fprintf(FILE *restrict, const char *restrict, ...);
int sprintf(char *restrict, const char *restrict, ...);
int snprintf(char *restrict, size_t, const char *restrict, ...);
int vprintf(const char *restrict, __isoc_va_list);
int vfprintf(FILE *restrict, const char *restrict, __isoc_va_list);
int vsprintf(char *restrict, const char *restrict, __isoc_va_list);
int vsnprintf(char *restrict, size_t, const char *restrict, __isoc_va_list);
int scanf(const char *restrict, ...);
int fscanf(FILE *restrict, const char *restrict, ...);
int sscanf(const char *restrict, const char *restrict, ...);
int vscanf(const char *restrict, __isoc_va_list);
int vfscanf(FILE *restrict, const char *restrict, __isoc_va_list);
int vsscanf(const char *restrict, const char *restrict, __isoc_va_list);
void perror(const char *);
int setvbuf(FILE *restrict, char *restrict, int, size_t);
void setbuf(FILE *restrict, char *restrict);
char *tmpnam(char *);
FILE *tmpfile(void);
FILE *fmemopen(void *restrict, size_t, const char *restrict);
FILE *open_memstream(char **, size_t *);
FILE *fdopen(int, const char *);
FILE *popen(const char *, const char *);
int pclose(FILE *);
int fileno(FILE *);
int fseeko(FILE *, off_t, int);
off_t ftello(FILE *);
int dprintf(int, const char *restrict, ...);
int vdprintf(int, const char *restrict, __isoc_va_list);
void flockfile(FILE *);
int ftrylockfile(FILE *);
void funlockfile(FILE *);
int getc_unlocked(FILE *);
int getchar_unlocked(void);
int putc_unlocked(int, FILE *);
int putchar_unlocked(int);
ssize_t getdelim(char **restrict, size_t *restrict, int, FILE *restrict);
ssize_t getline(char **restrict, size_t *restrict, FILE *restrict);
int renameat(int, const char *, int, const char *);
char *ctermid(char *);
char *tempnam(const char *, const char *);
char *cuserid(char *);
void setlinebuf(FILE *);
void setbuffer(FILE *, char *, size_t);
int fgetc_unlocked(FILE *);
int fputc_unlocked(int, FILE *);
int fflush_unlocked(FILE *);
size_t fread_unlocked(void *, size_t, size_t, FILE *);
size_t fwrite_unlocked(const void *, size_t, size_t, FILE *);
void clearerr_unlocked(FILE *);
int feof_unlocked(FILE *);
int ferror_unlocked(FILE *);
int fileno_unlocked(FILE *);
int getw(FILE *);
int putw(int, FILE *);
char *fgetln(FILE *, size_t *);
int asprintf(char **, const char *, ...);
int vasprintf(char **, const char *, __isoc_va_list);
# 2 "hello_world.c" 2
int main() {
printf("hello, world!\n");
return 0;
}
To unsubscribe from this group and stop receiving emails from it, send an email to emscripten-discuss+unsub...@googlegroups.com.
../configure --enable-optimized --disable-assertions --enable-targets=host,js --host=arm-linux-androideabi --prefix=$PLATFORM_PREFIX
#retrieve the files
git clone https://android.googlesource.com/toolchain/binutils
wget http://ftp.gnu.org/gnu/texinfo/texinfo-5.2.tar.gz
tar -zxvf texinfo-5.2.tar.gz
#set the environment variables
export PLATFORM_PREFIX=/home/bobajeff/android-ext
export NDK_PATH=/home/bobajeff/Downloads/android-ndk-r10
export NDK_PLATFORM=android-9
export PATH=$PLATFORM_PREFIX/bin:$PATH
#build and install texinfo to NDK toolchain
cd texinfo-5.2
mkdir build
cd build
../configure --host=arm-linux-androideabi --prefix=$PLATFORM_PREFIX
make
make install
#build binutils
cd ../../binutils/binutils-2.21
#assuming the patch file is in the same location you cloned binutils
patch -p1 < ../../binutils-2.21_sloppyquick_android_compat.diff
mkdir build
cd build
../configure --host=arm-linux-androideabi --prefix=$PLATFORM_PREFIX --with-sysroot
make
#Note: I'd already deleted the fastcomp files that were in clangandroid previously
make DESTDIR=/home/bobajeff/clangandroid install
#push binutils.
adt-bundle-linux-x86-20140702/sdk/platform-tools/adb push /home/bobajeff/clangandroid/home/bobajeff/android-ext /data/data/jackpal.androidterm/shared_prefs
#push the libraries
adt-bundle-linux-x86-20140702/sdk/platform-tools/adb push /home/bobajeff/android-ext/sysroot/usr/lib /data/data/jackpal.androidterm/shared_prefs/lib
adt-bundle-linux-x86-20140702/sdk/platform-tools/adb push /home/bobajeff/android-ext/lib/gcc/arm-linux-androideabi/4.6/armv7-a/libgcc.a /data/data/jackpal.androidterm/shared_prefs/lib
cd /data/data/jackpal.androidterm/shared_prefs/
bin/clang --save-temps hello_world.c -isystem/data/data/jackpal.androidterm/shared_prefs/include/libc --sysroot=/data/data/jackpal.androidterm/shared_prefs/
#get and extract the official python-2.7.5
wget http://www.python.org/ftp/python/2.7.5/Python-2.7.5.tar.bz2
tar -jxf Python-2.7.5.tar.bz2
#set toolchain environment variable
export PLATFORM_PREFIX=/home/bobajeff/android-ext
export NDK_PATH=/home/bobajeff/Downloads/android-ndk-r10
export NDK_PLATFORM=android-9
export PATH=$PLATFORM_PREFIX/bin:$PATH
#build python for build system
./configure
make
mv python python_for_build
mv Parser/pgen Parser/pgen_for_build
#clean up and apply patches and changes
make distclean
#assuming you all ready copied over the patch
patch -pl < Python-2.7.5-android-compat.diff
#note: this patch incorporates much but not all of whats in the Python-2.7.5-xcompile.patch (specifically it doesn't apply the Modules/Setup.dist changes since those caused problems)
#build python for the host/target system
./configure --host=arm-linux-androideabi --build=i686-pc-linux-gnu --prefix=$PLATFORM_PREFIX --disable-ipv6 ac_cv_file__dev_ptmx=no ac_cv_file__dev_ptc=no ac_cv_have_long_long_format=yes
make
#again I already cleaned out clangandroid folder before doing this
make DESTDIR=/home/bobajeff/clangandroid install
adt-bundle-linux-x86-20140702/sdk/platform-tools/adb push /home/bobajeff/clangandroid/home/bobajeff/android-ext /data/data/jackpal.androidterm/shared_prefs
cd /data/data/jackpal.androidterm/shared_prefs
bin/python HelloWorld.py
#download nodejs
wget http://nodejs.org/dist/v0.11.9/node-v0.11.9.tar.gz
#export toolchain environment variable
export PLATFORM_PREFIX=/home/bobajeff/android-ext
export NDK_PATH=/home/bobajeff/Downloads/android-ndk-r10
export NDK_PLATFORM=android-9
export PATH=$PLATFORM_PREFIX/bin:$PATH
#make necessary alterations for toolchain
cd node-v0.11.9
# assuming your using the same version of NDK I am and have the patch for it
patch -p1 < node-v0.11.9-android-ndk-r10.diff
#build and install nodejs
source ./android-configure $NDK_PATH
make
make DESTDIR=/home/bobajeff/clangandroid install
adt-bundle-linux-x86-20140702/sdk/platform-tools/adb push /home/bobajeff/clangandroid/usr/local /data/data/jackpal.androidterm/shared_prefs
cd /data/data/jackpal.androidterm/shared_prefs
bin/node hello.js
adt-bundle-linux-x86-20140702/sdk/platform-tools/adb push empush_folder/ /data/data/jackpal.androidterm/shared_prefs
cd /data/data/jackpal.androidterm/shared_prefs
bin/python2 emscripten-1.22.1/emcc -v
[2] + Stopped (signal) bin/python emscripten-1.22.1/emcc -v
[1] - Segmentation fault bin/python emscripten-1.22.1/emcc -v
import os
LLVM_ROOT='/data/data/com.android.python27/files/fastcomp/bin'
NODE_JS='/data/data/com.android.python27/files/node/bin/node'
PYTHON='/data/data/com.android.python27/files/python/bin/python'
EMSCRIPTEN_ROOT='/data/data/com.android.python27/files/emscripten-1.22.1'
TEMP_DIR = '/data/data/com.android.python27/files/temp'
COMPILER_ENGINE = NODE_JS
JS_ENGINES = [NODE_JS]
export PYTHONHOME=/data/data/com.android.python27/files/python
export PYTHONPATH=/sdcard/com.android.python27/extras/python:/data/data/com.android.python27/files/python/lib/python2.7/lib-dynload:/data/data/com.android.python27/files/python/lib/python2.7
export PATH=$PYTHONHOME/bin:$PATH
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/data/data/com.android.python27/files/python/lib:/data/data/com.android.python27/files/python/lib/python2.7/lib-dynload
cd ~ #that's /data/
python /data/data/com.android.python27/files/emscripten-1.22.1/emcc hello_world.c
This is the result:
Stack dump:
0. Program arguments: /data/data/com.android.python27/files/fastcomp/bin/lli /data/tmpbqS_LI.ll
1. Running pass 'ARM Machine Code Emitter' on function '@main'
FAIL: Running the generated program failed!
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
--
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 emscripten-disc...@googlegroups.com.
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
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]
To unsubscribe from this group and stop receiving emails from it, send an email to emscripten-discuss+unsub...@googlegroups.com.