레이블이 library and headers are required with support for https인 게시물을 표시합니다. 모든 게시물 표시
레이블이 library and headers are required with support for https인 게시물을 표시합니다. 모든 게시물 표시

2018년 7월 13일 금요일

Redhat 7.5 ppc64le에서 CRAN-R을 source로부터 설치하기


전에 Ubuntu 16.04 ppc64le에서 CRAN-R을 설치하는 과정을 올린 바 있습니다만, 이번에는 Redhat의 경우입니다.   대부분의 과정은 비슷합니다.

먼저, Redhat EPEL에 포함된 R은 3.5 버전입니다.  이걸 쓰셔도 된다면 그냥 이걸 설치하시는 것이 편합니다. 

[root@ING ~]# yum list | grep R-core
R-core.ppc64le                      3.5.0-1.el7         epel
R-core-devel.ppc64le                3.5.0-1.el7         epel


그러나 특정 버전, 가령 3.4.1을 설치하시려면 다음과 같이 CRAN에서 source를 받아다 설치하시면 됩니다.   먼저 기존에 설치된 R 3.5 버전을 다음과 같이 삭제합니다.

[root@ING ~]# yum erase R R-core R-core-devel R-devel R-java R-java-devel libticonv-devel

이어서 기본적으로 필요한 OS package들을 설치합니다.

[root@ING test]# yum install readline-devel readline-static libX11-devel libX11-common libXt-devel libXt bzip2 bzip2-libs bzip2-devel lzma-sdk-devel lzma-sdk457-devel pcre2-devel pcre3-devel gcc-gfortran libgfortran libcurl-devel curl texlive-latex texlive-latex-fonts texlive-txfonts texlive-pxfonts texlive-fontaxes java-1.8.0-openjdk java-1.8.0-openjdk-devel java-1.8.0-openjdk-headless

이제 source를 download 받습니다.

[root@ING test]# wget https://cran.r-project.org/src/base/R-3/R-3.4.1.tar.gz

[root@ING test]# tar -zxf R-3.4.1.tar.gz

[root@ING test]# cd R-3.4.1

Build 순서는 똑같습니다.  configure - make - make install 순입니다.

[root@ING R-3.4.1]# ./configure --enable-R-shlib

[root@ING R-3.4.1]# make -j 16

[root@ING R-3.4.1]# make install

이렇게 설치하면 기본적으로 /usr/local/lib64/R 밑에 설치됩니다.

[root@ING R]# pwd
/usr/local/lib64/R

[root@ING R]# ls
bin  COPYING  doc  etc  include  lib  library  modules  share  SVN-REVISION

그러나 별도로 PATH를 잡아주지 않아도 이미 /usr/local/bin에 R이 copy되어 있으므로 그냥 그대로 쓰시면 됩니다.

[root@ING ~]# which R
/usr/local/bin/R

[root@ING ~]# R

R version 3.4.1 (2017-06-30) -- "Single Candle"
Copyright (C) 2017 The R Foundation for Statistical Computing
Platform: powerpc64le-unknown-linux-gnu (64-bit)
...
Type 'q()' to quit R.

> install.packages("knitr")

> install.packages("anim.plots")



*  저같은 경우 ./configure --enable-R-shlib 수행시 처음에는 아래와 같은 error가 발생했습니다.

configure: error: libcurl >= 7.22.0 library and headers are required with support for https

그러나 실제로 보면 아래처럼 libcurl은 이미 7.29 버전이 설치되어 있습니다.

[root@ING R-3.4.1]# yum list | grep libcurl
libcurl.ppc64le                     7.29.0-46.el7       @anaconda/7.5
libcurl-devel.ppc64le               7.29.0-46.el7       @rhel-7-for-power-9-rpms

이 error의 원인은 다음과 같이 config.log를 뒤져보면 알 수 있습니다.  즉, 환경 설정에서 PATH 변수 맨 앞에 anaconda2가 오도록 되어 있었는데, anaconda2 속에 설치된 libcurl의 버전이 낮은 것이 원인이었습니다.


[root@ING R-3.4.1]# env | grep PATH
PATH=/opt/anaconda2/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/root/bin:/opt/DL/tensorflow/bin:/opt/DL/protobuf/bin:/opt/DL/caffe-bvlc/bin

[root@ING R-3.4.1]# grep libcurl config.log
configure:40993: checking if libcurl is version 7 and >= 7.22.0
/usr/bin/ld: warning: libssl.so.1.0.0, needed by /opt/anaconda2/lib/libcurl.so, not found (try using -rpath or -rpath-link)
/usr/bin/ld: warning: libcrypto.so.1.0.0, needed by /opt/anaconda2/lib/libcurl.so, not found (try using -rpath or -rpath-link)
/opt/anaconda2/lib/libcurl.so: undefined reference to `SSL_CTX_set_srp_username'
/opt/anaconda2/lib/libcurl.so: undefined reference to `libssh2_scp_recv2'
/opt/anaconda2/lib/libcurl.so: undefined reference to `SSL_CTX_set_srp_password'
configure:41089: error: libcurl >= 7.22.0 library and headers are required with support for https

이는 간단히 PATH 환경 변수에서 anaconda2를 제거한 뒤 configure를 수행하면 간단히 핵결됩니다.

그렇게 해도 문제가 되는 수가 있는데, 그럴 경우엔 아예 다음과 같이 어느 directory에서 libcurl.so를 찾으라고 명시적으로 지정하면 확실히 해결이 됩니다.

[bsyu@p57a22 R-3.4.1]$ ./configure --enable-R-shlib LDFLAGS="-L/usr/lib64 -lcurl"