手机编译安装r-base

2022-04-08 00:00:00 专区 订阅 付费 编译 新建


为什么要手动编译?因为一不小心执行  pkg update , R 就运行不了了,提了ISSUE 很久才能解决。所以要手动编译。如果会交叉编译就更好了,直接在X86平台上编译成能在aarch64平台上安装包。安桌手机就是aarch64平台。

pkg uninstall r-base
pkg uninstall r-cran*
apt autoremove

新建编译安装目录

cd ~
mkdir -p $PREFIX/local/R-4.1.2

新建下载目录 并下载 r-base 源码,解压

mkdir Downloads
cd Downloads
wget https://mirrors.tuna.tsinghua.edu.cn/CRAN/src/base/R-4/R-4.1.2.tar.gz
tar -xzvf R-4.1.2.tar.gz


进入目录开始进行configure

cd R-4.1.2
CFLAGS=" -fno-PIC -fnoPIC"$CFLAGS" -fno-PIC -fnoPIC"CXXGLAGS=$CFLAGS
./configure --prefix=/data/data/com.termux/files/usr/local/R-4.1.2 --enable-R-shlib


Configure后是这样的


接着 make make install 成功安装完成

makemake install

添加变量 到 .bashrc文件

PATH=/data/data/com.termux/files/usr/local/R-4.1.2/bin:$PATH


$ termux-infoApplication version:0.117Packages CPU architecture:aarch64Subscribed repositories:# sources.listdeb https://mirrors.tuna.tsinghua.edu.cn/termux/apt/termux-main stable main# game-repo (sources.list.d/game.list)deb https://packages.termux.org/apt/termux-games games stable# science-repo (sources.list.d/science.list)deb https://packages.termux.org/apt/termux-science science stableUpdatable packages:All packages up to dateAndroid version:10Kernel build information:Linux localhost 4.9.186-perf-g10c9743 #1 SMP PREEMPT Tue Mar 24 16:26:14 CST 2020 aarch64 AndroidDevice manufacturer:XiaomiDevice model:MIX 2S

来源 https://mp.weixin.qq.com/s/11mA5A3STkEFF_kCFzifCQ

相关文章