nuistjdc的个人博客分享 http://blog.sciencenet.cn/u/nuistjdc

博文

[WRF] proc_oml.f executed by gfortran

已有 5237 次阅读 2014-12-2 12:46 |个人分类:模式运行|系统分类:科研笔记

In the website of WRF, we can download the code proc_oml.f to couple the Ocean Mixed Layer (OML) with WRF. But the program doesn't provide the method to execute this program by gfortran, the command should execute as follow:

gfortran proc_oml.f -L/usr/lib -lnetcdf -I/usr/include -ffree-form -fconvert=big-endian -frecord-marker=4 -o proc_oml

We may met this problem: /tmp/ccd2QEN4.o: In function `MAIN__':
proc_oml.f:(.text+0x160): undefined reference to `iargc_'

Then, we should create a new progrom named gfortran_iargc.c:

extern int _gfortran_iargc(void);
int iargc_()
{
return _gfortran_iargc();
}

Submit the program by command:

1. gfortran -c gfortran_iargc.c

2. gfortran gfortran_iargc.o proc_oml.f -L/usr/lib -lnetcdf -I/usr/include -ffree-form -fconvert=big-endian -frecord-marker=4  -o proc_oml

Maybe meet the problem as following:

/tmp/ccx9pN2A.o: In function `MAIN__':
proc_oml.f:(.text+0x647): undefined reference to `nf_open_'
proc_oml.f:(.text+0x6a1): undefined reference to `nf_inq_'
proc_oml.f:(.text+0xc0d): undefined reference to `nf_inq_dim_'
proc_oml.f:(.text+0x1182): undefined reference to `nf_inq_var_'
proc_oml.f:(.text+0x11e1): undefined reference to `nf_def_var_'
proc_oml.f:(.text+0x12b7): undefined reference to `nf_inq_attname_'
proc_oml.f:(.text+0x12f6): undefined reference to `nf_copy_att_'
proc_oml.f:(.text+0x13e8): undefined reference to `nf_enddef_'
proc_oml.f:(.text+0x146c): undefined reference to `nf_inq_var_'
proc_oml.f:(.text+0x1862): undefined reference to `nf_get_var_text_'
proc_oml.f:(.text+0x1ad9): undefined reference to `nf_get_var_int_'
proc_oml.f:(.text+0x1e04): undefined reference to `nf_get_var_real_'
proc_oml.f:(.text+0x2283): undefined reference to `nf_get_var_real_'
proc_oml.f:(.text+0x2b00): undefined reference to `nf_get_var_real_'
proc_oml.f:(.text+0x3283): undefined reference to `nf_get_var_double_'
proc_oml.f:(.text+0x34cb): undefined reference to `nf_get_var_double_'
collect2: ld returned 1 exit status

Add a short command -lnetcdff, just as this:

gfortran gfortran_iargc.o proc_oml.f -L/usr/lib -lnetcdf -lnetcdff -I/usr/include -ffree-form -fconvert=big-endian -frecord-marker=4  -o proc_oml

OR:

gfortran gfortran_iargc.o oml.f -L/usr/lib -lnetcdf -lnetcdff -I/usr/include -ffree-form -o oml


So that, we can get the proc_oml with no error.



https://blog.sciencenet.cn/blog-728999-847896.html

上一篇:关于CESM模式移植、运行过程中遇到的一些问题
收藏 IP: 163.143.166.*| 热度|

0

该博文允许注册用户评论 请点击登录 评论 (0 个评论)

数据加载中...

Archiver|手机版|科学网 ( 京ICP备07017567号-12 )

GMT+8, 2024-12-21 21:56

Powered by ScienceNet.cn

Copyright © 2007- 中国科学报社

返回顶部