NETCDF C and FORTRAN 4.2 安装笔记

目录

步骤一、安装ifort编译器

步骤二、安装zlib

步骤三、安装hdf5

步骤四、安装netcdf-c-4.2

步骤五、安装netcdf-fortran-4.2

步骤六、设置环境变量

REFFERENCES

Intel® oneAPI Toolkits Installation Guide for Linux* OS:REFFERENCES


将安装过程遇到的主要问题记在前面,越早的版本坑越多,使新不使旧,使旧令人肝肠乱┭┮﹏┭┮

  • ifort的环境变量设置:source /opt/intel/parallel_studio_xe_2020.1.102/bin/psxevars.sh intel64
  • hdf5安装中,sudo make check install 步骤加上-i选项可解决testh5dump.sh.chkexe错误
  • netcdf-fortran-4.2安装除了需要打补丁之外,最好使用普通用户模式
  • 遇到安装错误,若其他人的解决方案都无法生效,可以先试下回退整个安装过程,重新解压。

步骤一、安装ifort编译器

***以YUM安装工具为例。如有安装过其他版本的ifort,请先卸载!

rpm -qa | grep intel | awk '{print "yum remove -y",$1}' > uninstall.sh

查看uninstall.sh文件,删除其中不以intel开头的包。然后用root权限执行该脚本即可。

1、作为普通用户在/temp 目录中创建 YUM (DNF) repo 文件:

tee > /tmp/oneAPI.repo << EOF

[oneAPI]

name=Intel® oneAPI repository

baseurl=https://yum.repos.intel.com/oneapi

enabled=1

gpgcheck=1

repo_gpgcheck=1

gpgkey=https://yum.repos.intel.com/intel-gpg-keys/GPG-PUB-KEY-INTEL-SW-PRODUCTS.PUB

EOF

2、移动新创建的oneAPI.repo文件到 YUM/DNF 配置目录:

sudo mv /tmp/oneAPI.repo /etc/yum.repos.d

3、在某些情况下,rpm 可能需要通过以下方式显式导入密钥:

rpm --import https://yum.repos.intel.com/intel-gpg-keys/GPG-PUB-KEY-INTEL-SW-PRODUCTS.PUB

4、更新源,使用以下命令安装所需的包(示例程序安装的是32位版本。需要15G存储。):

sudo yum install intel-hpckit-32bit

5、配置环境变量

export IFORT=/opt/intel/oneapi/compiler/2021.3.0/linux

export PATH=$PATH:$IFORT/bin/intel64

export LD_LIBRARY_PATH=$IFORT/lib:$LD_LIBRARY_PATH

问题解决: intel的库文件路径配置错误。

source /opt/intel/oneapi/setvars.sh

步骤二、安装zlib

1、解压并进入解压文件夹,运行以下指令:

./configure --prefix=/home/evelyn/software

make check

make install

步骤三、安装hdf5

1、解压并进入解压文件夹,运行以下指令:

./configure --with-zlib=/home/evelyn/software --prefix=/home/evelyn/software

make

sudo make check

make install

步骤四、安装netcdf-c-4.2

1、安装netcdf-c-4.2需要先安装automake和libtool、doxygen。

2、生成configure

aclocal

autoconf

autoheader

automake --add-missing

出现问题:error: configure.ac:188:required file 'ltmain.sh'

解决:autoreconf  -ivf

3、安装netcdf-c-4.2

CPPFLAGS=-I/home/evelyn/software/include/ LDFLAGS=-L/home/evelyn/software/lib/ ./configure --prefix=/home/evelyn/software/ --disable-dap

make

make check

make install

步骤五、安装netcdf-fortran-4.2

1、生成configure

aclocal

autoconf

autoheader

automake --add-missing

2、安装netcdf-fortran前一定要配置环境变量★

export LD_LIBRARY_PATH=/home/evelyn/software/lib/:${LD_LIBRARY_PATH}

3、安装netcdf-Fortran

CPPFLAGS=-I/home/evelyn/software/include/ LDFLAGS=-L/home/evelyn/software/lib/ ./configure --prefix=/home/evelyn/software/

make

make check

make install

出现问题 1:/home/evelyn/installPackage/netcdf-fortran-4.2/netcdf-fortran-netcdf-fortran-4.2/missing: 行 81: makeinfo:未找到命令

WARNING: 'makeinfo' is missing on your system.

解决:安装texinfo

出现问题2:

解决:将补丁拷贝至man4文件夹中,执行

patch < patch.patch

步骤六、设置环境变量

export NETCDF=/home/evelyn/software

export LD_LIBRARY_PATH=$NETCDF/lib:$LD_LIBRARY_PATH

export PATH=$NETCDF/bin:$PATH

REFFERENCES

Intel® oneAPI Toolkits Installation Guide for Linux* OS:REFFERENCES

YUM, DNF, Zypper

Re: [netcdfgroup] netcdf-fortran-4.2 build failed(补丁文件随后附上)

Re: [netcdfgroup] netcdf-fortran-4.2 build failed

--- man4/netcdf-f90.texi        (revision 57)

+++ man4/netcdf-f90.texi        (working copy)

@@ -2127,7 +2127,6 @@

 The name of the

 group will be copied to this character array. The name will be less

 than NF90_MAX_NAME in length.

-@item

 @end table

@@ -7023,7 +7022,7 @@

 @node FORTRAN 77 to Fortran 90 Transition Guide, Combined Index, Summary of Fortran 90 Interface, Top

 @appendix Appendix B - FORTRAN 77 to Fortran 90 Transition Guide

-@unnumberedsubsec The new Fortran 90 interface

+@unnumberedsec The new Fortran 90 interface

 The Fortran 90 interface to the netCDF library closely follows the

 FORTRAN 77 interface. In most cases, function and constant names and

@@ -7045,7 +7044,7 @@

 versions may be implemented entirely in Fortran 90, adding additional

 error checking possibilities.

-@unnumberedsubsec Changes to Inquiry functions

+@unnumberedsec Changes to Inquiry functions

 In the Fortran 90 interface there are two inquiry functions each for

 dimensions, variables, and attributes, and a single inquiry function

@@ -7079,7 +7078,7 @@

  INTEGER FUNCTION  NF_INQ_ATTNAME    (NCID, VARID, ATTNUM, name)

 @end example

-@unnumberedsubsec Changes to put and get function

+@unnumberedsec Changes to put and get function

  • 1
    点赞
  • 5
    收藏
    觉得还不错? 一键收藏
  • 2
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值