将R语言安装包拖入虚拟机中Ubuntu Kylin 16.04系统中:
然后查找语言包的位置:
解压文件:
进入解压后的文件夹:
源码编译安装第一步:检查环境以及依赖
报错排查:
缺少编译器,解决办法:
另外还需要安装gcc等工具:
解决方案:安装readline
解决方案:安装libxt-dev
解决方案:源码编译安装zlib
解决方案:源码编译安装bzip2
解决方案:安装xz
解决方案:pcre版本过低,安装pcre-8.41.tar.gz
错误总算排查完了,继续安装R
源码编译安装第一步:检查环境以及依赖
PCRE的安装及使用1、主页地址:www pcre org
下载pcre-8.13 tar bz2
2、解压缩:
tar xjpf pcre-8.13 tar bz2
3、配置:
cd pcre-8.13
./configure --prefix=/usr/local/pcre-8.13 --libdir=/usr/local/lib/pcre --includedir=/usr/local/include/pcre
configure有许多参数可配,具体参见./configure --help及手册
4、编译:
make
5、安装:
make install
6、将库文件导入cache:
方法1:在/etc/ld.so.conf中加入: /usr/local/lib/pcre,然后运行ldconfig
方法2:在/etc/ld.so.conf.d/下新生成一个文件(或在其中的文件中加入同样内容),文件内容为:
/usr/local/lib/pcre,然后运行ldconfig
7、编译自带的demo程序
gcc -Wall pcredemo.c -I/usr/local/include/pcre -L/usr/local/lib/pcre -lpcre -o pcredemo
8、执行
./pcredemo -g 'cat|dog' 'the dog sat on the cat'
./pcredemo 'cat|dog' 'the cat sat on the mat'
安装过程遇到的问题,在ubuntu 10.04下,如果直接./configuremakemake intall的话,默认安装的目录是/usr/local/,但是,即使用
gcc -Wall pcredemo.c -I/usr/local/include -L/usr/local/lib -lpcre -o pcredemo
编译,执行时会出现./pcredemo: error while loading shared libraries: libpcre.so.0: cannot open shared object file: No such file or directory
错误的原因是没用用ldconfig加载库文件到cache。只需按第6步将库文件加载到cache就行