Fatal erorr after update to ubuntu 20.04

Report or discuss software problems and other woes

Moderators: arango, robertson

Post Reply
Message
Author
luhputria
Posts: 14
Joined: Tue Mar 31, 2020 3:43 am
Location: The University of Western Australia

Fatal erorr after update to ubuntu 20.04

#1 Unread post by luhputria »

Hi all,

I don't know if my problem is faced by the others.
I already used roms during this 6months and get the .nc file as a result.
Until 2 days ago, I updated Ubuntu to 20.04. and when I try to run
./build_roms.sh, I get a notification:

"mod_netcdf.f90:19:10:
19 | USE netcdf
1
Fatal error: Cannot read module file 'netcdf.mod' opened at (1), because it
was created by a different version of GNU fortran.
Compilation terminated."


and this problem, I never experienced before updating ubuntu.

here is the version of my netcdf and gfortran.
nc-config --version : netCDF 4.7.4
gfortran --version: GNU Fortran (Ubuntu 9.3.0-17ubuntu~20.04) 9.3.0

does anyone have a solution to my problem? or do I have to downgrade the
version of gfortran?

Thanks before.
Luh

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

Re: Fatal erorr after update to ubuntu 20.04

#2 Unread post by kate »

What I would do is recompile netcdf-fortran. Did you compile it yourself before or use the one from "apt install"?

User avatar
robertson
Site Admin
Posts: 219
Joined: Wed Feb 26, 2003 3:12 pm
Location: IMCS, Rutgers University

Re: Fatal erorr after update to ubuntu 20.04

#3 Unread post by robertson »

During the upgrade to ubuntu 20.04 the GNU Compilier Suite was likely upgraded to version 9.3. Assuming you built NetCDF 4.7.4 yourself, your options are: build NetCDF again with the new compiler, downgrade the compiler, or install the libnetcdff-dev and netcdf-bin packages (this will also install a host of other required software and will also recommend some other packages you might want to install) available from Ubuntu. The last option would technically be a downgrade of NetCDF (4.7.4 -> 4.7.3).

For the downgrading option, since it's UBUNTU, it's likely that your previous version of the compiler is still installed. Try running

Code: Select all

ls -l /usr/bin/gfortran*
and see if your previous version of gfortran is listed. If it is you can update your /usr/bin/gfortran link to the gfortran version you need. First see what "alternatives" are setup with "update-alternatives --query gfortran". You should see some output like this:

Code: Select all

$ update-alternatives --query gfortran
Name: gfortran
Link: /usr/bin/gfortran
Status: auto
Best: /usr/bin/gfortran-9
Value: /usr/bin/gfortran-9

Alternative: /usr/bin/gfortran-8
Priority: 50

Alternative: /usr/bin/gfortran-9
Priority: 60
You will then want to issue the following command using a number higher than the "Priority" listed for gfortran-9 (replacing gfortran-8 with your previous version):

Code: Select all

sudo update-alternatives --install /usr/bin/gfortran gfortran /usr/bin/gfortran-8 70
Even if your previous version is not listed as an "Alternative", as long as it was listed with that ls command, the above command should work.

Post Reply