爱气象,爱气象家园! 

气象家园

 找回密码
 立即注册

QQ登录

只需一步,快速开始

新浪微博登陆

只需一步, 快速开始

搜索
查看: 4584|回复: 7

[求助] Linux(cenos7.3)安装G95的时候出现致命错误:config.h:那个文件或目录

[复制链接]

新浪微博达人勋

发表于 2017-4-29 15:15:18 | 显示全部楼层 |阅读模式

登录后查看更多精彩内容~

您需要 登录 才可以下载或查看,没有帐号?立即注册 新浪微博登陆

x
(1)在提问题之前我把本论坛156页的所有帖子快速浏览了一遍,没有找到跟我问题相关的内容,接着各种百度,各种论坛,包括centos官方论坛,g95官方网站找了,可是没有找到,最后想得到大神的指点,小弟我不胜感激。我在Linux环境的centos7.3安装G95的时候按照网上的方法如下步骤安装,安装到下列步骤时运行make命令出现了如下问题:
[root@localhost g95-0.93]# ls
aclocal.m4  BUGS           configure     dump.c        g95-config.h.in  INSTALL      lang.opt              match.c        primary.c    specs.h         trans-const.c
arith.c     ChangeLog      configure.in  entry.c       g95.h            install-sh   lang-options.c        matchexp.c     README       stamp-h1        trans-decl.c
array.c     check.c        CONTRIB       error.c       G95Manual.pdf    interface.c  libf95.a-0.93.tar.gz  misc.c         resolve.c    st.c            trans-expr.c
AUTHORS     compile        convert.c     expr.c        g95spec.c        intrinsic.c  macros.h              missing        scalarize.c  symbol.c        trans.h
autogen.sh  config.guess   COPYING       f95-lang.c    g95-support.h    intrinsic.h  Makefile              mkinstalldirs  scanner.c    TODO            trans-intrinsic.c
bbt.c       config.log     data.c        forall.c      ggc-page40.c     io.c         Makefile.am           module.c       select.c     trans-array.c   trans-io.c
bigint.c    config.status  decl.c        format.c      ggc-page41.c     iresolve.c   Makefile.in           NEWS           show.c       trans.c         trans-stmt.c
bigreal.c   config.sub     depcomp       g95-config.h  imodule.c        kinds.c      MANIFEST              parse.c        simplify.c   trans-common.c  trans-types.
[root@localhost g95-0.93]# make
make  all-am
make[1]: 进入目录“/opt/g95-0.93”
gcc -DHAVE_CONFIG_H -I.    -DTARGET_NAME=\"x86_64-unknown-linux-gnu\" -DSTANDARD_EXEC_PREFIX=\"\" -DTARGET_SYSTEM_ROOT=\"\" -DDEFAULT_TARGET_VERSION=\"\" -DDEFAULT_TARGET_MACHINE=\"\" -DTOOLDIR_BASE_PREFIX=\"\" -DSTANDARD_STARTFILE_PREFIX=\"\" -DSTANDARD_STARTFILE_PREFIX_2=\"/usr/lib64\" -DSTANDARD_EXEC_PREFIX=\"\" -DSTANDARD_BINDIR_PREFIX=\"/bin\" -DSTANDARD_LIBEXEC_PREFIX=\"\" -DG95_SPEC=\"\"  -g -O2 -Wall -Wmissing-prototypes -MT g95-g95spec.o -MD -MP -MF .deps/g95-g95spec.Tpo -c -o g95-g95spec.o `test -f 'g95spec.c' || echo './'`g95spec.c
g95spec.c:47:20: 致命错误:config.h:没有那个文件或目录
#include "config.h"
(2)我查找了官方安装G95原有的文章,我也没有找出问题来,真的很需要大神提示哪里没有做好导致这样的结果,再次表示感谢了。附上详细的原有官网的安装说明和我选择的网上安装说明步骤:
  一、官方的安装说明
General
Platform Notes
  • OSX
  • MinGW
  • Cygwin
  • Support for the -mno-cygwin option
  • Build a dll version of g95


G95 uses the 4.x release version of GCC. The 4.0.1, 4.0.2 and 4.0.3 stable versions are known to work, other versions might not.
This version is known to work, but other versions might not.
  • Download gcc from ftp://gcc.gnu.org/pub/gcc/releases/gcc-4.0.3/gcc-core-4.0.3.tar.gz
  • This version of GCC stores object files in a directory distinct from the source directories. G95 expects to find gcc object files and libraries in a directory named 'g95' under the main 'gcc-4.0.3' directory. Run the commands:cd gcc-4.0.3mkdir g95cd g95
  • The gcc 'configure' script must be run in the directory that you expect to receive the object files. Configure gcc with../configure --enable-languages=c
  • Run 'make' to build gcc. A full build isn't necessary. If you end up with libbackend.a, and libgcc.a, you've got enough to build g95. If libgcc.a isn't present, try 'make libgcc.a'.
  • Download the g95 source and unpack it in some convenient directory.
  • Change to the main g95 directory and configure with./configure --prefix=<installation directory> \
                --with-gcc-dir=<path of your GCC directory>

  • Build g95 with 'make' or 'make install' to install in the installation directory.
  • Unpack the libf95.a-0.91.tgz, configure and build it to get libf95.a. Make sure --prefix is the same as with g95.
  • Do 'make install' to build and install the library.
  • The exact name of the executable depends on the platform. Create a convenient symbolic link to this.
  • You should now be able to compile fortran 95 programs with g95.

Configure the compiler and library with --enable-F=yes to compile g95 with the F restrictions.


二、选择网上的详细安装说明如下:
二、网上我选择的详细安装说明:
根据官方说法,g95源代码编译需要gcc,可以用gcc4.0.1, gcc4.0.2, gcc4.0.3,其他的可能不行。

下载gcc
ftp://gcc.gnu.org/pub/gcc/releases/gcc-4.0.3/gcc-core-4.0.3.tar.gz
下载g95 source
http://ftp.g95.org/g95_source.tgz

将gcc-core-4.0.3.tar.gz 和 g95_source.tgz拷贝到/opt目录
$cd /opt
$tar xzvf gcc-core-4.0.3.tar.gz
$tar xzvf g95_source.tgz
$cd gcc-4.0.3
$mkdir g95
$cd g95
$../configure --enable-languages=c
$make
等待
….

开启另一个shell窗口
$cd /opt/gcc-4.0.3/g95/gcc
观察是否产生下面2个文件。
$ls libbackend.a
$ls libgcc.a

如果产生后,中断gcc的编译,因为g95的编译只需要这两个库文件即可。

切换到编译gcc的shell窗口

$cd ../../g95-0.93
$./configure –prefix=/opt/g95 –with-gcc-dir=/opt/gcc4.0.3
$make
$make install
$tar xzvf libf95.a-0.93.tar.gz
$cd libf95.a-0.93
$./configure –prefix=/opt/g95
$make
$make install
$ln –s /opt/g95/bin/*g95* /bin/g95


密码修改失败请联系微信:mofangbao

新浪微博达人勋

 楼主| 发表于 2017-4-29 15:45:51 | 显示全部楼层
我的qq号:823800859
密码修改失败请联系微信:mofangbao

新浪微博达人勋

发表于 2017-5-5 09:16:13 | 显示全部楼层
建议参照http://www.cnblogs.com/coyu/p/5750627.html试试,亲测有效
密码修改失败请联系微信:mofangbao

新浪微博达人勋

 楼主| 发表于 2017-5-13 18:30:59 | 显示全部楼层
风之精灵 发表于 2017-5-5 09:16
建议参照http://www.cnblogs.com/coyu/p/5750627.html试试,亲测有效

朋友你说的是不是把GCC升级之后,然后用g95?
密码修改失败请联系微信:mofangbao

新浪微博达人勋

发表于 2017-5-14 10:41:43 | 显示全部楼层
玄奘老乡 发表于 2017-5-13 18:30
朋友你说的是不是把GCC升级之后,然后用g95?

是升级,重点是使用OS系统的命令去升级,在升级的过程中会自动安装相关依赖的库等,比起自己编译安装省事很多,一般也不会丢失文件
密码修改失败请联系微信:mofangbao

新浪微博达人勋

 楼主| 发表于 2017-7-22 10:50:20 | 显示全部楼层
风之精灵 发表于 2017-5-14 10:41
是升级,重点是使用OS系统的命令去升级,在升级的过程中会自动安装相关依赖的库等,比起自己编译安装省事 ...

是的 ,我现在用的就是这个gfortran  是在gcc升级之后的软件程序,已经能用
密码修改失败请联系微信:mofangbao

新浪微博达人勋

 楼主| 发表于 2017-7-22 10:52:02 | 显示全部楼层
玄奘老乡 发表于 2017-5-13 18:30
朋友你说的是不是把GCC升级之后,然后用g95?

差不多吧,我升级之后用的gcc下边的 gfortran
密码修改失败请联系微信:mofangbao

新浪微博达人勋

 楼主| 发表于 2017-7-22 10:53:22 | 显示全部楼层
风之精灵 发表于 2017-5-5 09:16
建议参照http://www.cnblogs.com/coyu/p/5750627.html试试,亲测有效

这是一种可行的办法。
密码修改失败请联系微信:mofangbao
您需要登录后才可以回帖 登录 | 立即注册 新浪微博登陆

本版积分规则

Copyright ©2011-2014 bbs.06climate.com All Rights Reserved.  Powered by Discuz! (京ICP-10201084)

本站信息均由会员发表,不代表气象家园立场,禁止在本站发表与国家法律相抵触言论

快速回复 返回顶部 返回列表