/*

 http://sosal.kr/
 * made by so_Sal
 */



R 설치할 때, 다른 package에 dependency가 있을 경우 혼란스러운 경우가 많다.


RcppArmadillo 패키지를 설치하려는데 에러가 발생했다.

ERROR 메시지에는 Configuration failed가 뜨는데 딱히 도움이 되는 에러가 아니다.


WARNING을 찾아보니, G++가 4.6버전보다 높아야 한다고 한다.




[sosal@piano GEODATA]$ R CMD INSTALL RcppArmadillo_0.7.100.3.1.tar.gz


* installing to library '/storage/home/sosal/programs/R/R-devel/library'
* installing *source* package 'RcppArmadillo' ...
** package 'RcppArmadillo' successfully unpacked and MD5 sums checked
checking whether the C++ compiler works... yes
checking for C++ compiler default output file name... a.out
checking for suffix of executables...
checking whether we are cross compiling... no
checking for suffix of object files... o
checking whether we are using the GNU C++ compiler... yes
checking whether g++ accepts -g... yes
checking how to run the C++ preprocessor... g++ -E
checking whether we are using the GNU C++ compiler... (cached) yes
checking whether g++ accepts -g... (cached) yes
checking whether g++ version is sufficient... no
configure: WARNING: Only g++ version 4.6 or greater can be used with RcppArmadillo.
configure: error: Please use a different compiler.
ERROR: configuration failed for package 'RcppArmadillo'
* removing '/storage/home/sosal/programs/R/R-devel/library/RcppArmadillo'
* restoring previous '/storage/home/sosal/programs/R/R-devel/library/RcppArmadillo'



과연 warning에서 뜬게 실제인지 G++버전을 확인해봤다.


[sosal@sosal GSE39582]$ /usr/bin/g++ -v
Using built-in specs.
Target: x86_64-redhat-linux
Configured with: ../configure --prefix=/usr --mandir=/usr/share/man --infodir=/usr/share/info --with-bugurl=http://bugzilla.redhat.com/bugzilla --enable-bootstrap --enable-shared --enable-threads=posix --enable-checking=release --with-system-zlib --enable-__cxa_atexit --disable-libunwind-exceptions --enable-gnu-unique-object --enable-languages=c,c++,objc,obj-c++,java,fortran,ada --enable-java-awt=gtk --disable-dssi --with-java-home=/usr/lib/jvm/java-1.5.0-gcj-1.5.0.0/jre --enable-libgcj-multifile --enable-java-maintainer-mode --with-ecj-jar=/usr/share/java/eclipse-ecj.jar --disable-libjava-multilib --with-ppl --with-cloog --with-tune=generic --with-arch_32=i686 --build=x86_64-redhat-linux
Thread model: posix
gcc version 4.4.7 20120313 (Red Hat 4.4.7-17) (GCC)



아이고.. 좀더 높은 버전이 필요하게 됐다.



http://superuser.com/questions/381160/how-to-install-gcc-4-7-x-4-8-x-on-centos

cd /etc/yum.repos.d
wget http://people.centos.org/tru/devtools-1.1/devtools-1.1.repo 
yum --enablerepo=testing-1.1-devtools-6 install devtoolset-1.1-gcc devtoolset-1.1-gcc-c++

This will install it most likely into /opt/centos/devtoolset-1.1/root/usr/bin/

Then you can tell your compile process to use the gcc 4.7 instead of 4.4 with the CC variable

export CC=/opt/centos/devtoolset-1.1/root/usr/bin/gcc  
export CPP=/opt/centos/devtoolset-1.1/root/usr/bin/cpp
export CXX=/opt/centos/devtoolset-1.1/root/usr/bin/c++




단순히 yum update나 yum install 등으로 버전업이 될 줄 알았는데 그렇지 않았다.

위 사이트에서 들어가보니 적당히 답변이 나와있었다.


devtoolset을 설치해서, 해당 위치에 G++ 파일을 경로로 인식해주면 되겠다.




[sosal@sosal GEODATASET]$ ls -al /opt/centos/devtoolset-1.1/root/usr/bin/
total 4812
dr-xr-xr-x  2 root root   4096 Jun 15 15:44 .
drwxr-xr-x 13 root root   4096 Apr 13  2015 ..
-rwxr-xr-x  4 root root 575224 Jan 26  2013 c++
lrwxrwxrwx  1 root root      3 Apr 13  2015 cc -> gcc
-rwxr-xr-x  1 root root 575224 Jan 26  2013 cpp
-rwxr-xr-x  4 root root 575224 Jan 26  2013 g++
-rwxr-xr-x  2 root root 575224 Jan 26  2013 gcc
..(이하 생략)



~sosal/.bashrc 파일을 열어

/opt/centos/devtoolset-1.1/root/usr/bin/ 경로를 export 해주고, PATH를 다음처럼 수정하였다.



# .bashrc

export DevToolSet=/opt/centos/devtoolset-1.1/root/usr/bin

export PATH=$DevToolSet:$PATH


파일을 저장해주고

source .bashrc 로 환경설정을 새로고쳐주면 다음과 같이 잘 설치가 된다.



[sosal@sosal GEODATASET]$ R CMD INSTALL RcppArmadillo_0.7.100.3.1.tar.gz
* installing to library '/storage/home/sosal/programs/R/R-devel/library'
* installing *source* package 'RcppArmadillo' ...
** package 'RcppArmadillo' successfully unpacked and MD5 sums checked
checking whether the C++ compiler works... yes
checking for C++ compiler default output file name... a.out
checking for suffix of executables...
checking whether we are cross compiling... no
checking for suffix of object files... o
checking whether we are using the GNU C++ compiler... yes
checking whether g++ accepts -g... yes
checking how to run the C++ preprocessor... g++ -E
checking whether we are using the GNU C++ compiler... (cached) yes
checking whether g++ accepts -g... (cached) yes
checking whether g++ version is sufficient... (4.7.2) yes
checking LAPACK_LIBS... R-supplied partial LAPACK found
configure: WARNING: Some complex-valued LAPACK functions may not be available
configure: creating ./config.status
config.status: creating inst/include/RcppArmadilloLapack.h
** libs
g++ -I/storage/home/sosal/programs/R/R-devel/include -DNDEBUG  -I/usr/local/include -I"/storage/home/sosal/programs/R/R-devel/library/Rcpp/include"  -I../inst/include -fpic  -g -O2  -c RcppArmadillo.cpp -o RcppArmadillo.o
g++ -I/storage/home/sosal/programs/R/R-devel/include -DNDEBUG  -I/usr/local/include -I"/storage/home/sosal/programs/R/R-devel/library/Rcpp/include"  -I../inst/include -fpic  -g -O2  -c RcppExports.cpp -o RcppExports.o
g++ -I/storage/home/sosal/programs/R/R-devel/include -DNDEBUG  -I/usr/local/include -I"/storage/home/sosal/programs/R/R-devel/library/Rcpp/include"  -I../inst/include -fpic  -g -O2  -c fastLm.cpp -o fastLm.o
g++ -shared -L/usr/local/lib64 -o RcppArmadillo.so RcppArmadillo.o RcppExports.o fastLm.o -L/storage/home/sosal/programs/R/R-devel/lib -lRlapack -L/storage/home/sosal/programs/R/R-devel/lib -lRblas -lgfortran -lm
installing to /storage/home/sosal/programs/R/R-devel/library/RcppArmadillo/libs
** R
** inst
** preparing package for lazy loading
** help
*** installing help indices
** building package indices
** installing vignettes
** testing if installed package can be loaded
* DONE (RcppArmadillo)


이런 자잘한 오류들이 정말 답답하게 하는데, 천천히 검색해서 보면 은근 쉽게 해결할 수 있는것 같다.

저작자 표시 비영리 변경 금지
신고
Posted by sosal sosal

댓글을 달아 주세요

이전버튼 1 ... 27 28 29 30 31 32 33 34 35 ... 707 이전버튼