在android系统中安装gcc,达到在android系统本地编译应用程序进行开发的目的

本文档介绍了如何在Android系统上安装R,包括解决依赖问题、权限限制和存储空间问题。通过下载特定的tar.bz2文件并进行一系列配置,可以实现R的安装和包的管理。此外,还提供了针对低数据容量设备的解决方案,以及编译R的步骤。

 

FROM: http://rwiki.sciviews.org/doku.php?id=getting-started:installation:android

R on Android

As Android is similar to Linux, you can easily install R on it.
But building requires a lot of patching as the libc is bionic (reduced).

[edit] 2011 Aug 1: Fixed Rscript’s R_HOME (was /data/local/work/R lol)
Also fixed sysutils.c(libR.so) (and littler.c)’s hardcoded /tmp to /data/local/gcc/tmp. You need root to mkdir /tmp on Android.
[edit2] 2011 Aug 5: Fixed lib/R/library/*’s permission. Now non-root user can untar.
[edit3] 2011 Aug 6: Fixed R/Rcmd/...’s /sbin/bash dependency (now they use /system/bin/sh correctly).
You should update to r1a2.

Limitation

  1. “Rscript -e EXPR” uses tmp file(), which uses /tmp. You need root to create that dir. You should write file or you can use “r -e EXPR”.
  2. You need busybox’s uname and rm in $PATH.

Install R

get 3 files:

then (here I suppose you have GNU tar or busybox):

adb shell mkdir /data/local/gcc
adb push android_gcc_r2a.tar.bz2 /data/local/gcc
adb push android_gcc_supplement.tar.bz2 /data/local/gcc
adb push android_R_r1a2.tar.bz2 /data/local/gcc
adb shell
cd /data/local/gcc
tar xjf android_gcc_r2a.tar.bz2
tar xjf android_gcc_supplement.tar.bz2
tar xjf android_R_r1a2.tar.bz2

finally (writing to bashrc is recommended):

export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/data/local/gcc/lib
export PATH=$PATH:/data/local/gcc/bin

This consumes 170MB, so be careful if your Android’s /data is small.

If you still want to compile and install R by yourself check Build R section.

Install R packages

As only R binary is provided by this package, you have to install packages in R way via install.packages().

install.packages()

For non-basic packages, you can normally use install.packages() as it is described elsewhere.
If your device isn’t rooted, you will have to “chmod -R o+rx /data/local/gcc/lib/R/library”.

Update R packages

Packages can be updated via R’s update.packages() function.

Miscellaneous

Build R

TBA. There are too many patches around glob/wctrans/tre_regwcomp. I had to kill WCHAR support to make grep() work.

  1. execute “remount -o remount,rw,exec /mnt/sdcard /mnt/sdcard” (bah, this requires root)
  2. execute “/sdcard/R-2.13.0/configure –prefix=/data/local/gcc –enable-R-shlib –with-system-zlib –with-system-bzlib –with-system-pcre –without-x”
  3. src/include/config.h #define HAVE_LOCALE_H 1 -> remove
  4. src/include/config.h #define HAVE_LIBC_STACK_END 1 -> remove
  5. src/include/Rconfig.h #define SUPPORT_UTF8 1 -> remove
  6. src/include/Rconfig.h #define SUPPORT_MBCS 1 -> remove
  7. src/extra/blas/Makefile: change: “SOURCES = xerbla.c blas00.c blas.f cmplxblas.f” change: “blas_OBJS=blas.o cmplxblas.o xerbla.o blas00.o”
  8. src/modules/lapack/Makefile: change: “SOURCES_C = blas00.c xerbla.c Lapack.c” change: “LIBOBJECTS = $(LIBSOURCES:.f=.o) xerbla.o”
  9. Fix Makeconf’s abs_top_builddir
  10. execute “make”

Perhaps you don’t have enough space to execute “make install”. So modify bin/R and etc/{ldpaths,Renviron} by hand.

Well, this configured R is compatible with http://dirk.eddelbuettel.com/code/littler.html .

Running R

Once installed, open up a console and type:

R

very low /data capacity

If you have VERY low /data capacity and 170MB is too much, there is a workaround if your Android is rooted.

  1. execute “mount /sdcard/android_gcc_R.ext2 /data/local/gcc”

Of course your kernel must have ext2(or ext3) support... Aww only if vfat had symlink stuff...

 

 

评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
红包 添加红包
表情包 插入表情
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值