Compilation error occurs when adding "key_agrif"

Hi everyone,

I have compiled and run a case similar to AMM12 using version NEMO 4.2.0. Now I try to add the NST subcomponent and to append the cpp key key_agrif in my case. The compilation command is as follows:

./makenemo -m linux_gfortran -n MY_AMM12_NEST -r AMM12 -d ‘OCE NST’ add_key ‘key_agrif’ 2>&1 |tee MY_AMM12_NEST1.log

Unfortunately, the following error occurred (Due to word count limitations, I have replaced the middle section with an ellipsis):


You are installing a new configuration MY_AMM12_NEST from AMM12 with sub-components: OCE NST
Creating MY_AMM12_NEST/WORK = OCE NST for MY_AMM12_NEST
External directory for MY_SRC unspecified or does not exist. Using default.
MY_SRC content is linked to MY_AMM12_NEST/WORK
/home/wangy/nemo-4.2.0/cfgs
Adding keys in : MY_AMM12_NEST
added key key_agrif in MY_AMM12_NEST
 bld::tool::fppkeys   key_diainstant key_xios key_qco key_agrif
Build command started on Sat Sep 20 15:49:27 2025.
->Parse configuration: start
Config file (bld): /home/wangy/nemo-4.2.0/mk/conv.cfg
Config file (bld): /home/wangy/nemo-4.2.0/mk/arch_nemo.fcm
->Parse configuration: 0 second
->Setup destination: start
Destination: wangy@HPZ8:/home/wangy/nemo-4.2.0/cfgs/MY_AMM12_NEST/AGRIFLIB
Make directory: /home/wangy/nemo-4.2.0/cfgs/MY_AMM12_NEST/AGRIFLIB/cfg
->Setup destination: 0 second
->Setup build: start
->Setup build: 0 second
->Pre-process: start
->Pre-process: 0 second
->Scan dependency: start
No. of files scanned for dependency: 24
/home/wangy/nemo-4.2.0/cfgs/MY_AMM12_NEST/AGRIFLIB/Makefile: updated
->Scan dependency: 1 second
->Generate Fortran interface: start
->Generate Fortran interface: 0 second
->Make: start
touch /home/wangy/nemo-4.2.0/cfgs/MY_AMM12_NEST/AGRIFLIB/flags/CC.flags
touch /home/wangy/nemo-4.2.0/cfgs/MY_AMM12_NEST/AGRIFLIB/flags/CFLAGS.flags
touch /home/wangy/nemo-4.2.0/cfgs/MY_AMM12_NEST/AGRIFLIB/flags/CFLAGS__convsrc.flags
touch /home/wangy/nemo-4.2.0/cfgs/MY_AMM12_NEST/AGRIFLIB/flags/CFLAGS__convsrc__DiversListe.flags
touch /home/wangy/nemo-4.2.0/cfgs/MY_AMM12_NEST/AGRIFLIB/flags/CPPKEYS.flags
touch /home/wangy/nemo-4.2.0/cfgs/MY_AMM12_NEST/AGRIFLIB/flags/CPPKEYS__convsrc.flags
touch /home/wangy/nemo-4.2.0/cfgs/MY_AMM12_NEST/AGRIFLIB/flags/CPPKEYS__convsrc__DiversListe.flags
cp /home/wangy/nemo-4.2.0/ext/AGRIF/LIB/decl.h /home/wangy/nemo-4.2.0/cfgs/MY_AMM12_NEST/AGRIFLIB/inc
chmod u+w /home/wangy/nemo-4.2.0/cfgs/MY_AMM12_NEST/AGRIFLIB/inc/decl.h
fcm_internal compile:C convsrc /home/wangy/nemo-4.2.0/ext/AGRIF/LIB/DiversListe.c diversliste.o 1
/home/wangy/install/bin/mpicc -o diversliste.o -I/home/wangy/nemo-4.2.0/cfgs/MY_AMM12_NEST/AGRIFLIB/inc -O0 -c /home/wangy/nemo-4.2.0/ext/AGRIF/LIB/DiversListe.c
/home/wangy/nemo-4.2.0/ext/AGRIF/LIB/DiversListe.c: In function ‘Add_Common_var_1’:
/home/wangy/nemo-4.2.0/ext/AGRIF/LIB/DiversListe.c:89:35: warning: ‘%s’ directive writing up to 1499 bytes into a region of size between 0 and 1499 [-Wformat-overflow=]
   89 |                 sprintf(ligne,"%s:%s",dims->dim.first,dims->dim.last);
      |                                   ^~
/home/wangy/nemo-4.2.0/ext/AGRIF/LIB/DiversListe.c:89:17: note: ‘sprintf’ output between 2 and 3000 bytes into a destination of size 1500
   89 |                 sprintf(ligne,"%s:%s",dims->dim.first,dims->dim.last);
      |                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/wangy/nemo-4.2.0/ext/AGRIF/LIB/DiversListe.c: In function ‘Add_Save_Var_1’:
/home/wangy/nemo-4.2.0/ext/AGRIF/LIB/DiversListe.c:501:35: warning: ‘%s’ directive writing up to 1499 bytes into a region of size between 0 and 1499 [-Wformat-overflow=]
  501 |                 sprintf(ligne,"%s:%s",dims->dim.first,dims->dim.last);
      |                                   ^~
/home/wangy/nemo-4.2.0/ext/AGRIF/LIB/DiversListe.c:501:17: note: ‘sprintf’ output between 2 and 3000 bytes into a destination of size 1500
  501 |                 sprintf(ligne,"%s:%s",dims->dim.first,dims->dim.last);
      |                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
touch /home/wangy/nemo-4.2.0/cfgs/MY_AMM12_NEST/AGRIFLIB/flags/CFLAGS__convsrc__SubLoopCreation.flags
touch /home/wangy/nemo-4.2.0/cfgs/MY_AMM12_NEST/AGRIFLIB/flags/CPPKEYS__convsrc__SubLoopCreation.flags
fcm_internal compile:C convsrc /home/wangy/nemo-4.2.0/ext/AGRIF/LIB/SubLoopCreation.c subloopcreation.o 1
/home/wangy/install/bin/mpicc -o subloopcreation.o -I/home/wangy/nemo-4.2.0/cfgs/MY_AMM12_NEST/AGRIFLIB/inc -O0 -c /home/wangy/nemo-4.2.0/ext/AGRIF/LIB/SubLoopCreation.c
touch /home/wangy/nemo-4.2.0/cfgs/MY_AMM12_NEST/AGRIFLIB/flags/CFLAGS__convsrc__UtilAgrif.flags
touch /home/wangy/nemo-4.2.0/cfgs/MY_AMM12_NEST/AGRIFLIB/flags/CPPKEYS__convsrc__UtilAgrif.flags
fcm_internal compile:C convsrc /home/wangy/nemo-4.2.0/ext/AGRIF/LIB/UtilAgrif.c utilagrif.o 1
/home/wangy/install/bin/mpicc -o utilagrif.o -I/home/wangy/nemo-4.2.0/cfgs/MY_AMM12_NEST/AGRIFLIB/inc -O0 -c /home/wangy/nemo-4.2.0/ext/AGRIF/LIB/UtilAgrif.c
touch /home/wangy/nemo-4.2.0/cfgs/MY_AMM12_NEST/AGRIFLIB/flags/CFLAGS__convsrc__UtilCharacter.flags
touch /home/wangy/nemo-4.2.0/cfgs/MY_AMM12_NEST/AGRIFLIB/flags/CPPKEYS__convsrc__UtilCharacter.flags
fcm_internal compile:C convsrc /home/wangy/nemo-4.2.0/ext/AGRIF/LIB/UtilCharacter.c utilcharacter.o 1
/home/wangy/install/bin/mpicc -o utilcharacter.o -I/home/wangy/nemo-4.2.0/cfgs/MY_AMM12_NEST/AGRIFLIB/inc -O0 -c /home/wangy/nemo-4.2.0/ext/AGRIF/LIB/UtilCharacter.c
touch /home/wangy/nemo-4.2.0/cfgs/MY_AMM12_NEST/AGRIFLIB/flags/CFLAGS__convsrc__UtilFile.flags
touch /home/wangy/nemo-4.2.0/cfgs/MY_AMM12_NEST/AGRIFLIB/flags/CPPKEYS__convsrc__UtilFile.flags
fcm_internal compile:C convsrc /home/wangy/nemo-4.2.0/ext/AGRIF/LIB/UtilFile.c utilfile.o 1
/home/wangy/install/bin/mpicc -o utilfile.o -I/home/wangy/nemo-4.2.0/cfgs/MY_AMM12_NEST/AGRIFLIB/inc -O0 -c /home/wangy/nemo-4.2.0/ext/AGRIF/LIB/UtilFile.c
/home/wangy/nemo-4.2.0/ext/AGRIF/LIB/UtilFile.c: In function ‘open_for_write’:
/home/wangy/nemo-4.2.0/ext/AGRIF/LIB/UtilFile.c:49:28: warning: ‘sprintf’ may write a terminating nul past the end of the destination [-Wformat-overflow=]
   49 |     sprintf(filefich,"%s/%s",include_dir,filename);
      |                            ^
/home/wangy/nemo-4.2.0/ext/AGRIF/LIB/UtilFile.c:49:5: note: ‘sprintf’ output 2 or more bytes (assuming 1001) into a destination of size 1000
   49 |     sprintf(filefich,"%s/%s",include_dir,filename);
      |     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
touch /home/wangy/nemo-4.2.0/cfgs/MY_AMM12_NEST/AGRIFLIB/flags/CFLAGS__convsrc__UtilFortran.flags
touch /home/wangy/nemo-4.2.0/cfgs/MY_AMM12_NEST/AGRIFLIB/flags/CPPKEYS__convsrc__UtilFortran.flags
fcm_internal compile:C convsrc /home/wangy/nemo-4.2.0/ext/AGRIF/LIB/UtilFortran.c utilfortran.o 1
/home/wangy/install/bin/mpicc -o utilfortran.o -I/home/wangy/nemo-4.2.0/cfgs/MY_AMM12_NEST/AGRIFLIB/inc -O0 -c /home/wangy/nemo-4.2.0/ext/AGRIF/LIB/UtilFortran.c
/home/wangy/nemo-4.2.0/ext/AGRIF/LIB/UtilFortran.c: In function ‘dump_var’:
/home/wangy/nemo-4.2.0/ext/AGRIF/LIB/UtilFortran.c:674:47: warning: format ‘%s’ expects argument of type ‘char *’, but argument 3 has type ‘listname * const’ {aka ‘struct listname * const’} [-Wformat=]
  674 |     fprintf(stderr, "   var->v_initialvalue: %s\n",var->v_initialvalue);
      |                                              ~^    ~~~~~~~~~~~~~~~~~~~
      |                                               |       |
      |                                               char *  listname * const {aka struct listname * const}
touch /home/wangy/nemo-4.2.0/cfgs/MY_AMM12_NEST/AGRIFLIB/flags/CFLAGS__convsrc__UtilListe.flags
touch /home/wangy/nemo-4.2.0/cfgs/MY_AMM12_NEST/AGRIFLIB/flags/CPPKEYS__convsrc__UtilListe.flags
fcm_internal compile:C convsrc /home/wangy/nemo-4.2.0/ext/AGRIF/LIB/UtilListe.c utilliste.o 1
/home/wangy/install/bin/mpicc -o utilliste.o -I/home/wangy/nemo-4.2.0/cfgs/MY_AMM12_NEST/AGRIFLIB/inc -O0 -c /home/wangy/nemo-4.2.0/ext/AGRIF/LIB/UtilListe.c
/home/wangy/nemo-4.2.0/ext/AGRIF/LIB/UtilListe.c: In function ‘createvar’:
/home/wangy/nemo-4.2.0/ext/AGRIF/LIB/UtilListe.c:420:31: warning: ‘%s’ directive writing up to 1499 bytes into a region of size between 0 and 1499 [-Wformat-overflow=]
  420 |             sprintf(ligne,"%s:%s",dims->dim.first,dims->dim.last);
      |                               ^~
/home/wangy/nemo-4.2.0/ext/AGRIF/LIB/UtilListe.c:420:13: note: ‘sprintf’ output between 2 and 3000 bytes into a destination of size 1500
  420 |             sprintf(ligne,"%s:%s",dims->dim.first,dims->dim.last);
      |             ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
touch /home/wangy/nemo-4.2.0/cfgs/MY_AMM12_NEST/AGRIFLIB/flags/CFLAGS__convsrc__UtilNotGridDep.flags
........
/home/wangy/nemo-4.2.0/ext/AGRIF/LIB/toamr.c:750:61: warning: ‘%s’ directive writing up to 1499 bytes into a region of size 1492 [-Wformat-overflow=]
  750 |                                     sprintf(ligne2,"reshape(%s,shape(%s))",initialvalue,vargridnametabvars(v,0));
      |                                                             ^~             ~~~~~~~~~~~~
/home/wangy/nemo-4.2.0/ext/AGRIF/LIB/toamr.c:750:37: note: ‘sprintf’ output 18 or more bytes (assuming 1517) into a destination of size 1500
  750 |                                     sprintf(ligne2,"reshape(%s,shape(%s))",initialvalue,vargridnametabvars(v,0));
      |                                     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/wangy/nemo-4.2.0/ext/AGRIF/LIB/toamr.c: In function ‘write_allocation_Global_0’:
/home/wangy/nemo-4.2.0/ext/AGRIF/LIB/toamr.c:1012:55: warning: ‘%s’ directive writing up to 1499 bytes into a region of size 1490 [-Wformat-overflow=]
 1012 |                             sprintf(ligne3,"reshape((/%s/),shape(%s))",ligne2,vargridnametabvars(v,0));
      |                                                       ^~               ~~~~~~
/home/wangy/nemo-4.2.0/ext/AGRIF/LIB/toamr.c:1012:29: note: ‘sprintf’ output 22 or more bytes (assuming 1521) into a destination of size 1500
 1012 |                             sprintf(ligne3,"reshape((/%s/),shape(%s))",ligne2,vargridnametabvars(v,0));
      |                             ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/wangy/nemo-4.2.0/ext/AGRIF/LIB/toamr.c:950:52: warning: ‘)’ directive writing 1 byte into a region of size between 0 and 1499 [-Wformat-overflow=]
  950 |                                 sprintf(ligne2,"(%s)",parcours_name_array->n_name);
      |                                                    ^
/home/wangy/nemo-4.2.0/ext/AGRIF/LIB/toamr.c:950:33: note: ‘sprintf’ output between 3 and 1502 bytes into a destination of size 1500
  950 |                                 sprintf(ligne2,"(%s)",parcours_name_array->n_name);
      |                                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/wangy/nemo-4.2.0/ext/AGRIF/LIB/toamr.c:972:61: warning: ‘%s’ directive writing up to 1499 bytes into a region of size 1492 [-Wformat-overflow=]
  972 |                                     sprintf(ligne2,"reshape(%s,shape(%s))",initialvalue,vargridnametabvars(v,0));
      |                                                             ^~             ~~~~~~~~~~~~
/home/wangy/nemo-4.2.0/ext/AGRIF/LIB/toamr.c:972:37: note: ‘sprintf’ output 18 or more bytes (assuming 1517) into a destination of size 1500
  972 |                                     sprintf(ligne2,"reshape(%s,shape(%s))",initialvalue,vargridnametabvars(v,0));
      |                                     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
fcm_internal archive libconvsrc.a diversliste.o subloopcreation.o utilagrif.o utilcharacter.o utilfile.o utilfortran.o utilliste.o utilnotgriddep.o workwithallocatelist.o workwithparameterlist.o workwithglobliste.o workwithlistdatavariable.o workwithlistmoduleinfile.o workwithlistofcoupled.o workwithlistofmodulebysubroutine.o workwithlistvarindoloop.o workwithvarofsubroutineliste.o writeinfile.o writedeclarations.o dependfile.o fortran.o toamr.o
ar rs /home/wangy/nemo-4.2.0/cfgs/MY_AMM12_NEST/AGRIFLIB/tmp/libconvsrc.a dependfile.o diversliste.o fortran.o subloopcreation.o toamr.o utilagrif.o utilcharacter.o utilfile.o utilfortran.o utilliste.o utilnotgriddep.o workwithallocatelist.o workwithglobliste.o workwithlistdatavariable.o workwithlistmoduleinfile.o workwithlistofcoupled.o workwithlistofmodulebysubroutine.o workwithlistvarindoloop.o workwithparameterlist.o workwithvarofsubroutineliste.o writedeclarations.o writeinfile.o
ar: creating /home/wangy/nemo-4.2.0/cfgs/MY_AMM12_NEST/AGRIFLIB/tmp/libconvsrc.a
touch /home/wangy/nemo-4.2.0/cfgs/MY_AMM12_NEST/AGRIFLIB/flags/CFLAGS__convsrc__main.flags
touch /home/wangy/nemo-4.2.0/cfgs/MY_AMM12_NEST/AGRIFLIB/flags/CPPKEYS__convsrc__main.flags
fcm_internal compile:C convsrc /home/wangy/nemo-4.2.0/ext/AGRIF/LIB/main.c main.o 1
/home/wangy/install/bin/mpicc -o main.o -I/home/wangy/nemo-4.2.0/cfgs/MY_AMM12_NEST/AGRIFLIB/inc -O0 -c /home/wangy/nemo-4.2.0/ext/AGRIF/LIB/main.c
convert.tab.c: In function ‘convert_parse’:
/home/wangy/nemo-4.2.0/ext/AGRIF/LIB/main.c:68:25: warning: implicit declaration of function ‘convert_lex’ [-Wimplicit-function-declaration]
   68 | #define yylex           convert_lex
      |                         ^~~~~~~~~~~
convert.tab.c:1259:16: note: in expansion of macro ‘yylex’
convert.y: In function ‘main’:
convert.y:310:33: warning: ‘%s’ directive writing 16 bytes into a region of size between 0 and 999 [-Wformat-overflow=]
convert.y:310:13: note: ‘sprintf’ output between 18 and 1017 bytes into a destination of size 1000
convert.y:314:34: warning: ‘%s’ directive writing 9 bytes into a region of size between 0 and 999 [-Wformat-overflow=]
convert.y:314:13: note: ‘sprintf’ output between 11 and 1010 bytes into a destination of size 1000
convert.y:335:29: warning: ‘/.dependglobal_agrif’ directive writing 20 bytes into a region of size between 1 and 1000 [-Wformat-overflow=]
convert.y:335:5: note: ‘sprintf’ output between 21 and 1020 bytes into a destination of size 1000
convert.y:420:29: warning: ‘/.dependglobal_agrif’ directive writing 20 bytes into a region of size between 1 and 1000 [-Wformat-overflow=]
convert.y:420:5: note: ‘sprintf’ output between 21 and 1020 bytes into a destination of size 1000
touch /home/wangy/nemo-4.2.0/cfgs/MY_AMM12_NEST/AGRIFLIB/flags/LD.flags
touch /home/wangy/nemo-4.2.0/cfgs/MY_AMM12_NEST/AGRIFLIB/flags/LD__convsrc.flags
touch /home/wangy/nemo-4.2.0/cfgs/MY_AMM12_NEST/AGRIFLIB/flags/LD__convsrc__main.flags
touch /home/wangy/nemo-4.2.0/cfgs/MY_AMM12_NEST/AGRIFLIB/flags/LDFLAGS.flags
touch /home/wangy/nemo-4.2.0/cfgs/MY_AMM12_NEST/AGRIFLIB/flags/LDFLAGS__convsrc.flags
touch /home/wangy/nemo-4.2.0/cfgs/MY_AMM12_NEST/AGRIFLIB/flags/LDFLAGS__convsrc__main.flags
touch /home/wangy/nemo-4.2.0/cfgs/MY_AMM12_NEST/AGRIFLIB/done/decl.h.idone
fcm_internal load:C convsrc main.o conv
ar: creating /home/wangy/nemo-4.2.0/cfgs/MY_AMM12_NEST/AGRIFLIB/tmp/lib__fcm__conv.a
/home/wangy/install/bin/mpicc -o conv /home/wangy/nemo-4.2.0/cfgs/MY_AMM12_NEST/AGRIFLIB/obj/main.o -L/home/wangy/nemo-4.2.0/cfgs/MY_AMM12_NEST/AGRIFLIB/lib -l__fcm__conv 
->Make: 2 seconds
->TOTAL: 3 seconds
Build command finished on Sat Sep 20 15:49:30 2025.
Build command started on Sat Sep 20 15:49:30 2025.
->Parse configuration: start
Config file (bld): /home/wangy/nemo-4.2.0/mk/bld_preproagr.cfg
Config file (bld): /home/wangy/nemo-4.2.0/mk/arch_nemo.fcm
Config file (bld): /home/wangy/nemo-4.2.0/mk/cpp.fcm
->Parse configuration: 0 second
->Setup destination: start
Destination: wangy@HPZ8:/home/wangy/nemo-4.2.0/cfgs/MY_AMM12_NEST/NEMOFILES
Make directory: /home/wangy/nemo-4.2.0/cfgs/MY_AMM12_NEST/NEMOFILES/cfg
->Setup destination: 0 second
->Setup build: start
->Setup build: 1 second
->Pre-process: start
No. of files scanned for PP dependency: 304
No. of pre-processed files: 276
->Pre-process: 6 seconds
->Scan dependency: start
No. of files scanned for dependency: 305
/home/wangy/nemo-4.2.0/cfgs/MY_AMM12_NEST/NEMOFILES/Makefile: updated
->Scan dependency: 12 seconds
->Generate Fortran interface: start
->Generate Fortran interface: 0 second
->Make: start
touch /home/wangy/nemo-4.2.0/cfgs/MY_AMM12_NEST/NEMOFILES/flags/FC.flags
touch /home/wangy/nemo-4.2.0/cfgs/MY_AMM12_NEST/NEMOFILES/flags/FFLAGS.flags
touch /home/wangy/nemo-4.2.0/cfgs/MY_AMM12_NEST/NEMOFILES/flags/FFLAGS__nemo.flags
touch /home/wangy/nemo-4.2.0/cfgs/MY_AMM12_NEST/NEMOFILES/flags/FFLAGS__nemo__lib_cray.flags
fcm_internal compile:F nemo /home/wangy/nemo-4.2.0/cfgs/MY_AMM12_NEST/NEMOFILES/ppsrc/nemo/lib_cray.f90 lib_cray.f90
/home/wangy/nemo-4.2.0/mk/agrifpp.sh /home/wangy/nemo-4.2.0/cfgs  lib_cray.f90 /home/wangy/nemo-4.2.0/cfgs/MY_AMM12_NEST/NEMOFILES/inc  /home/wangy/nemo-4.2.0/cfgs/MY_AMM12_NEST/NEMOFILES/ppsrc/nemo/lib_cray.f90
fcm_internal compile failed (256)
make: *** [/home/wangy/nemo-4.2.0/cfgs/MY_AMM12_NEST/NEMOFILES/Makefile:1452: lib_cray.f90] Error 1
make -f /home/wangy/nemo-4.2.0/cfgs/MY_AMM12_NEST/NEMOFILES/Makefile -j 1 all failed (2) at /home/wangy/nemo-4.2.0/ext/FCM/bin/../lib/Fcm/Build.pm line 597.
Build failed on Sat Sep 20 15:49:49 2025.
->Make: 0 second
->TOTAL: 19 seconds
/home/wangy/nemo-4.2.0/cfgs

The lib_cray.f90 file located in the nemo-4.2.0/cfgs/MY_AMM12_NEST/NEMOFILES/ppsrc/nemo directory is as shown below:

/* Copyright (C) 1991-2022 Free Software Foundation, Inc.
   This file is part of the GNU C Library.

   The GNU C Library is free software; you can redistribute it and/or
   modify it under the terms of the GNU Lesser General Public
   License as published by the Free Software Foundation; either
   version 2.1 of the License, or (at your option) any later version.

   The GNU C Library is distributed in the hope that it will be useful,
   but WITHOUT ANY WARRANTY; without even the implied warranty of
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
   Lesser General Public License for more details.

   You should have received a copy of the GNU Lesser General Public
   License along with the GNU C Library; if not, see
   <https://www.gnu.org/licenses/>.  */


/* This header is separate from features.h so that the compiler can
   include it implicitly at the start of every compilation.  It must
   not itself include <features.h> or any other header that includes
   <features.h> because the implicit include comes before any feature
   test macros that may be defined in a source file before it first
   explicitly includes a system header.  GCC knows the name of this
   header in order to preinclude it.  */

/* glibc's intent is to support the IEC 559 math functionality, real
   and complex.  If the GCC (4.9 and later) predefined macros
   specifying compiler intent are available, use them to determine
   whether the overall intent is to support these features; otherwise,
   presume an older compiler has intent to support these features and
   define these macros by default.  */



/* wchar_t uses Unicode 10.0.0.  Version 10.0 of the Unicode Standard is
   synchronized with ISO/IEC 10646:2017, fifth edition, plus
   the following additions from Amendment 1 to the fifth edition:
   - 56 emoji characters
   - 285 hentaigana
   - 3 additional Zanabazar Square characters */

!  Cray subroutines or functions used by OCE model and possibly 
!  not found on other platforms.
!
!  check their existence
!  
!  wheneq
   !!----------------------------------------------------------------------
   !! NEMO/OCE 4.0 , NEMO Consortium (2018)
   !! $Id: lib_cray.f90 14227 2020-12-20 11:57:00Z smasson $ 
   !! Software governed by the CeCILL license (see ./LICENSE)
   !!----------------------------------------------------------------------
SUBROUTINE lib_cray
      WRITE(*,*) 'lib_cray: You should not have seen this print! error?'
END SUBROUTINE lib_cray

SUBROUTINE wheneq ( i, x, j, t, ind, nn )
        IMPLICIT NONE

        INTEGER , INTENT (  in ) :: i, j
        INTEGER , INTENT ( out ) :: nn
        REAL    , INTENT (  in ), DIMENSION (1+(i-1)*j) :: x
        REAL    , INTENT (  in ) :: t
        INTEGER , INTENT ( out ), DIMENSION (1+(i-1)*j) :: ind
        INTEGER :: n, k
        nn = 0
        DO n = 1, i
          k = 1 + (n-1) * j
          IF ( x ( k) == t ) THEN 
              nn = nn + 1
              ind (nn) = k
          ENDIF
        END DO 

END SUBROUTINE wheneq

I also tested other cases in ref_cfgs.txt, and the same error occurs whenever the key_agrif key is added. My configuration file is as follows:

%NCDF_HOME           /home/wangy/install
%HDF5_HOME           /home/wangy/install
%XIOS_HOME           /home/wangy/XIOS/xios-2.5-2589


%NCDF_INC            -I%NCDF_HOME/include  -I%HDF5_HOME/include
%NCDF_LIB            -L%NCDF_HOME/lib -lnetcdff -lnetcdf
%XIOS_INC            -I%XIOS_HOME/inc
%XIOS_LIB            -L%XIOS_HOME/lib -lxios -lstdc++


%CPP                 /usr/bin/cpp-9 -Dkey_nosignedzero
%CPPFLAGS            -P -traditional
%FC                  /home/wangy/install/bin/mpif90 -c -cpp
#%FCFLAGS             -fdefault-real-8 -O3 -funroll-all-loops -fcray-pointer -ffree-line-length-none
%FCFLAGS             -fdefault-real-8 -O3 -funroll-all-loops -fcray-pointer -cpp -ffree-line-length-none

%FFLAGS              %FCFLAGS
%LD                  /home/wangy/install/bin/mpif90
%LDFLAGS
%FPPFLAGS            -P -C -traditional -std=c99
%AR                  ar
%ARFLAGS             -rs
%MK                  make
%USER_INC            %XIOS_INC %NCDF_INC
%USER_LIB            %XIOS_LIB %NCDF_LIB

%CC                  /home/wangy/install/bin/mpicc
%CFLAGS              -O0

My gfortran and gcc versions are both 9.5.0(Ubuntu 9.5.0-1ubuntu1~22.04).

Has anyone had a similar problem, or can give me some advice?

Thanks

Wangy

I would try

%FPPFLAGS            -P -traditional

and

%CC                  gcc

You’re right, it compiles successfully now. Thank you very much!!