步骤:
先卸载
sudo make uninstall
删除文件夹
rm -rf 文件夹名
在编译R之前,需要通过yum安装以下几个程序:
#yum install gcc-gfortran
#yum install gcc gcc-c++
#yum install readline-devel
#yum install libXt-devel
#yum install libpng libpng-devel libtiff libtiff-devel libjpeg-turbo libjpeg-turbo-devel
1,下载R-3.2.0.tar.gz
http://cran.r-project.org/src/base/R-3/R-3.2.0.tar.gz
2,解压
$ tar -zxvf R-3.0.1.tar.gz
$ cd R-3.0.1
3,编译(确保系统中安装了编译需要的包,如果没有安装,会报错。)
$ ./configure --enable-R-shlib --with-libpng --with-jpeglib --with-libtiff --with-x
--enable-R-shlib:这个选项,不用则RStudio-server安装会有问题
--with-libpng --with-jpeglib --with-libtiff:这几个不装,则图形显示会有问题
编译信息如下:
R is now configured for x86_64-unknown-linux-gnu
Source directory: .
Installation directory: /usr/local
C compiler: gcc -std=gnu99 -g -O2
Fortran 77 compiler: gfortran -g -O2
C++ compiler: g++ -g -O2
C++ 11 compiler: g++ -std=c++0x -g -O2
Fortran 90/95 compiler: gfortran -g -O2
Obj-C compiler:
Interfaces supported: X11
External libraries: readline
Additional capabilities: NLS
Options enabled: shared R library, shared BLAS, R profiling
Capabilities skipped: PNG, JPEG, TIFF, cairo, ICU
Options not enabled: memory profiling
Recommended packages: yes
[root@hadoop1-mysql R-3.2.0]# cd /usr/local
[root@hadoop1-mysql local]# ls
bin etc games include lib lib64 libexec perl sbin share src
4,安装
$ make 这步出错(a)
这步其实完成了安装,可执行程序R在/home/R/R-3.2.0/bin下,此时 /usr/local/bin下还没有可执行的R
$ make install
这步执行后, /usr/local/bin下有了可执行的R
5,登录R
$ exit
$ R
出错(a)的情况及解决办法:
报错终止:“句法分析器30856行里不能有多字节字符”
解决办法:在环境变量里增加东东,操作如下:
$ vi /etc/profile
在文件末尾加上如下两行代码
export LANG=zh_CN.UTF-8
export LANGUAGE=zh_CN.UTF-8
要是刚才的修改马上生效,需要执行以下代码
$ source /etc/profile
以下还没验证
certainly for R-3.2.0 the -lz flag is needed for the compilers e.g.
./configure –with-x –with-lapack –enable-R-shlib –without-system-bzlib CFLAGS=”-lz” FFLAGS=”-lz”
also you should have these
yum install java-1.7.0-openjdk-devel texlive-* ncompress readline-devel libX11-devel libXt-devel texinfo libjpeg-devel cairo-devel tk-devel tcl-devel libtiff-devel libicu-dev blas
so configure gives
R is now configured for x86_64-unknown-linux-gnu
Source directory: .
Installation directory: /maths/R
C compiler: gcc -std=gnu99 -lz
Fortran 77 compiler: gfortran -lz
C++ compiler: g++ -g -O2
C++ 11 compiler: g++ -std=c++11 -g -O2
Fortran 90/95 compiler: gfortran -g -O2
Obj-C compiler:
Interfaces supported: X11, tcltk
External libraries: readline, zlib
Additional capabilities: PNG, JPEG, TIFF, NLS, cairo, ICU
Options enabled: shared R library, shared BLAS, R profiling
Capabilities skipped:
Options not enabled: memory profiling
Recommended packages: yes
configure: WARNING: neither inconsolata.sty nor zi4.sty found: PDF vignettes and package manuals will not be rendered optimally