2017-02-10 77 views
0

主要目标是使用DiffBind(R软件包)分析我的ChIPseq数据。/usr/bin/ld:在R中安装'RcppArmadillo'时找不到-lgfortran

(我发现another post这可能是有关我的问题,并试图从中提取的解决方案,但我猜的内容过于“先进”我...)

继建议,我might need to update my DiffBind 我试图安装它的新版本。

通过检查dependency of DiffBind我猜测以前的安装会自动安装旧版本的DiffBind,因为我的R不符合当前版本的DiffBind的要求。

但我在根目录下使用R,对此我无能为力。所以我决定在我自己的目录下安装更新版本的R。我managed to do that.

然后我试图安装DiffBind的当前版本中,我得到了错误

ERROR: compilation failed for package ‘RcppArmadillo’ 

原来依赖的lib“RcppArmadillo”需要更先进的最新编译器,再次,我在根目录下使用了gcc编译器,所以我在我自己的目录下安装了一个新版本的gcc。

$ gcc --version 

    gcc (GCC) 6.1.0 

    Copyright (C) 2016 Free Software Foundation, Inc. 

    This is free software; see the source for copying conditions. There is NO 

    warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 

    $ which gcc 

/$HOME/Programme/gcc-6.1.0/bin//gcc 

之后,我尝试安装DiffBind(RcppArmadillo)又一次,却遇到了另一个错误:

* 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... (6.1.0) yes 
checking LAPACK_LIBS... fallback LAPACK from R 3.3.0 or later used 
configure: creating ./config.status 
config.status: creating inst/include/RcppArmadilloLapack.h 
** libs 
g++ -I/$HOME/Programme/R-3.3.1/lib64/R/include -DNDEBUG -I//$HOME/Programme/zlib-1.2.11/include -I//$HOME/Programme/bzip2-1.0.6/include -I//$HOME/Programme/xz-5.2.3/include -I//$HOME/Programme/pcre-8.40/include -I//$HOME/Programme/curl-7.52.1/include -I"/$HOME/Programme/R-3.3.1/lib64/R/library/Rcpp/include" -I../inst/include -fpic -g -O2 -c RcppArmadillo.cpp -o RcppArmadillo.o 
g++ -I/$HOME/Programme/R-3.3.1/lib64/R/include -DNDEBUG -I//$HOME/Programme/zlib-1.2.11/include -I//$HOME/Programme/bzip2-1.0.6/include -I//$HOME/Programme/xz-5.2.3/include -I//$HOME/Programme/pcre-8.40/include -I//$HOME/Programme/curl-7.52.1/include -I"/$HOME/Programme/R-3.3.1/lib64/R/library/Rcpp/include" -I../inst/include -fpic -g -O2 -c RcppExports.cpp -o RcppExports.o 
g++ -I/$HOME/Programme/R-3.3.1/lib64/R/include -DNDEBUG -I//$HOME/Programme/zlib-1.2.11/include -I//$HOME/Programme/bzip2-1.0.6/include -I//$HOME/Programme/xz-5.2.3/include -I//$HOME/Programme/pcre-8.40/include -I//$HOME/Programme/curl-7.52.1/include -I"/$HOME/Programme/R-3.3.1/lib64/R/library/Rcpp/include" -I../inst/include -fpic -g -O2 -c fastLm.cpp -o fastLm.o 
g++ -shared -L/$HOME/Programme/R-3.3.1/lib64/R/lib -L//$HOME/Programme/zlib-1.2.11/lib -L//$HOME/Programme/bzip2-1.0.6/lib -L//$HOME/Programme/xz-5.2.3/lib -L//$HOME/Programme/pcre-8.40/lib -L//$HOME/Programme/curl-7.52.1/lib -o RcppArmadillo.so RcppArmadillo.o RcppExports.o fastLm.o -L/$HOME/Programme/R-3.3.1/lib64/R/lib -lRlapack -L/$HOME/Programme/R-3.3.1/lib64/R/lib -lRblas -lgfortran -lm -L/$HOME/Programme/R-3.3.1/lib64/R/lib -lR 
/usr/bin/ld: cannot find -lgfortran 
collect2: error: ld returned 1 exit status** 

事实证明,gfortran找不到。 但是当我检查的gfortran存在它存在:

$ which gfortran 

/usr/bin/gfortran 

$ gfortran --version 

GNU Fortran (GCC) 4.4.7 20120313 (Red Hat 4.4.7-17) 

Copyright (C) 2010 Free Software Foundation, Inc. 



GNU Fortran comes with NO WARRANTY, to the extent permitted by law. 

You may redistribute copies of GNU Fortran 

under the terms of the GNU General Public License. 

For more information about these matters, see the file named COPYING 

所以我认为GCC找不到gfortran,这是根目录下。 我怎么能解决这个问题? 或者gcc和gfortran之间的不匹配可能是问题吗?如果是这样的话,可以做些什么来规避呢?

我的[R版本:

> sessionInfo() 
R version 3.3.1 (2016-06-21) 
Platform: x86_64-pc-linux-gnu (64-bit) 
Running under: Red Hat Enterprise Linux Server release 6.7 (Santiago) 

locale: 
[1] LC_CTYPE=ja_JP.UTF-8  LC_NUMERIC=C    
[3] LC_TIME=ja_JP.UTF-8  LC_COLLATE=ja_JP.UTF-8  
[5] LC_MONETARY=ja_JP.UTF-8 LC_MESSAGES=ja_JP.UTF-8 
[7] LC_PAPER=ja_JP.UTF-8  LC_NAME=C     
[9] LC_ADDRESS=C    LC_TELEPHONE=C    
[11] LC_MEASUREMENT=ja_JP.UTF-8 LC_IDENTIFICATION=C  

attached base packages: 
[1] stats  graphics grDevices utils  datasets methods base 
+0

你的g ++版本是6.1,但gfortran很旧4.4。这很奇怪。如果你安装了新的GCC,你应该完全安装它,包括Fortran部分。 –

+0

@ VladimirF。嗨VladimirF。 gfortran安装在根目录中,而gcc由我自己安装在我自己的目录中。这也许可以解释为什么g ++和gfortran的版本不匹配。您的评论似乎意味着如果安装了新的GCC,将自动安装Fortran。所以我想我搞砸了一些东西,或者错过了一些选择。你有什么想法吗? – Jun

+0

Gfortran是GCC软件包的一部分。这是一个可选部分,但在这种情况下,您确实希望将其包含在内。这取决于你如何安装GCC。 –

回答

0

我觉得这里提到的问题已经解决。 由于VladimirF在评论中提到,当我安装新版本的gcc时,我没有启用Fortran,这不是默认设置,所以gfortran没有安装在我以前的尝试中。

我删除了我以前的GCC,以及如下重新编译它:

tar -xvf gcc-6.1.0.tar.gz 
cd gcc-6.1.0 
./contrib/download_prerequisites 
mkdir build 
cd build 
../configure --prefix=$HOME/Programme/gcc-6.1.0 --enable-languages=c,c++,fortran --disable-multilib 
make -j 8 
make install 

设定的路径为新的gcc和lib

它的工作!