New URL for NEMO forge!

Since March 2022 along with NEMO 4.2 release, the code development moved to a self-hosted GitLab.
This present forge is now archived and remained online for history.
[GCC] Compilation of AGRIF_DEMO fails – Message List – Discussion – NEMO

Beginner (#1) - [GCC] Compilation of AGRIF_DEMO fails (#79) - Message List

[GCC] Compilation of AGRIF_DEMO fails


I can compile and run AGRIF_DEMO with intel/18.0.1 programming environment on our HP cluster.

However the compilation fails on Ubuntu 18.04 LTS with its default gcc/gfortran (7.4.0).

The error I get is related to AGRIF's conv executable:

nemo4.0/cfgs/MY_AGRIF_DEMO/NEMOFILES/conv nemo4.0/cfgs/MY_AGRIF_DEMO/NEMOFILES/ -rm -incdir nemo4.0/cfgs/MY_AGRIF_DEMO/NEMOFILES/inc -comdirout nemo4.0/cfgs/MY_AGRIF_DEMO/NEMOFILES/obj -convfile lib_cray.f90
#syntax error line 1, file lib_cray.f90 motclef = |"lib_cray.f90"
/home/local/pjuotila/tiede/NEMO/nemo4.0/cfgs/MY_AGRIF_DEMO/NEMOFILES/Makefile:1546: recipe for target 'lib_cray.f90' failed

I wonder if anyone has encountered this problem and managed to fix it? Thank you.

  • Message #191


    The compilation of NEMO is not very well tested with GCC as almost all HPC centers comes with an Intel installation.
    My experience is that GCC is a bit less permissive than Intel, and from your error log I suggest to look at the options in your arch file regarding the preprocessing: %CPP and %FPPFLAGS.

    It's been quite a while since my last attempt to compile NEMO on my laptop, now I've got a new one so I will probably run in the same problem soon.

    Regards, Nicolas

    • Message #192

      Thanks for your reply. I made some progress by adding -P to %FPPFLAGS. I add here my architecture file:

      %NCDF_HOME           /usr
      %HDF5_HOME           /usr
      %XIOS_HOME           $HOME/xios-2.5
      %NCDF_INC            -I%NCDF_HOME/include
      %NCDF_LIB            -L%NCDF_HOME/lib/x86_64-linux-gnu
      %HDF5_INC            -I%HDF5_HOME/include
      %HDF5_LIB            -L%HDF5_HOME/lib/x86_64-linux-gnu/hdf5/serial -lhdf5_hl -lhdf5
      %XIOS_INC            -I%XIOS_HOME/inc
      %XIOS_LIB            -L%XIOS_HOME/lib -lxios
      %CPP                 cpp -Dkey_nosignedzero -DAGRIF_MPI
      %FC                  mpif90
      %FCFLAGS             -fdefault-real-8 -ffree-line-length-none -fno-second-underscore -O0 -g
      %FFLAGS              %FCFLAGS
      %LD                  mpif90
      %FPPFLAGS            -P -x f95-cpp-input
      %AR                  ar
      %ARFLAGS             rs
      %MK                  make
      %USER_INC            %XIOS_INC %NCDF_INC %HDF5_INC
      %USER_LIB            %XIOS_LIB %NCDF_LIB %HDF5_LIB  -lnetcdff -lnetcdf -lstdc++ -lz -lcurl
      %CC                  cc
      %CFLAGS              -O0 -g

      Perhaps you can spot what should be changed? I keep on purpose optimization levels at zero for now. I had to add AGRIF_MPI preprosessor option as it was not correctly detected from bld.cfg and ext/AGRIF/nemo_mpi.h. I am sure there is a better way to make it work.

      • Message #211

        With "puotila" suggestions the code compile, however I had issues in running time with "dev/null".

        I have to change the nemogcm.F90 code replacing:

        CALL ctl_opn(numnul, '/dev/null', 'REPLACE', 'FORMATTED', 'SEQUENTIAL', -1, -1, .FALSE. )



        IF(.NOT.dv_logical) CALL ctl_opn(numnul, '/dev/null', 'REPLACE', 'FORMATTED', 'SEQUENTIAL', -1, -1, .FALSE. )
        and clearly defining dv_logical
        Hope this help


No attachments created.