build.bash problem "unexpected EOF"

Report or discuss software problems and other woes

Moderators: arango, robertson

Post Reply
Message
Author
pengjack
Posts: 6
Joined: Sat Mar 09, 2013 5:54 pm
Location: Dalian Naval Academy

build.bash problem "unexpected EOF"

#1 Unread post by pengjack »

Dear all,
I am a new user of ROMS. When I execute the build script "build.bash" according to the wiki ROMS webpage about "Installing and Running ROMS for First Time Users", there is always a problem. The error message is listed as below:
----------------------------------------------------------------------------------------------------
cd /home/roms/Projects/upwelling/Build; /usr/bin/gfortran -c -frepack-arrays -g -fbounds-check -ffree-form -ffree-line-length-none mod_netcdf.f90
致命错误: 读出模块 netcdf,于行 1 列 1:Unexpected EOF
make: *** [/home/roms/Projects/upwelling/Build/mod_netcdf.o] 错误 1
------------------------------------------------------------------------------------------------------
The Chinese words mean that, "fatal error: read out module netcdf in line 1 row 1: Unexpected EOF
make: *** [/home/roms/Projects/upwelling/Build/mod_netcdf.o] error 1"
I have tried many ways to correct it, such as reinstalling netcdf, putting a "#" in line 1 row 1 of mod_netcdf.f90, and so on, but did not work. Sometimes the file could be others instead of mod_netcdf.o, and so I think it should be the problem of netcdf but I do not know how to solve it. I shall be crazy. Does anyone know what is the matter and how to solve the problem?
Please tell me. Thank you very much!!

User avatar
kate
Posts: 4091
Joined: Wed Jul 02, 2003 5:29 pm
Location: CFOS/UAF, USA

Re: build.bash problem "unexpected EOF"

#2 Unread post by kate »

The problem is with reading a file called netcdf.mod. It gets created when you build the Fortran 90 interface to Netcdf. This file must be created with the same compiler - and the same version of the compiler - as you use to build ROMS. I expect it found one built by a different compiler.

During the ROMS build procedure, it tries to find this netcdf.mod file and copy it into your Build directory. It looks in the $NETCDF_INCDIR directory or the place pointed to by nc-config --prefix with /include appended.

pengjack
Posts: 6
Joined: Sat Mar 09, 2013 5:54 pm
Location: Dalian Naval Academy

Re: build.bash problem "unexpected EOF"

#3 Unread post by pengjack »

I have modified the file 'buld.bash' according to what kate said and the problem of 'unexpected EOF' has been solved. However, another problem occured. The error message is about as follows:
-----------------------------------------------------------------------------------------------------
/home/roms/Projects/upwelling/Build/def_var.f90:615: undefined reference to `__netcdf_MOD_nf90_put_att_text'
/home/roms/Projects/upwelling/Build/def_var.f90:632: undefined reference to `__netcdf_MOD_nf90_put_att_text'
/home/roms/Projects/upwelling/Build/libUTIL.a(nf_fread2d.o): In function `__nf_fread2d_mod_MOD_nf_fread2d':
/home/roms/Projects/upwelling/Build/nf_fread2d.f90:213: undefined reference to `__netcdf_MOD_nf90_get_var_1d_eightbytereal'
/home/roms/Projects/upwelling/Build/libUTIL.a(nf_fread4d.o): In function `__nf_fread4d_mod_MOD_nf_fread4d':
/home/roms/Projects/upwelling/Build/nf_fread4d.f90:203: undefined reference to `__netcdf_MOD_nf90_get_var_1d_eightbytereal'
/home/roms/Projects/upwelling/Build/libUTIL.a(def_dim.o): In function `def_dim_':
/home/roms/Projects/upwelling/Build/def_dim.f90:56: undefined reference to `__netcdf_MOD_nf90_def_dim'
/home/roms/Projects/upwelling/Build/libUTIL.a(nf_fread3d.o): In function `__nf_fread3d_mod_MOD_nf_fread3d':
/home/roms/Projects/upwelling/Build/nf_fread3d.f90:200: undefined reference to `__netcdf_MOD_nf90_get_var_1d_eightbytereal'
/home/roms/Projects/upwelling/Build/libUTIL.a(def_info.o): In function `def_info_':
/home/roms/Projects/upwelling/Build/def_info.f90:157: undefined reference to `__netcdf_MOD_nf90_put_att_text'
/home/roms/Projects/upwelling/Build/def_info.f90:169: undefined reference to `__netcdf_MOD_nf90_put_att_text'
/home/roms/Projects/upwelling/Build/def_info.f90:183: undefined reference to `__netcdf_MOD_nf90_put_att_text'
/home/roms/Projects/upwelling/Build/def_info.f90:232: undefined reference to `__netcdf_MOD_nf90_put_att_text'
/home/roms/Projects/upwelling/Build/def_info.f90:244: undefined reference to `__netcdf_MOD_nf90_put_att_text'
/home/roms/Projects/upwelling/Build/libUTIL.a(def_info.o):/home/roms/Projects/upwelling/Build/def_info.f90:253: more undefined references to `__netcdf_MOD_nf90_put_att_text' follow

/home/roms/Projects/upwelling/Build/mod_netcdf.f90:1683: undefined reference to `__netcdf_MOD_nf90_get_var_3d_eightbytereal'
/home/roms/Projects/upwelling/Build/libMODS.a(mod_netcdf.o): In function `__mod_netcdf_MOD_netcdf_get_fvar_2d':
/home/roms/Projects/upwelling/Build/mod_netcdf.f90:212: undefined reference to `__netcdf_MOD_nf90_inquire'
/home/roms/Projects/upwelling/Build/mod_netcdf.f90:222: undefined reference to `__netcdf_MOD_nf90_inquire_dimension'
collect2: ld return 1
make: *** [/home/roms/Projects/upwelling/oceanG] error 1
-------------------------------------------------------------------------------------------------
I tried to add the sentence "include 'netcdf.inc' " in the file 'buld.bash' but it did not work.
Do you know how to solve?
Thank you from my inner heart!
Last edited by pengjack on Wed Apr 10, 2013 2:06 pm, edited 1 time in total.

pengjack
Posts: 6
Joined: Sat Mar 09, 2013 5:54 pm
Location: Dalian Naval Academy

Re: build.bash problem "unexpected EOF"

#4 Unread post by pengjack »

I have installed netcdf and netcdf-devel by 'yum install *' but it seems that the script could not use the yum netcdf. Therefore, I installed the netcdf manually with the source code and activated 'USE_MY_LIBS=on' and then specified my location for netcdf. Besides, I used gfortran compiler so I modified the path corresponding to that. After those modification, the problem about 'unexpected EOF' was solved but this new problem about 'undefined reference to *' appeared.
Today I tried another method because I thought it might be conflict between the yum installed netcdf and my manual installed netcdf so I removed the yum netcdf and then execute the build.bash. There is a new error message as follows:
--------------------------------------------------------------------
/home/roms/Projects/upwelling/Build/libMODS.a -L/usr/local/netcdf/lib -lnetcdf
/usr/bin/ld: cannot find -lnetcdf
collect2: ld return 1
make: *** [/home/roms/Projects/upwelling/oceanG] error 1
-----------------------------------------------------------------

If someone know how to solve it, please tell me. I appreciate you very much!

User avatar
kate
Posts: 4091
Joined: Wed Jul 02, 2003 5:29 pm
Location: CFOS/UAF, USA

Re: build.bash problem "unexpected EOF"

#5 Unread post by kate »

Does anything here help? Read what's here as well.

Post Reply