[GCC] Compilation: `... part of the GNU C Library.`, `... not a GNU Fortran module file`, `Can't exec "mpif90"` or `... created by a different version of GNU Fortran`

Dear users, I am really thankful that anyone can help me to resolve the compiling error message; please find the attached ‘.fcm’ file as reference.

Cheers,
Farshid

/home/ollie/fdaryabo/NEMO/nemo4_dev/cfgs/NORDIC_prod/BLD/ppsrc/nemo/par_kind.f90:1:1:

/* Copyright (C) 1991-2012 Free Software Foundation, Inc.

1

Error: Invalid character in name at (1)

/home/ollie/fdaryabo/NEMO/nemo4_dev/cfgs/NORDIC_prod/BLD/ppsrc/nemo/cyclone.f90:1:1:

/* Copyright (C) 1991-2012 Free Software Foundation, Inc.

1

Error: Invalid character in name at (1)

/home/ollie/fdaryabo/NEMO/nemo4_dev/cfgs/NORDIC_prod/BLD/ppsrc/nemo/asmpar.f90:1:1:

/* Copyright (C) 1991-2012 Free Software Foundation, Inc.

1

Error: Invalid character in name at (1)

/home/ollie/fdaryabo/NEMO/nemo4_dev/cfgs/NORDIC_prod/BLD/ppsrc/nemo/obs_types.f90:1:1:

/* Copyright (C) 1991-2012 Free Software Foundation, Inc.

1

Error: Invalid character in name at (1)

/home/ollie/fdaryabo/NEMO/nemo4_dev/cfgs/NORDIC_prod/BLD/ppsrc/nemo/flo_oce.f90:1:1:

:
Error: Invalid character in name at (1)
/home/ollie/fdaryabo/NEMO/nemo4_dev/cfgs/NORDIC_prod/BLD/ppsrc/nemo/obs_types.f90:2:3:

    This file is part of the GNU C Library.
   1
Error: Unclassifiable statement at (1)
/home/ollie/fdaryabo/NEMO/nemo4_dev/cfgs/NORDIC_prod/BLD/ppsrc/nemo/diahth.f90:2:3:

    This file is part of the GNU C Library.
   1
Error: Unclassifiable statement at (1)
/home/ollie/fdaryabo/NEMO/nemo4_dev/cfgs/NORDIC_prod/BLD/ppsrc/nemo/diaharm.f90:2:3:

    This file is part of the GNU C Library.
   1
Error: Unclassifiable statement at (1)
/home/ollie/fdaryabo/NEMO/nemo4_dev/cfgs/NORDIC_prod/BLD/ppsrc/nemo/floats.f90:2:3:

    This file is part of the GNU C Library.
   1
Error: Unclassifiable statement at (1)
/home/ollie/fdaryabo/NEMO/nemo4_dev/cfgs/NORDIC_prod/BLD/ppsrc/ioipsl/nc4interface.f90:2:3:
:
Error: Unclassifiable statement at (1)
/home/ollie/fdaryabo/NEMO/nemo4_dev/cfgs/NORDIC_prod/BLD/ppsrc/nemo/obs_types.f90:4:3:

    The GNU C Library is free software; you can redistribute it and/or
   1
Error: Unclassifiable statement at (1)
/home/ollie/fdaryabo/NEMO/nemo4_dev/cfgs/NORDIC_prod/BLD/ppsrc/nemo/diaharm.f90:4:3:

    The GNU C Library is free software; you can redistribute it and/or
   1
Error: Unclassifiable statement at (1)
/home/ollie/fdaryabo/NEMO/nemo4_dev/cfgs/NORDIC_prod/BLD/ppsrc/nemo/dyncor_c1d.f90:2:3:

    This file is part of the GNU C Library.
   1
Error: Unclassifiable statement at (1)
/home/ollie/fdaryabo/NEMO/nemo4_dev/cfgs/NORDIC_prod/BLD/ppsrc/nemo/floats.f90:4:3:

    The GNU C Library is free software; you can redistribute it and/or
   1
Error: Unclassifiable statement at (1)
/home/ollie/fdaryabo/NEMO/nemo4_dev/cfgs/NORDIC_prod/BLD/ppsrc/nemo/diahth.f90:4:3:

Error: Unclassifiable statement at (1)
/home/ollie/fdaryabo/NEMO/nemo4_dev/cfgs/NORDIC_prod/BLD/ppsrc/nemo/dyncor_c1d.f90:4:3:

    The GNU C Library is free software; you can redistribute it and/or
   1
Error: Unclassifiable statement at (1)
/home/ollie/fdaryabo/NEMO/nemo4_dev/cfgs/NORDIC_prod/BLD/ppsrc/nemo/diahth.f90:4:39:

    The GNU C Library is free software; you can redistribute it and/or
                                       1
Error: Unclassifiable statement at (1)
/home/ollie/fdaryabo/NEMO/nemo4_dev/cfgs/NORDIC_prod/BLD/ppsrc/nemo/diaharm.f90:5:3:

    modify it under the terms of the GNU Lesser General Public
   1
Error: Unclassifiable statement at (1)
/home/ollie/fdaryabo/NEMO/nemo4_dev/cfgs/NORDIC_prod/BLD/ppsrc/ioipsl/nc4interface.f90:4:39:

    The GNU C Library is free software; you can redistribute it and/or
:
Error: Unclassifiable statement at (1)
/home/ollie/fdaryabo/NEMO/nemo4_dev/cfgs/NORDIC_prod/BLD/ppsrc/nemo/floats.f90:6:57:

    License as published by the Free Software Foundation; either
                                                         1
Error: Unclassifiable statement at (1)
/home/ollie/fdaryabo/NEMO/nemo4_dev/cfgs/NORDIC_prod/BLD/ppsrc/nemo/diahth.f90:6:3:

    License as published by the Free Software Foundation; either
   1
Error: Unclassifiable statement at (1)
/home/ollie/fdaryabo/NEMO/nemo4_dev/cfgs/NORDIC_prod/BLD/ppsrc/nemo/asmpar.f90:6:3:

    License as published by the Free Software Foundation; either
   1
Error: Unclassifiable statement at (1)
/home/ollie/fdaryabo/NEMO/nemo4_dev/cfgs/NORDIC_prod/BLD/ppsrc/nemo/trdtrc.f90:6:57:

    License as published by the Free Software Foundation; either
:
/home/ollie/fdaryabo/NEMO/nemo4_dev/cfgs/NORDIC_prod/BLD/ppsrc/nemo/diahth.f90:30:3:

    Unicode 6.0.  */
   1
Error: Unclassifiable statement at (1)
/home/ollie/fdaryabo/NEMO/nemo4_dev/cfgs/NORDIC_prod/BLD/ppsrc/ioipsl/nc4interface.f90:32:1:

 /* We do not support C11 <threads.h>.  */
 1
Error: Invalid character in name at (1)
/home/ollie/fdaryabo/NEMO/nemo4_dev/cfgs/NORDIC_prod/BLD/ppsrc/nemo/diahth.f90:32:1:

 /* We do not support C11 <threads.h>.  */
 1
Error: Invalid character in name at (1)
/home/ollie/fdaryabo/NEMO/nemo4_dev/cfgs/NORDIC_prod/BLD/ppsrc/nemo/diadct.f90:30:3:

    Unicode 6.0.  */
   1
Error: Unclassifiable statement at (1)
/home/ollie/fdaryabo/NEMO/nemo4_dev/cfgs/NORDIC_prod/BLD/ppsrc/nemo/diadct.f90:32:1:

 /* We do not support C11 <threads.h>.  */
 1
Error: Invalid character in name at (1)
/home/ollie/fdaryabo/NEMO/nemo4_dev/cfgs/NORDIC_prod/BLD/ppsrc/ioipsl/nc4interface.f90:45:7:

    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.
fcm_internal compile failed (256)
fcm_internal compile failed (256)
fcm_internal compile failed (fcm_internal256 )compile
 failed (fcm_internal256 )compile
 failed (fcm_internal256 )compile
 failed (256)
fcm_internal compile failed (256)
fcm_internal compile failed (256)
fcm_internal compile failed (fcm_internal256) 
compile failed (256)
fcm_internal compile failed (256)
fcm_internal compile failed (256)
gmake: *** [diahth.o] Error 1
gmake: *** Waiting for unfinished jobs....
gmake: *** [nc4interface.o] Error 1
gmake: *** [asmpar.o] Error 1
gmake: *** [flo_oce.o] Error 1
gmake: *** [trdtrc.o] Error 1
gmake: *** [par_kind.o] Error 1
gmake: *** [obs_types.o] Error 1
gmake: *** [diadct.o] Error 1
gmake: *** [dyncor_c1d.o] Error 1
gmake: *** [diaharm.o] Error 1
gmake: *** [floats.o] Error 1
gmake: *** [cyclone.o] Error 1

arch-osx_gfortran_ollie.fcm

%NCDF_INC            -I/.../netcdf/4.6.1_gnu-8.2.0/include 
%NCDF_LIB            -L/.../netcdf/4.6.1_gnu-8.2.0/lib -lnetcdff -lnetcdf -L/.../hdf5/1.10.2_gnu/lib -Wl,-rpath=/.../netcdf/4.6.1_gnu-8.2.0/lib -L/.../netcdf/4.6.1_gnu-8.2.0/lib -Wl,-rpath=/.../netcdf/4.6.1_gnu-8.2.0/lib -lnetcdff -lnetcdf -lhdf5_hl -lhdf5 -ldl -lsz -lz -lcurl -lm

#%HDF5_INC	     -I/.../hdf5/1.10.2_gnu/include
#%HDF5_LIB           -L/.../hdf5/1.10.2_gnu/lib 

%XIOS_INC            -I/.../NEMO/XIOS/xios-2.0/inc 
%XIOS_LIB            -L/.../NEMO/XIOS/xios-2.0/lib -lxios 

%CPP	             /usr/bin/cpp 
%FC	             mpif90  

%FCFLAGS             -O3 -fdefault-real-8 -fopenmp 
%FFLAGS              %FCFLAGS
%LD                  %FC
%LDFLAGS             -lstdc++
%FPPFLAGS            -P -C -traditional
%AR                  ar
%ARFLAGS             rs
%MK                  gmake

%USER_INC            %XIOS_INC %NCDF_INC 
%USER_LIB            %XIOS_LIB %NCDF_LIB 

%CC                   cc
%CFLAGS              -O0

Try without -C option in your arch %FPPFLAGS

Dear, Thanks for your reply,

I followed your command with %FC gfortran and %FC mpif90, respectively, the below message pop up.

With %FC gfortran

/home/ollie/fdaryabo/NEMO/nemo4_dev/cfgs/NORDIC_prod/BLD/ppsrc/ioipsl/nc4interface.f90:23.7:

   USE netcdf
       1
Fatal Error: File 'netcdf.mod' opened at (1) is not a GNU Fortran module file
fcm_internal compile failed (256)
gmake: *** [nc4interface.o] Error 1
gmake: *** Waiting for unfinished jobs....
gmake -f /home/ollie/fdaryabo/NEMO/nemo4_dev/cfgs/NORDIC_prod/BLD/Makefile -j 15 all failed (2) at /home/ollie/fdaryabo/NEMO/nemo4_dev/ext/FCM/bin/../lib/Fcm/Build.pm line 597.
Build failed on Tue Jul  6 14:14:07 2021./home/ollie/fdaryabo/NEMO/nemo4_dev/cfgs/NORDIC_prod/BLD/ppsrc/ioipsl/nc4interface.f90:23.7:

   USE netcdf
       1
Fatal Error: File 'netcdf.mod' opened at (1) is not a GNU Fortran module file
fcm_internal compile failed (256)
gmake: *** [nc4interface.o] Error 1
gmake: *** Waiting for unfinished jobs....
gmake -f /home/ollie/fdaryabo/NEMO/nemo4_dev/cfgs/NORDIC_prod/BLD/Makefile -j 15 all failed (2) at /home/ollie/fdaryabo/NEMO/nemo4_dev/ext/FCM/bin/../lib/Fcm/Build.pm line 597.
Build failed on Tue Jul  6 14:14:07 2021.
->Make: 2 seconds
->TOTAL: 11 seconds

->Make: 2 seconds
->TOTAL: 11 seconds

With %FC mpif90

Can't exec "mpif90": No such file or directory at /home/ollie/fdaryabo/NEMO/nemo4_dev/ext/FCM/bin/fcm_internal line 176.
Can't exec "mpif90": No such file or directory at /home/ollie/fdaryabo/NEMO/nemo4_dev/ext/FCM/bin/fcm_internal line 176.
fcm_internal compilefcm_internal failed ( compile-1 failed ()
-1)
mpif90 -o flodom.o -I/home/ollie/fdaryabo/NEMO/nemo4_dev/cfgs/NORDIC_prod/BLD/inc -O3 -fdefault-real-8 -fopenmp -I/home/ollie/fdaryabo/NEMO/XIOS/xios-2.0/inc -I/global/AWIsoft/netcdf/4.6.1_gnu-8.2.0/include -c /home/ollie/fdaryabo/NEMO/nemo4_dev/cfgs/NORDIC_prod/BLD/ppsrc/nemo/flodom.f90
gmake: *** [flo4rk.o] Error 1
gmake: *** Waiting for unfinished jobs....
gmake: *** [flowri.o] Error 1
Can't exec "mpif90": No such file or directory at /home/ollie/fdaryabo/NEMO/nemo4_dev/ext/FCM/bin/fcm_internal line 176.
fcm_internal compile failed (-1)
@                                                                                                             
                                                                                            315,1         94%
Can't exec "mpif90": No such file or directory at /home/ollie/fdaryabo/NEMO/nemo4_dev/ext/FCM/bin/fcm_internal line 176.

gmake: *** [flodom.o] Error 1

fcm_internal compile failed (-1)

mpif90 -o florst.o -I/home/ollie/fdaryabo/NEMO/nemo4_dev/cfgs/NORDIC_prod/BLD/inc -O3 -fdefault-real-8 -fopenmp -I/home/ollie/fdaryabo/NEMO/XIOS/xios-2.0/inc -I/global/AWIsoft/netcdf/4.6.1_gnu-8.2.0/include -c /home/ollie/fdaryabo/NEMO/nemo4_dev/cfgs/NORDIC_prod/BLD/ppsrc/nemo/florst.f90

gmake: *** [floblk.o] Error 1

Can't exec "mpif90": No such file or directory at /home/ollie/fdaryabo/NEMO/nemo4_dev/ext/FCM/bin/fcm_internal line 176.

mpif90 -o lib_cray.o -I/home/ollie/fdaryabo/NEMO/nemo4_dev/cfgs/NORDIC_prod/BLD/inc -O3 -fdefault-real-8 -fopenmp -I/home/ollie/fdaryabo/NEMO/XIOS/xios-2.0/inc -I/global/AWIsoft/netcdf/4.6.1_gnu-8.2.0/include -c /home/ollie/fdaryabo/NEMO/nemo4_dev/cfgs/NORDIC_prod/WORK/lib_cray.f90

fcm_internal compile failed (-1)

Can't exec "mpif90": No such file or directory at /home/ollie/fdaryabo/NEMO/nemo4_dev/ext/FCM/bin/fcm_internal line 176.

gmake: *** [florst.o] Error 1

fcm_internal compile failed (-1)

gmake: *** [lib_cray.o] Error 1

gmake -f /home/ollie/fdaryabo/NEMO/nemo4_dev/cfgs/NORDIC_prod/BLD/Makefile -j 15 all failed (2) at /home/ollie/fdaryabo/NEMO/nemo4_dev/ext/FCM/bin/../lib/Fcm/Build.pm line 597.

Build failed on Tue Jul 6 14:23:10 2021.

->Make: 0 second

->TOTAL: 9 seconds

Dear Farshid,

I think your compilation environment is not properly set and/or some dependencies are missing. When you try to compile, you must have a coherency with the Fortran compiler, its version and the NetCDF-related library.
For instance, if you want to use the MPI wrapper of GCC mpif90 as your FCM file stated, of course it has to be installed and the path to its binary must be present in your PATH environment variable so the system can find it if you don’t provide its absolute path in %FC.
Then the NetCDF library you refer in %NCDF_INC and %NCDF_LIB must have been compiled with the same Fortran compiler, the same version and the same mode (sequential or parallel, i.e. no MPI or MPI support).
According to your posts, it seems you are mixing things : different compilers and versions, non-MPI libraries used with MPI wrapper. It can’t just work.
Please refer to the documentation of your Linux distribution or see with your IT staff to properly installed and set your computing environment.

Dear Users,
Hello,

Apparently, has been matched the Netcdf containing subdirectories (‘lib’ and ‘inc’) with the available Fortran compiler (GNU) and this seems to have been done, but again the following error has been appeared and I got the following message that I do not know how to fix it. I am really grateful to someone who can help me with how to solve this issue.

Cheers,
Farshid

No. of files scanned for PP dependency: 288

**stopar.F90:19:7:**

USE dom_oce ! ocean space and time domain variables

**1**

**Fatal Error:** Can't open module file ‘ **storng.mod** ’ for reading at (1): No such file or directory

compilation terminated.

arch_linux_xios2_Ollie.fcm

%NCDF_INC       -I/global/AWIsoft/netcdf/4.6.1_gnu-8.2.0/include
%NCDF_LIB       -L/global/AWIsoft/netcdf/4.6.1_gnu-8.2.0/lib -lnetcdff -lnetcdf -L/global/AWIsoft/hdf5/1.10.2_gnu/lib -Wl,-rpath=/global/AWIsoft/hdf5/1.10.2_gnu/lib -L/global/AWIsoft/netcdf/4.6.1_gnu-8.2.0/lib -Wl,-rpath=/global/AWIsoft/netcdf/4.6.1_gnu-8.2.0/lib -lnetcdff -lnetcdf -lhdf5_hl -lhdf5 -ldl -lsz -lz -lcurl -lm


%HDF5_INC            -I/global/AWIsoft/hdf5/1.10.2_gnu/include
%HDF5_LIB            -L/global/AWIsoft/hdf5/1.10.2_gnu/lib

%XIOS_INC            -I/home/ollie/fdaryabo/NEMO/XIOS/xios-2.0/inc
%XIOS_LIB            -L/home/ollie/fdaryabo/NEMO/XIOS/xios-2.0/lib -lxios

%CPP                 /global/AWIsoft/intel/2018/impi/2018.3.222/bin64/mpicc
%FC                  /global/AWIsoft/intel/2018/impi/2018.3.222/bin64/mpif90

%FCFLAGS             -O2 -g -fdefault-real-8
%FFLAGS              %FCFLAGS
%LD                  %FC
%LDFLAGS             /global/AWIsoft/netcdf/4.6.1_gnu-8.2.0/bin/nf-config
%FPPFLAGS            -P -C -traditional
%AR                  ar
%ARFLAGS             rs
%MK                  gmake

%USER_INC            %HDF5_INC %XIOS_INC %NCDF_INC
%USER_LIB            %HDF5_LIB %XIOS_LIB %NCDF_LIB

%CC                  %CPP
%CFLAGS              -O0

What is the configuration you are trying to build ?
Following your first post, it seems you are working with a so-called NORDIC configuration which is not part of the reference configurations supported by us. We can’t guarantee that this configuration is compatible with NEMO 4.
I suggest you to experiment your computing environment with a configuration included in NEMO and, if you still encounter issues, we will be pleased to help you. However if your troubles are only related to this external configuration, you have to get in touch with their developers who will be able to guide you on how to run it.

Dear Nicolas,

Model made by SMHI based on NEMO 4, for the Baltic and North Seas. Unfortunately, they haven’t responded yet. So far I have been able to solve the problems. But a crazy error has wasted my time. I can share it with you, may you help me how to solve it.
Thank you in advance,

Please find the attached files,

cheers,
Farshid

(Attachment arch-linux_xios2_Ollie.fcm is missing)

(Attachment logfile is missing)

Please find the attached files below,

cheers,
Farshid

touch /home/ollie/fdaryabo/NEMO/nemo4_dev/cfgs/NORDIC_prod/BLD/done/bdydyn3d.done
/home/ollie/fdaryabo/NEMO/nemo4_dev/cfgs/NORDIC_prod/BLD/ppsrc/nemo/iom.f90:48:7:

    USE xios
       1
Fatal Error: Cannot read module file ‘xios.mod’ opened at (1), because it was created by a different version of GNU Fortran
compilation terminated.
touch /home/ollie/fdaryabo/NEMO/nemo4_dev/cfgs/NORDIC_prod/BLD/done/sbc_ice.done
touch /home/ollie/fdaryabo/NEMO/nemo4_dev/cfgs/NORDIC_prod/BLD/done/icealb.done
fcm_internal compile failed (256)
gmake: *** [iom.o] Error 1
gmake: *** Waiting for unfinished jobs....
gmake -f /home/ollie/fdaryabo/NEMO/nemo4_dev/cfgs/NORDIC_prod/BLD/Makefile -j 15 all failed (2) at /home/ollie/fdaryabo/NEMO/nemo4_dev/ext/FCM/bin/../lib/Fcm/Build.pm line 597.
Build failed on Thu Jul  8 14:55:49 2021.
->Make: 4 seconds
->TOTAL: 15 seconds
/home/ollie/fdaryabo/NEMO/nemo4_dev/cfgs

arch-linux_xios2_Ollie.fcm

%NCDF_INC     -I/global/AWIsoft/netcdf/4.6.1_gnu-8.2.0/include 
%NCDF_LIB     -L/global/AWIsoft/netcdf/4.6.1_gnu-8.2.0/lib -lnetcdff -lnetcdf -L/global/AWIsoft/hdf5/1.10.2_gnu/lib -Wl,-rpath=/global/AWIsoft/hdf5/1.10.2_gnu/lib -L/global/AWIsoft/netcdf/4.6.1_gnu-8.2.0/lib -Wl,-rpath=/global/AWIsoft/netcdf/4.6.1_gnu-8.2.0/lib -lnetcdff -lnetcdf -lhdf5_hl -lhdf5 -ldl -lsz -lz -lcurl -lm  

%MPI_INC      -I/global/AWIsoft/openmpi/3.1.3/include
%MPI_LIB      -L/global/AWIsoft/openmpi/3.1.3/lib
 
%XIOS_INC     -I/home/ollie/fdaryabo/NEMO/XIOS/xios-2.0/inc 
%XIOS_LIB     -L/home/ollie/fdaryabo/NEMO/XIOS/xios-2.0/lib -lxios 

%CPP           /global/AWIsoft/gcc/8.4.0/bin/cpp -P -traditional
%FC            /global/AWIsoft/gcc/8.4.0/bin/gfortran

%FCFLAGS       -fdefault-real-8 -march=native -funroll-loops -fcray-pointer -ffree-line-length-132  

%FFLAGS        %FCFLAGS

%LD            %FC
%LDFLAGS       %FCFLAGS -lstdc++                          

%FPPFLAGS      -P -traditional     

%AR            ar
%ARFLAGS       rs

%MK            gmake

%USER_INC      %XIOS_INC %NCDF_INC %MPI_INC 
%USER_LIB      %XIOS_LIB %NCDF_LIB %MPI_LIB

#%CC            %CPP
#%CFLAGS        -O0

Dear Farshid,

I know that most of the time the error log is not very helpful but here it is crystal clear:

Fatal Error: Cannot read module file ‘xios.mod’ opened at (1), because it was created by a different version of GNU Fortran

My recommendation regarding the dependencies linked to a particular compiler version applies just as much to XIOS.
By the way, we recommend to use XIOS 2.5 instead of XIOS 2.0 which is no longer supported.

Hei alla,

Just to say the NORDIC configurations does work with Nemo4, there is now even a GMD paper about it in preprint. But here, there is no need for such considerations, there is obviously a linking issue with xios or environnement problem that is not related with the configuration.

Cheers,

Robinson

Dear Robinson and Nicolas,
Successfully done, yes Robinson, you are right.
cheers
Farshid