如何使用sudo yum install安装Fortran -dev软件包 [英] how to install Fortran -dev package using sudo yum install

查看:157
本文介绍了如何使用sudo yum install安装Fortran -dev软件包的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经安装(GCC)4.7.2 20121015(Red Hat 4.7.2-5),并且jave还安装了yum install gcc-gfortran. (软件包gcc-gfortran-4.4.7-18.el6.x86_64)

I have installed (GCC) 4.7.2 20121015 (Red Hat 4.7.2-5) already and jave also installed yum install gcc-gfortran . (Package gcc-gfortran-4.4.7-18.el6.x86_64)

但是我遇到了类似的错误:

But I'm getting error like :

/usr/bin/ld: cannot find -lgfortran
collect2: error: ld returned 1 exit status
make: *** [quadprog.so] Error 1

请帮助我安装-lgfortran.似乎我需要安装提供Fortran库的Fortran -dev软件包".我不知道如何在RedHat/CentOS中做到这一点.请帮忙.我在执行此操作时遇到了困难.

Please help me in installing -lgfortran. It seems like I need to install "Fortran -dev package providing the Fortran library". I do not know how to do that in RedHat/CentOS. Please help. I'm facing hard time in doing this.

我尝试使用以下方法安装libgfortran:

I have tried installing libgfortran using:

yum install libgfortran

但是它说:

已安装软件包libgfortran-4.4.7-18.el6.x86_64和最新版本 没事做 (在交互式会话中运行,跳过干净的步骤.)

Package libgfortran-4.4.7-18.el6.x86_64 already installed and latest version Nothing to do (Running in an interactive session, skipping clean step.)

更多信息: 我尝试为R安装软件包quadprog,以下是日志:

More Info: I tried installing package quadprog for R and below are the logs:

install.packages('https://cran.cnr.berkeley.edu/src/contrib/quadprog_1.5-5.tar.gz',dependencies = TRUE,repos = NULL,type ="source")
Installing package into '/usr/lib64/R/library'
(as 'lib' is unspecified)
trying URL 'https://cran.cnr.berkeley.edu/src/contrib/quadprog_1.5-5.tar.gz'
Content type 'application/x-gzip' length 33651 bytes (32 KB)
==================================================
downloaded 32 KB

* installing *source* package 'quadprog' ...
** package 'quadprog' successfully unpacked and MD5 sums checked
** libs
gfortran -m64  -fvisibility=hidden -fpic  -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic -I/usr/lib64/gfortran/modules  -c aind.f -o aind.o
gcc -m64 -std=gnu99 -I/usr/include/R -DNDEBUG   -I/usr/local/include   -fpic  -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic -fpic -fPIC   -c init.c -o init.o
gfortran -m64 -fvisibility=hidden -fpic -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic -I/usr/lib64/gfortran/modules -ffloat-store   -c -o solve.QP.compact.o solve.QP.compact.f
solve.QP.compact.f:254.3:

 72   if (nvl .EQ. 0) then                                              
   1
Warning: Label 72 at (1) defined but not used
solve.QP.compact.f:302.2:

 7       t1inf = .FALSE.                                                
  1
Warning: Label 7 at (1) defined but not used
solve.QP.compact.f: In function 'qpgen1':
solve.QP.compact.f:94: warning: 'it1' may be used uninitialized in this function
solve.QP.compact.f:98: warning: 't1' may be used uninitialized in this function
gfortran -m64 -fvisibility=hidden -fpic -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic -I/usr/lib64/gfortran/modules -ffloat-store   -c -o solve.QP.o solve.QP.f
solve.QP.f:245.3:

 72   if (nvl .EQ. 0) then                                              
   1
Warning: Label 72 at (1) defined but not used
solve.QP.f:293.2:

 7       t1inf = .FALSE.                                                
  1
Warning: Label 7 at (1) defined but not used
solve.QP.f: In function 'qpgen2':
solve.QP.f:85: warning: 'it1' may be used uninitialized in this function
solve.QP.f:89: warning: 't1' may be used uninitialized in this function
gfortran -m64  -fvisibility=hidden -fpic  -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic -I/usr/lib64/gfortran/modules  -c util.f -o util.o
gcc -m64 -std=gnu99 -shared -L/usr/lib64/R/lib -o quadprog.so aind.o init.o solve.QP.compact.o solve.QP.o util.o -L/usr/lib64/R/lib -lRblas -lgfortran -lm -lgfortran -lm -L/usr/lib64/R/lib -lR
/usr/bin/ld: cannot find -lgfortran
collect2: error: ld returned 1 exit status
make: *** [quadprog.so] Error 1
ERROR: compilation failed for package 'quadprog'
* removing '/usr/lib64/R/library/quadprog'
Warning message:
In install.packages("https://cran.cnr.berkeley.edu/src/contrib/quadprog_1.5-5.tar.gz",  :
  installation of package '/tmp/Rtmpry5XTG/downloaded_packages/quadprog_1.5-5.tar.gz' had non-zero exit status

bash-4.1# rpm -ql libgfortran
/usr/lib64/libgfortran.so.3
/usr/lib64/libgfortran.so.3.0.0

推荐答案

以下编译行在/usr/lib64/R/lib中寻找libgfortran,但该库不存在.因此,链接器错误.

The following compile line was looking for libgfortran at /usr/lib64/R/lib but the library is not there. Hence, the linker error.

gcc -m64 -std=gnu99 -shared -L/usr/lib64/R/lib -o quadprog.so aind.o init.o solve.QP.compact.o solve.QP.o util.o -L/usr/lib64/R/lib -lRblas -lgfortran -lm -lgfortran -lm -L/usr/lib64/R/lib -lR

因为我们无法找到和修改makefile.我们创建了到/usr/lib64/libgfortran.so.3的符号链接/usr/lib64/R/lib/libgfortran.so,然后重新运行安装步骤,它可以解决链接器错误.

As we could not locate and modify the makefile. We created a symbolic link /usr/lib64/R/lib/libgfortran.so to /usr/lib64/libgfortran.so.3 and rerun the installation steps and it resolves the linker error.

这是我们可以解决的解决方案

This is a work around that we follow which resolves the issue

这篇关于如何使用sudo yum install安装Fortran -dev软件包的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆