suse11 SP3上源码安装R过程

sles 11 sp3上源码编译安装R-3.2.2

suse上安装R,过程艰难,文章里的源码包版本都是自己安装时候所用的版本,不一定必须是该版本。

整体依赖关系:

cairo依赖于X11 , pango依赖于cairo

安装顺序X11 -> cairo -> pango

1.安装编译器

先看看R网站的一些说明:

B.6 Using FORTRAN:

.................

To compile R, you need a FORTRAN compiler.

The default is to search for f95, fort, xlf95, ifort,ifc, efc, pgf95 lf95, gfortran, ftn, g95, f90,

xlf90, pghpf, pgf90, epcf90, g77, f77, xlf, frt,pgf77, cf77, fort77, fl32, af77 (in that order)56,

and use whichever is found first; if none is found, Rcannot be compiled. However,

if CC is gcc, the matching FORTRAN compiler (g77 forgcc 3 and gfortran for gcc 4) is used if available

suse默认是没有gfortran编辑器,所以需要先安装它

xz -d gcc-trunk.tar.xz

tar -xvf gcc-trunk.tar -C /opt

vi /etc/profile

export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/opt/gcc-trunk/lib64:/opt/gcc-trunk/lib

exportLIBRARY_PATH=$LIBRARY_PATH:/opt/gcc-trunk/lib:/opt/gcc-trunk/lib64

export PATH=$PATH:/opt/gcc-trunk/bin

source /etc/profile

which gfortran

/opt/gcc-trunk/bin/gfortran

还需要安装gcc-c++

zypper in gcc-c++

2.安装Xorg-X11

安装cairo需要xlib支持,所有需要X11支持,编译R需要X11的libX11和libXt

2.1安装libX11-1.6.5

依赖关系(a,b-> c  c依赖于a,b):

(libpthread-stubs-0.3,xcb-proto-1.12,libXau-1.0.4) -> libxcb-1.12

(util-macros-1.19.1,kbproto-1.0.4,xproto-7.0.23,inputproto-2.3.2,xextproto-7.0.3)-> libX11-1.6.5 <- (libxcb-1.12)

1)安装util-macros-1.19.1

./configure --prefix=/usr/local

make install

2)安装kbproto-1.0.4

./configure --prefix=/usr/local

make install

3)安装xproto-7.0.23

./configure --prefix=/usr/local

make

make install

4)安装inputproto-2.3.2

./configure --prefix=/usr/local

make

make install

5)安装xextproto-7.0.3

./configure --prefix=/usr/local

make install

6)安装libpthread-stubs-0.3

./configure --prefix=/usr/local

make

make install

7)安装xcb-proto-1.12

./configure --prefix=/usr/local

make

make install

8)安装libXau-1.0.4

./configure --prefix=/usr/local

make

make install

9)安装libxcb-1.12

./configure --prefix=/usr/local

make

make install

10)安装libX11-1.6.5

2.2安装libXt-1.1.5

依赖关系(a,b-> c  c依赖于a,b)

(xtrans-1.3.5,libice_1.0.8,libsm_1.2.1) -> libXt-1.1.5

1)安装xtrans-1.3.5

./configure --prefix=/usr/local

make

make install

2)安装libICE-1.0.8

./configure --prefix=/usr/local

make

make install

3)安装libsm_1.2.1

./configure --prefix=/usr/local

make

make install

4)安装libXt-1.1.5

./configure --prefix=/usr/local

make

make install

3.安装cairo-1.14.8

R网站的说明:

A.2 Useful libraries and programs:

..............

The ‘modern’ version of the X11(), jpeg(), png() andtiff() graphics devices uses the cairo and (optionally) Pango libraries.

Cairo version 1.2.0 or later is required.

Pango needs to be at least version 1.10, and 1.12 isthe earliest version we have tested.

(For Fedora users we believe the pango-devel RPM andits dependencies suffice.)

R checks for pkg-config, and uses that to check firstthat the ‘pangocairo’ package is installed (and if not, ‘cairo’)

and if additional flags are needed for the‘cairo-xlib’ package,

then if suitable code can be compiled.

These tests will fail if pkg-config is notinstalled48, and are likely to fail if cairo was built statically (unusual).

Most systems with Gtk+ 2.8 or later installed willhave suitable libraries

..............

需要cairo-xlib的支持(需要安装X11)

依赖关系:(a,b-> c  c依赖于a,b)

(libXext-1.0.1,pixman-0.34.0)-> cairo-1.14.8

1)安装libXext-1.0.1

./configure --prefix=/usr/local

make

make install

2)安装pixman-0.34.0

./configure --prefix=/usr/local

make

make install

2)安装cairo-1.14.8

./configure --prefix=/usr/local --disable-static --enable-xlib=yes--enable-ft=yes --enable-xlib-xcb=yes -enable-tee

make

make install

configure的结果:

Thefollowing font backends:

User:          yes (always builtin)

FreeType:      yes

Fontconfig:    yes

Win32:         no (requires a Win32 platform)

Quartz:        no (requires CoreGraphics framework)

The following functions:

PNGfunctions:   yes

GLXfunctions:   no (not required by anybackend)

WGLfunctions:   no (not required by anybackend)

EGLfunctions:   no (not required by anybackend)

X11-xcbfunctions: yes

XCB-shmfunctions: yes

The following features and utilities:

cairo-trace:                yes

cairo-script-interpreter:   yes

And the following internal features:

pthread:       yes

gtk-doc:       no

gcovsupport:  no

symbol-lookup: no (requires bfd)

testsurfaces: no (disabled, use --enable-test-surfaces to enable)

pstesting:    no (requires libspectre)

pdftesting:   no (requires poppler-glib>= 0.17.4)

svgtesting:   no (requires librsvg-2.0 >=2.35.0)

4.安装pango

依赖关系:(a,b -> c  c依赖于a,b):

(libffi-3.2,pcre-8.40 ) ->  glib-2.48.2

(libpng-1.6.28,readline-6.3) ->freetype-2.5.4 -> fontconfig-2.12.0 -> harfbuzz-1.4.0 <-(icu4c-50_1,glib-2.48.2)

harfbuzz-1.4.0 -> pango-1.40.2

1)编译libpng-1.6.28

rpm-ivh --nodeps zlib-devel-1.2.7-7.1.1.x86_64.rpm    --freetype需要

./configure --prefix=/usr/local

make

make install

2)编译readline-6.3

./configure --prefix=/usr/local

make

make install

3)安装freetype-2.5.4

./configure --prefix=/usr/local

make

make install

4)编译fontconfig-2.12.0

rpm-ivh --nodeps libxml2-devel-2.7.6-0.23.1.x86_64.rpm  --fontconfig需要

./configure --sysconfdir=/etc --prefix=/usr/local--mandir=/usr/share/man --enable-libxml2

make

make install

5)编译icu4c-50_1

./configure --prefix=/usr/local

make

make install

6)编译libffi-3.2

./configure --prefix=/usr/local

make

make install

7)编译pcre-8.40

./configure --enable-utf8 --enable-unicode-properties--prefix=/usr/local

make

make install

8)编译glib-2.48.2(最好是这个版本)

./configure --prefix=/usr/local

make

make install

9)编译harfbuzz-1.4.0

./configure --prefix=/usr/local

make

make install

configure结果:

Unicode callbacks (you want at least one):

Glib:                   true

ICU:                    true

UCDN:                   false

10)编译pango-1.40.2

./configure --prefix=/usr/local

make

make install

5.安装R-3.2.2

依赖关系(a->b  b依赖于a):

gmp-5.1.3 -> isl-0.13

mpfr-3.1.5 -> mpc-1.0.2

jpeg9b

tiff-4.0.7

1)安装ncurses-devel(readline的依赖)

zypper in ncurses-devel

2)安装gmp-5.1.3

./configure --prefix=/usr/local

make

make install

2)安装isl-0.13

./configure --prefix=/usr/local

make

make install

3)安装mpfr-3.1.5

./configure --prefix=/usr/local

make

make install

4)安装mpc-1.0.2

./configure --prefix=/usr/local

make

make install

5)安装jpeg-9b

./configure --prefix=/usr/local

make

make install

6)安装tiff-4.0.7

./configure --prefix=/usr/local

make

make install

7)安装R-3.2.2

./configure --enable-R-shlib --with-readline=yes --with-jpeglib=yes--with-libpng=yes --with-x=yes --with-libtiff=yes --with-cairo=yes--with-ICU=yes --prefix=/opt/R

make  (如果没有java环境还需要安装java)

make install

8)vi /etc/profile

export PATH=$PATH:/opt/gcc-trunk/bin:/opt/R/bin

source /etc/profiel

可以开始使用R了

R

> capabilities()

jpeg         png        tiff       tcltk         X11        aqua

TRUE        TRUE        TRUE       FALSE       FALSE       FALSE

http/ftp     sockets      libxml        fifo      cledit       iconv

TRUE        TRUE        TRUE        TRUE        TRUE        TRUE

NLS     profmem       cairo         ICU long.double     libcurl

TRUE       FALSE        TRUE        TRUE        TRUE       FALSE

option

R安装ggplot2

https://cran.r-project.org/web/packages/available_packages_by_name.html

依赖于:

digest, gtable (≥ 0.1.1),  plyr (≥ 1.7.1),reshape2, scales (≥ 0.4.1),  tibble, lazyeval

Rcpp -> plyr

stringi,magrittr -> stringr -> reshape2

lazyeval,assertthat -> tibble

RColorBrewer,dichromat,(colorspace -> munsell),labeling -> scales

1)R CMD INSTALL digest_0.6.12.tar.gz

2)R CMD INSTALL gtable_0.2.0.tar.gz

3)R CMD INSTALL Rcpp_0.12.9.tar.gz

4)R CMD INSTALL plyr_1.8.4.tar.gz

5)R CMD INSTALL stringi_1.1.2.tar.gz

6)R CMD INSTALL magrittr_1.5.tar.gz

7)R CMD INSTALL stringr_1.2.0.tar.gz

8)R CMD INSTALL reshape2_1.4.2.tar.gz

9)R CMD INSTALL lazyeval_0.2.0.tar.gz

10)R CMD INSTALL assertthat_0.1.tar.gz

11)R CMD INSTALL tibble_1.2.tar.gz

12)R CMD INSTALL RColorBrewer_1.1-2.tar.gz

13)R CMD INSTALL dichromat_2.0-0.tar.gz

14)R CMD INSTALL colorspace_1.3-2.tar.gz

15)R CMD INSTALL munsell_0.4.3.tar.gz

16)R CMD INSTALL labeling_0.3.tar.gz

17)R CMD INSTALL scales_0.4.1.tar.gz

18)R CMD INSTALL ggplot2_2.2.1.tar.gz

R

>library()

Packages in library ‘/opt/R/lib64/R/library’:

KernSmooth              Functions for Kernel SmoothingSupporting Wand

& Jones (1995)

MASS                    Support Functions andDatasets for Venables and

Ripley‘s MASS

Matrix                  Sparse and Dense MatrixClasses and Methods

RColorBrewer            ColorBrewer Palettes

Rcpp                    Seamless R and C++ Integration

assertthat              Easy pre and post assertions.

base                    The R Base Package

boot                    Bootstrap Functions(Originally by Angelo Canty

for S)

class                   Functions for Classification

cluster                 "Finding Groups inData": Cluster Analysis

Extended Rousseeuw etal.

codetools               Code Analysis Tools for R

colorspace              Color Space Manipulation

compiler                The R Compiler Package

datasets                The R Datasets Package

dichromat               Color Schemes for Dichromats

digest                  Create Compact Hash Digestsof R Objects

foreign                 Read Data Stored by Minitab,S, SAS, SPSS,

Stata, Systat, Weka,dBase, ...

ggplot2                 Create Elegant DataVisualisations Using the

Grammar of Graphics

FAQ

在安装R的过程中遇到的一些问题

1.       R依赖

R官方网站说明:

The ‘modern’ version of the X11(), jpeg(),png() and tiff() graphics devices uses the cairo and (optionally) Pangolibraries.

Cairo version 1.2.0 or later is required.

Pango needs to be at least version 1.10,and 1.12 is the earliest version we have tested.

(For Fedora users we believe thepango-devel RPM and its dependencies suffice.)

R checks for pkg-config, and uses that tocheck first that the ‘pangocairo’ package is installed (and if not, ‘cairo’)

and if additional flags are needed for the‘cairo-xlib’ package,

then if suitable code can be compiled.

These tests will fail if pkg-config is notinstalled48,

and are likely to fail if cairo was builtstatically (unusual).

Most systems with Gtk+ 2.8 or laterinstalled will have suitable libraries

需要pango和cairo,并且cairo需要cairo-xlib支持

2.       --with-x=yes (default) andX11 headers/libs are not available

编译R时报错:

checking X11/Intrinsic.h usability... no

checking X11/Intrinsic.h presence... no

checking for X11/Intrinsic.h... no

configure: error: --with-x=yes (default)and X11 headers/libs are not available

解决办法: install libXt

3.       dchdc.o: could not readsymbols: Bad value

make R时报错:

/usr/lib64/gcc/x86_64-suse-linux/4.3/../../../../x86_64-suse-linux/bin/ld:

../appl/dchdc.o: relocation R_X86_64_32against `.rodata‘ can not be used when making a shared object; recompile with-fPIC

../appl/dchdc.o: could not read symbols:Bad value

collect2: ld returned 1 exit status

解决办法: configura时去掉--enable-R-shlib

4.  error: cairo-xlib.h: No suchfile or directory

编译R时报错:

configure:31534: checking for X

configure:31720: result: disabled

configure:32391: result: using X11 ... no

configure:32501: checking whetherpkg-config knows about cairo and pango

configure:32513: result: yes

configure:32547: checking whether cairoincluding pango is >= 1.2 and works

configure:32570: gcc -std=gnu99 -o conftest-g -O2 -fpic  -I/usr/local/include  -I/usr/include/libxml2-I/usr/local/include/pango-1.0 -I/usr/local/include/cairo-I/usr/local/include/harfbuzz -I/usr/local/include/freetype2-I/usr/local/include -I/usr/local/include/glib-2.0-I/usr/local/lib/glib-2.0/include -I/usr/local/include/pixman-1 -I/usr/local/include/libpng16   -L/usr/local/lib64 conftest.c -lrt -ldl-lm  -L/usr/local/lib -lpangocairo-1.0-lpango-1.0 -lgobject-2.0 -lglib-2.0 -lpng16 -lz -lcairo   >&5

conftest.c:233:24: error: cairo-xlib.h: Nosuch file or directory

configure:32570: $? = 1

解决办法:这是安装了cairo,但是编译cairo时没有加--enable-xlib=yes参数

5.    /libreadline.so: undefined reference to….

configure R时候readline报错,查看config.log:

configure:20905: checking forrl_callback_read_char in -lreadline

configure:20930: gcc -o conftest -g -O2-I/usr/local/include -L/usr/local/lib64 conftest.c -lreadline   >&5

/usr/local/lib/libreadline.so: undefinedreference to `tputs‘

/usr/local/lib/libreadline.so: undefinedreference to `tgoto‘

/usr/local/lib/libreadline.so: undefinedreference to `tgetflag‘

/usr/local/lib/libreadline.so: undefinedreference to `UP‘

/usr/local/lib/libreadline.so: undefinedreference to `tgetent‘

/usr/local/lib/libreadline.so: undefinedreference to `tgetnum‘

/usr/local/lib/libreadline.so: undefinedreference to `PC‘

/usr/local/lib/libreadline.so: undefinedreference to `tgetstr‘

/usr/local/lib/libreadline.so: undefinedreference to `BC‘

collect2: ld returned 1 exit status

configure:20930: $? = 1

解决办法: zypper in ncurses-devel

6.  error: cannot compile a simple Fortranprogram

configure R 时候报错:

checking for Fortran 77 libraries ofgfortran...

checking how to get verbose linking outputfrom gcc -std=gnu99... -v

checking for C libraries of gcc-std=gnu99...  -L/usr/local/lib64-L/usr/lib64/gcc/x86_64-suse-linux/4.3 -L/usr/lib64/gcc/x86_64-suse-linux/4.3/../../../../lib64-L/lib/../lib64 -L/usr/lib/../lib64-L/usr/lib64/gcc/x86_64-suse-linux/4.3/../../../../x86_64-suse-linux/lib-L/usr/lib64/gcc/x86_64-suse-linux/4.3/../../.. -lgcc_s

checking for dummy main to link withFortran 77 libraries... none

checking for Fortran 77 name-manglingscheme... configure: error: in `/soft/R-3.2.2‘:

configure: error: cannot compile a simpleFortran program

config.log中搜索"cannotcompile a simple Fortran program":

configure:23745: checking for Fortran 77name-mangling scheme

configure:23758: gfortran -c  conftest.f >&5

/opt/gcc-trunk/bin/../libexec/gcc/x86_64-pc-linux-gnu/7.0.0/f951:error while loading shared libraries: libisl.so.13: cannot open sh

ared object file: No such file or directory

configure:23758: $? = 1

configure: failed program was:

|      subroutine foobar()

|      return

|      end

|      subroutine foo_bar()

|      return

|      end

configure:23891: error: in `/soft/R-3.2.2‘:

configure:23893: error: cannot compile asimple Fortran program

解决办法:安装isl

7.      undefined reference to….

make R时报错

gcc -std=gnu99 -Wl,--export-dynamic-fopenmp  -L../../lib -L/usr/local/lib64-o R.bin Rmain.o  -lR -lRblas

/opt/gcc-trunk/lib64/libgfortran.so.4:undefined reference to `[email protected]_4.8.0‘

collect2: ld returned 1 exit status

make[3]: *** [R.bin] Error 1

解决办法:

/etc/profile里添加:

exportLIBRARY_PATH=$LIBRARY_PATH:/opt/gcc-trunk/lib:/opt/gcc-trunk/lib64

source /etc/profile

时间: 2024-07-30 03:16:54

suse11 SP3上源码安装R过程的相关文章

linux上源码安装MySQL详解

最近需要使用MySQL Fabric,这货是MySQL5.6.10之后才出现的utility.手头机器装的是MySQL5.1,所以需要先把旧版MySQL升级成5.6版本.之前没有玩过MySQL,所以这次稍微费了点事.在此,把过程记录下来,希望能给有需求的人提供一点帮助.下面我们就正式开始. 1. 删除老版本MySQL 其实删除老版MySQL是一件很简单的事,但是开始时候由于担心各个包的依赖会导致各种问题,亦步亦趋来得很慢.其实只需要做到这么几步就可以了: 1.1 查看已安装的mysql版本并删除

在 Linux 系统上源码安装 GTK+ 2.0

在 Linux 系统上源码安装 GTK+ 2.0==================================================Keywords: GTK+, Install, Linux, SourceAuthor:       whyglinux (whyglinux AT hotmail DOT com)Date:          2007-01-07==================================================目录0. 前言1.

Fedora20上源码安装Xen4.3.0

Fedora20上源码安装Xen4.3.0 1.环境介绍 Linux: Fedora 20 X86_64 Xen: Xen 4.3.0 2.安装Fedora 官网上下载镜像,U盘引导,完成安装. 详细问题见:Fedora20系统安装及配置 3.安装所需要的工具包 执行命令时都是在root权限下的. 3.1更新yum # yum update 3.2开发包 # yum groupinstall "Development Tools" # yum install hmaccalc ncur

在CentOs服务器上源码安装python3.5

在CentOs服务器上源码安装python3.5 作者:尹正杰 1.系统环境介绍 2.安装依赖包 [[email protected] packages]# yum -y groupinstall "Development tools" [[email protected] packages]# yum -y install zlib-devel bzip2-devel openssl-devel ncurses-devel sqlite-devel readline-devel tk

Linux服务器--CentOS6上源码安装LAMP(实现WordPress,PhpMyAdmin)

Linux服务--CentOS6实现LAMP(源码安装) 实验要求: 安装php时实现php模块嵌入到httpd中和实现fpm两种方式.在fpm下,提供两个虚拟主机: 分别用于实现PHPMyadmin和WordPress,其中PhpMyAdmin提供ssl. 实验环境: CentOS系统一台(IP:172.16.99.4),所需的httpd,mariadb,php,PhpAdmin,WordPress的源码包. 实验步骤: 安装顺序:httpd-->mariadb-->php. 安装前的准备工

[原创]在Centos7.2上源码安装PHP、Nginx、Zentao禅道

版本 操作系统:CentOS Linux release 7.2.1511 (Core) PHP:5.6.33 Nginx:1.12.2 MySQL:5.6.38(192.168.1.103的Windows) Zentao禅道:9.7.stable 安装路径 源码路径:/usr/local/src PHP:/usr/local/php Nginx:/usr/local/nginx Zentao禅道:/opt/zentao 安装PHP 安装php依赖 yum install gcc libxml2

CentOS7 上源码安装KVM(qemu--kvm)

在centos7下已经集成了kvm 环境:centos7 检查/dev/kvm这个文件,它是kvm内核模块提供给用户空间的qemu-kvm程序使用的一个控制接口,它提供了客户机(Guest)操作系统运行所需要的模拟和实际的硬件设备环境. 确定KVM模块确实全部安装好,下面来看一下qemu-kvm的编译和安装. 源码安装qemu-kvm 除了在内核空间的KVM模块之外,在用户空间需要QEMU来模拟所需要CPU和设备模型以及用于启动客户机进程,这样才有了一个完整的KVM运行环境. 参考文档:http

在Ubuntu上源码安装MySQL+安装问题解决+安全优化

0.说明 当然,MySQL的安装方法多种多样,在Ubuntu上,你可以采用apt-get的方式安装,这样的好处是:快速方便.基本上,它会帮你解决所有的函数库依赖问题,正常情况下,只要apt-get执行完成,那么MySQL也就可以使用了. 但我更倾向于使用源码的方式来安装MySQL,原因也很简单:除了有详细的官方文档外,你还可以非常清楚地知道你自己在做什么,这点在以后MySQL运行出现问题时将会有很大的帮助! 但即便是按照官方文档来安装,你也会遇到各种各样的问题,这里,我将呈现一个完整的过程给大家

在CentOS7上源码安装php7

Install php7 on CentOS Install from source 首先下载php源码包并解压: # wget http://cn2.php.net/get/php-7.0.9.tar.gz/from/this/mirror # tar -xvf php-7.0.9.tar.gz # cd php-7.0.9.tar.gz 然后开始./configrue ./configure --enable-fpm --with-mysql configure过程中可能会出现的问题: co