redhat6.4安装R-3.3.1

转载:https://blog.csdn.net/Timsley/article/details/50782742

如果curl是默认安装的话,是不支持https,当你在使用libcurl去访问https时,就会报以下的错误

* Protocol https not supported or disabled in libcurl

* Unsupported protocol

可以通过下面的命令查看curl现在支持哪些协议 
这里写图片描述 
可以看到现在curl是不支持https的

如果curl要支持https,就必须先安装openssl,安装方法可以看下面的链接 
http://blog.csdn.net/Timsley/article/details/50776615

安装完openssl,接下来就是重新配置安装curl

我的配置环境如下 
ubuntu版本:14.04 
CURL版本:curl-7.30.0.tar.gz 
openssl版本:openssl-1.0.1q.tar.gz

1)tar zxvf curl-7.30.0.tar.gz 
2)cd curl-7.30.0/ 
3)./configure –with-ssl=/usr/local/ssl(我这里没有配置prefix选项,直接将curl安装到默认的目录/usr/local) 
config之后,会有以下信息打出 
这里写图片描述

4)make 
make的时候可能会出现以下错误

../lib/.libs/libcurl.so: undefined reference to `SSLv2_client_method’

刚开始我用的curl-7.22.0.tar.gz,后面出了上面这个问题后,以为是版本不对,又升级到curl-7.30.0,其实都一样,还是make出错 
网上说是因为openssl配置的时候不支持sslv2 
http://stackoverflow.com/questions/8206546/undefined-symbol-sslv2-method 
后来搜索之后,借鉴以下方法解决了 
http://stackoverflow.com/questions/8287515/problems-building-libcurl-7-21-2-on-ubuntu-11-10-hiphop

实际是vim lib/ssluse.c,修改如下 
这里写图片描述 
重新make,通过了

5)make install

最后查看curl支持的协议,可以看到现在已经支持https协议了 
curl -V 

这里写图片描述



主要参考下面这个

http://www.bubuko.com/infodetail-1742059.html

标签:r3.3.1 源码 解决依赖关系

1、yum install readline-devel

2、yum install libXt-devel

3、tar zxvf R-3.3.1.tar.gz

cd R-3.3.1

    ./configure --prefix=/opt/R-3.3.1   --enable-R-shlib

    报错:

    checking for zlib.h... yes

    checking if zlib version >= 1.2.5... no

    checking whether zlib support suffices... configure: error: zlib library and headers are required  ##缺少zlib或者zlib版本过低

4、安装zlib

tar xvf zlib-1.2.8.tar.gz

tar xvf zlib-1.2.8.tar.gz

cd zlib-1.2.8

./configure --prefix=/opt/zlib-1.2.8

make && make install

5、cd /root/R-3.3.1

./configure --prefix=/opt/R-3.3.1   --enable-R-shlib LDFLAGS="-L/opt/zlib-1.2.8/lib" CPPFLAGS="-I/opt/zlib-1.2.8/include"

报错:

checking for zlib.h... yes

checking if zlib version >= 1.2.5... yes

checking whether zlib support suffices... yes

checking mmap support for zlib... yes

checking for BZ2_bzlibVersion in -lbz2... no

checking whether bzip2 support suffices... configure: error: bzip2 library and headers are required  ##zlib版本已经符合要求,缺少bzip2

6、安装bzip2

tar zxvf bzip2-1.0.6.tar.gz

cd bzip2-1.0.6

make -f Makefile-libbz2_so

make clean

make 

make install PREFIX=/opt/bzip2-1.0.6

7、./configure --prefix=/opt/R-3.3.1   --enable-R-shlib LDFLAGS="-L/opt/zlib-1.2.8/lib -L/opt/bzip2-1.0.6/lib" CPPFLAGS="-I/opt/zlib-1.2.8/include -I/opt/bzip2-1.0.6/include"

报错:

checking if bzip2 version >= 1.0.6... yes

checking whether bzip2 support suffices... no

checking for lzma_version_number in -llzma... no  ##bzip2版本符合要求,但是lzma(xz软件包)缺少

8、安装xz

tar zxvf xz-5.2.2.tar.gz

cd /root/xz-5.2.2

./configure --prefix=/opt/xz-5.2.2

make -j3

make install

9、./configure --prefix=/opt/R-3.3.1   --enable-R-shlib LDFLAGS="-L/opt/zlib-1.2.8/lib -L/opt/bzip2-1.0.6/lib -L/opt/xz-5.2.2/lib" CPPFLAGS="-I/opt/zlib-1.2.8/include -I/opt/bzip2-1.0.6/include -I/opt/xz-5.2.2/include"

报错:

checking whether bzip2 support suffices... no

checking for lzma_version_number in -llzma... yes

checking lzma.h usability... yes

checking lzma.h presence... yes

checking for lzma.h... yes

checking if lzma version >= 5.0.3... yes

checking for pcre_fullinfo in -lpcre... no     

checking whether PCRE support suffices... configure: error: pcre >= 8.10 library and headers are required  ##xz版本符合要求,prce版本过低或者缺少

10、安装pcre

tar zxvf pcre-8.39.tar.gz

cd /root/pcre-8.39

./configure  --prefix=/opt/pcre-8.39

make -j3 && make install

11、./configure --prefix=/opt/R-3.3.1   --enable-R-shlib LDFLAGS="-L/opt/zlib-1.2.8/lib -L/opt/bzip2-1.0.6/lib -L/opt/xz-5.2.2/lib -L/opt/pcre-8.39/lib" CPPFLAGS="-I/opt/zlib-1.2.8/include -I/opt/bzip2-1.0.6/include -I/opt/xz-5.2.2/include -I/opt/pcre-8.39/include"

报错:

checking for pcre.h... yes

checking pcre/pcre.h usability... no

checking pcre/pcre.h presence... no

checking for pcre/pcre.h... no

checking if PCRE version >= 8.10, < 10.0 and has UTF-8 support... no

checking whether PCRE support suffices... configure: error: pcre >= 8.10 library and headers are required   ##PCRE需要安装--enable-utf8

12、重新安装pcre

rm -rf /opt/pcre-8.39

cd /root/pcre-8.39  

./configure  --prefix=/opt/pcre-8.39  --enable-utf8

make -j3 && make install

13、./configure --prefix=/opt/R-3.3.1   --enable-R-shlib LDFLAGS="-L/opt/zlib-1.2.8/lib -L/opt/bzip2-1.0.6/lib -L/opt/xz-5.2.2/lib -L/opt/pcre-8.39/lib" CPPFLAGS="-I/opt/zlib-1.2.8/include -I/opt/bzip2-1.0.6/include -I/opt/xz-5.2.2/include -I/opt/pcre-8.39/include/"

报错:

checking pcre/pcre.h usability... no

checking pcre/pcre.h presence... no

checking for pcre/pcre.h... no

checking if PCRE version >= 8.10, < 10.0 and has UTF-8 support... yes

checking if PCRE version >= 8.32... yes

checking whether PCRE support suffices... yes

checking for curl-config... no

checking curl/curl.h usability... no

checking curl/curl.h presence... no

checking for curl/curl.h... no

configure: error: libcurl >= 7.28.0 library and headers are required with support for https    ##需要安装curl

14、安装curl

tar zxvf curl-7.50.1.tar.gz

cd /root/curl-7.50.1

./configure  --prefix=/opt/curl-7.50.1

make && make install

15、./configure --prefix=/opt/R-3.3.1 --enable-R-shlib  LDFLAGS="-L/opt/zlib-1.2.8/lib  -L/opt/bzip2-1.0.6/lib -L/opt/xz-5.2.2/lib -L/opt/pcre-8.39/lib -L/opt/curl-7.50.1/lib" CPPFLAGS="-I/opt/zlib-1.2.8/include -I/opt/bzip2-1.0.6/include -I/opt/xz-5.2.2/include -I/opt/pcre-8.39/include -I/opt/curl-7.50.1/include"

报错:

checking curl/curl.h usability... yes

checking curl/curl.h presence... yes

checking for curl/curl.h... yes

checking if libcurl is version 7 and >= 7.28.0... yes

checking if libcurl supports https... no

configure: error: libcurl >= 7.28.0 library and headers are required with support for https  ##这是一个大坑需要在环境变量中加上curl的bin路径,如果没有报错,那肯定是之前系统默认安装的curl造成的,为了

                                                                                               消除潜在风险,是否有报错,请必须执行下面的操作,系统默认安装的curl请保留,防止造成别的系统程序依赖缺失

16、最终操作

    ./configure --prefix=/opt/R-3.3.1 --enable-R-shlib  LDFLAGS="-L/opt/zlib-1.2.8/lib  -L/opt/bzip2-1.0.6/lib -L/opt/xz-5.2.2/lib -L/opt/pcre-8.39/lib -L/opt/curl-7.50.1/lib" CPPFLAGS="-I/opt/zlib-1.2.8/include -I/opt/bzip2-1.0.6/include -I/opt/xz-5.2.2/include -I/opt/pcre-8.39/include -I/opt/curl-7.50.1/include"

vim /etc/profile 

export PATH=$PATH:$JAVA_HOME/bin:/opt/curl-7.50.1/bin                    ##在这一行加上":/opt/curl-7.50.1/bin"

    source /etc/profile                                                      ##让环境变量立马生效

验证;

echo $PATH

/usr/lib64/qt-3.3/bin:/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/root/bin:/opt/java/jdk1.8.0_74/bin:/opt/curl-7.50.1/bin

    make

make install

vim /etc/profile      ##添加R源环境变量

export PATH=$PATH:$JAVA_HOME/bin:/opt/curl-7.50.1/bin:/opt/R-3.3.1/bin

    source /etc/profile   ##让环境变量立马生效



第三篇 参考这个,后期make会出现错误,他提供了解决方法

https://blog.csdn.net/jiabiao1602/article/details/77151756

6、报错
/usr/bin/ld: warning: libpcre.so.1, needed by ../../lib/libR.so, not found (try using -rpath or -rpath-link)
/usr/bin/ld: warning: liblzma.so.5, needed by ../../lib/libR.so, not found (try using -rpath or -rpath-link)
此处报错是由于没有找到动态库,看第一二行
解决方法:添加动态库
vi /etc/ld.so.conf 添加pcre和xz
include ld.so.conf.d/*.conf
/opt/pcre-8.39/lib
/opt/xz-5.2.2/lib
然后执行
#ldconfig
进入R的安装目录下执行:
make && make install
7、报错
version.o g_alab_her.o g_cntrlify.o g_fontdb.o g_her_glyph.o xxxpr.o   `ls ../unix/*.o ../appl/*.o ../nmath/*.o` ../extra/tre/libtre.a    -L../../lib -lRblas -lgfortran -lm   -lreadline  -lpcre -llzma -lbz2 -lz -lrt -ldl -lm 
/usr/bin/ld: /opt/bzip2-1.0.6/lib/libbz2.a(bzlib.o): relocation R_X86_64_32 against `.rodata' can not be used when making a shared object; recompile with -fPIC
/opt/bzip2-1.0.6/lib/libbz2.a: could not read symbols: Bad value
collect2: ld 返回 1
make[3]: *** [libR.so] 错误 1
make[3]: Leaving directory `/usr/local/program/R-3.3.1/src/main'
make[2]: *** [R] 错误 2
make[2]: Leaving directory `/usr/local/program/R-3.3.1/src/main'
make[1]: *** [R] 错误 1
make[1]: Leaving directory `/usr/local/program/R-3.3.1/src'
make: *** [R] 错误 1
解决方法:
vi /usr/local/program/bzip2-1.0.6/Makefile 的CFLAGS 行修改为
CFLAGS=-Wall -fPIC -Winline -O2 -g $(BIGFILES)
3、make clean
4、 make
5、make install PREFIX=/opt/bzip2-1.0.6

进入R的安装目录下执行:
make && make install

成功


第四篇参考这个

https://blog.csdn.net/wumiqing1/article/details/54232345

第五篇参考这个,动态库的解决

http://blog.51cto.com/kuxingseng2016/1846326

第六篇参考,touch doc/NEWS.pdf(Install R的过程中,遇到了一个NEWS.pdf找不到,用这个办法绕过的)

或者执行 make && make install -i(忽略掉)

https://blog.csdn.net/bookc/article/details/52936678





猜你喜欢

转载自blog.csdn.net/c1z2w3456789/article/details/79704332
今日推荐