# Compilation problem with test cases including AGRIF: DOME VORTEX

**URL:** <https://nemo-ocean.discourse.group/t/compilation-problem-with-test-cases-including-agrif-dome-vortex/834>\
**Category:** Test case\
**Created:** [5 February 2025 19:52 UTC](https://nemo-ocean.discourse.group/t/compilation-problem-with-test-cases-including-agrif-dome-vortex/834 "2025-02-05T19:52:20Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![sennevilles](https://yyz2.discourse-cdn.com/free1/user_avatar/nemo-ocean.discourse.group/sennevilles/32/11_2.png) [@sennevilles](https://nemo-ocean.discourse.group/u/sennevilles)\
**Post date:** [5 February 2025 19:52 UTC](https://nemo-ocean.discourse.group/t/compilation-problem-with-test-cases-including-agrif-dome-vortex/834/1 "2025-02-05T19:52:20Z")

</div>

Hi,  
With NEMO v5, I can compile ans run some test case as OVERFLOW. But I got compilation error when AGIF is used. Here what I get when I try :  
./makenemo -r DOME -n MY\_DOME -m X64\_APP\_INTEL\_IMPI

* * *

## Build stage BLD\_AGRIFLIB

-\>Parse configuration: 0 second  
-\>Setup destination: 0 second  
-\>Setup build: 0 second  
-\>Pre-process: 0 second  
-\>Scan dependency: 0 second  
-\>Generate Fortran interface: 0 second  
icx: warning: -Z-reserved-lib-stdc++: ‘linker’ input unused [-Wunused-command-line-argument]  
icx: warning: -Z-reserved-lib-stdc++: ‘linker’ input unused [-Wunused-command-line-argument]  
icx: warning: -Z-reserved-lib-stdc++: ‘linker’ input unused [-Wunused-command-line-argument]  
icx: warning: -Z-reserved-lib-stdc++: ‘linker’ input unused [-Wunused-command-line-argument]  
icx: warning: -Z-reserved-lib-stdc++: ‘linker’ input unused [-Wunused-command-line-argument]  
icx: warning: -Z-reserved-lib-stdc++: ‘linker’ input unused [-Wunused-command-line-argument]  
In file included from /scratch/sennsi01/nemo\_5.0-beta/ext/AGRIF/LIB/UtilFortran.c:38:  
/scratch/sennsi01/nemo\_5.0-beta/ext/AGRIF/LIB/decl.h:535:13: warning: a function declaration without a prototype is deprecated in all versions of C and is treated as a zero-parameter prototype in C23, conflicting with a subsequent definition [-Wdeprecated-non-prototype]  
535 | extern void Write\_Closing\_Module();  
| ^  
/scratch/sennsi01/nemo\_5.0-beta/ext/AGRIF/LIB/UtilFortran.c:266:6: note: conflicting prototype is here  
266 | void Write\_Closing\_Module(int forend)  
| ^  
/scratch/sennsi01/nemo\_5.0-beta/ext/AGRIF/LIB/UtilFortran.c:674:52: warning: format specifies type ‘char \*’ but the argument has type ‘listname \*’ (aka ‘struct listname \*’) [-Wformat]  
674 | fprintf(stderr, " var-\>v\_initialvalue: %s\n",var-\>v\_initialvalue);  
| ~~^~~~~~~~~~~~~~~~~~~  
2 warnings generated.  
icx: warning: -Z-reserved-lib-stdc++: ‘linker’ input unused [-Wunused-command-line-argument]  
icx: warning: -Z-reserved-lib-stdc++: ‘linker’ input unused [-Wunused-command-line-argument]  
icx: warning: -Z-reserved-lib-stdc++: ‘linker’ input unused [-Wunused-command-line-argument]  
icx: warning: -Z-reserved-lib-stdc++: ‘linker’ input unused [-Wunused-command-line-argument]  
icx: warning: -Z-reserved-lib-stdc++: ‘linker’ input unused [-Wunused-command-line-argument]  
icx: warning: -Z-reserved-lib-stdc++: ‘linker’ input unused [-Wunused-command-line-argument]  
icx: warning: -Z-reserved-lib-stdc++: ‘linker’ input unused [-Wunused-command-line-argument]  
icx: warning: -Z-reserved-lib-stdc++: ‘linker’ input unused [-Wunused-command-line-argument]  
icx: warning: -Z-reserved-lib-stdc++: ‘linker’ input unused [-Wunused-command-line-argument]  
icx: warning: -Z-reserved-lib-stdc++: ‘linker’ input unused [-Wunused-command-line-argument]  
icx: warning: -Z-reserved-lib-stdc++: ‘linker’ input unused [-Wunused-command-line-argument]  
icx: warning: -Z-reserved-lib-stdc++: ‘linker’ input unused [-Wunused-command-line-argument]  
icx: warning: -Z-reserved-lib-stdc++: ‘linker’ input unused [-Wunused-command-line-argument]  
icx: warning: -Z-reserved-lib-stdc++: ‘linker’ input unused [-Wunused-command-line-argument]  
icx: warning: -Z-reserved-lib-stdc++: ‘linker’ input unused [-Wunused-command-line-argument]  
fortran.tab.c:3463:16: error: call to undeclared function ‘fortran\_lex’; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]  
3463 | yychar = yylex ();  
| ^  
/scratch/sennsi01/nemo\_5.0-beta/ext/AGRIF/LIB/fortran.c:64:25: note: expanded from macro ‘yylex’  
64 | #define yylex fortran\_lex  
| ^  
fortran.y:1510:41: warning: passing arguments to ‘Write\_Closing\_Module’ without a prototype is deprecated in all versions of C and is not supported in C23 [-Wdeprecated-non-prototype]  
1510 | Write\_Closing\_Module(1);  
| ^  
fortran.y:2417:60: warning: format specifies type ‘char \*’ but the argument has type ‘listname \*’ (aka ‘struct listname \*’) [-Wformat]  
2417 | printf(“AUTRE = %s %s\n”,(yyvsp[-7].l)-\>var-\>v\_nomvar,(yyvsp[-7].l)-\>var-\>v\_initialvalue\_array);  
| ~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~  
fortran.y:3983:41: warning: passing arguments to ‘Write\_Closing\_Module’ without a prototype is deprecated in all versions of C and is not supported in C23 [-Wdeprecated-non-prototype]  
3983 | Write\_Closing\_Module(1);  
| ^  
fortran.y:4663:41: warning: passing arguments to ‘Write\_Closing\_Module’ without a prototype is deprecated in all versions of C and is not supported in C23 [-Wdeprecated-non-prototype]  
4663 | Write\_Closing\_Module(0);  
| ^  
fortran.lex:51:9: warning: ‘YY\_BUF\_SIZE’ macro redefined [-Wmacro-redefined]  
51 | #define YY\_BUF\_SIZE 64000  
| ^  
fortran.yy.c:159:9: note: previous definition is here  
159 | #define YY\_BUF\_SIZE 16384  
| ^  
5 warnings and 1 error generated.  
fcm\_internal compile failed (256)  
make: \*\*\* [/scratch/sennsi01/nemo\_5.0-beta/tests/MY\_DOME/BLD\_AGRIFLIB/Makefile:391: fortran.o] Error 1  
make -s -f /scratch/sennsi01/nemo\_5.0-beta/tests/MY\_DOME/BLD\_AGRIFLIB/Makefile -j 1 all failed (2) at /scratch/sennsi01/nemo\_5.0-beta/ext/FCM/bin/../lib/Fcm/Build.pm line 597.  
-\>Make: 3 seconds

---

<div class="post-metadata">

**Author:** ![smasson](https://avatars.discourse-cdn.com/v4/letter/s/eb9ed0/32.png) [@smasson](https://nemo-ocean.discourse.group/u/smasson)\
**Post date:** [6 February 2025 13:27 UTC](https://nemo-ocean.discourse.group/t/compilation-problem-with-test-cases-including-agrif-dome-vortex/834/2 "2025-02-06T13:27:34Z")

</div>

I see an error from `icx`. I surprised to see a reference to this c++ compiler as there is no c++ in NEMO.  
Could you give us the contain of your `arch-X64_APP_INTEL_IMPI.fcm` file?  
You should have:  
`%CC icc`

---

<div class="post-metadata">

**Author:** ![sennevilles](https://yyz2.discourse-cdn.com/free1/user_avatar/nemo-ocean.discourse.group/sennevilles/32/11_2.png) [@sennevilles](https://nemo-ocean.discourse.group/u/sennevilles)\
**Post date:** [6 February 2025 15:55 UTC](https://nemo-ocean.discourse.group/t/compilation-problem-with-test-cases-including-agrif-dome-vortex/834/3 "2025-02-06T15:55:57Z")

</div>

Thank you!  
I have some issues to put icc in my apptainer container, but I tried with cc and it worked. I’ll work to get icc and recompile with it after.

---

<div class="post-metadata">

**Author:** ![smasson](https://avatars.discourse-cdn.com/v4/letter/s/eb9ed0/32.png) [@smasson](https://nemo-ocean.discourse.group/u/smasson)\
**Post date:** [6 February 2025 16:10 UTC](https://nemo-ocean.discourse.group/t/compilation-problem-with-test-cases-including-agrif-dome-vortex/834/4 "2025-02-06T16:10:47Z")

</div>

if `cc` works, go for it !  
AGRIF uses a C compiler for the preprocessing of the the file. It has no impact on the compiled routines that are in fortran.

---

<div class="post-metadata">

**Author:** ![jchanut](https://yyz2.discourse-cdn.com/free1/user_avatar/nemo-ocean.discourse.group/jchanut/32/9_2.png) [@jchanut](https://nemo-ocean.discourse.group/u/jchanut)\
**Post date:** [10 February 2025 08:32 UTC](https://nemo-ocean.discourse.group/t/compilation-problem-with-test-cases-including-agrif-dome-vortex/834/5 "2025-02-10T08:32:56Z")

</div>

Hi,  
I step up to the occasion to share a similar AGRIF conv compilation problem (under gcc 14.2.0). It is related to routines `/ext/AGRIF/LIB/fortran.c` and `/ext/AGRIF/LIB/main.c ` for which we had obscure compiltation errors. Problem has been solved (without knowing why !!!) by moving some definitions (`fortran_lex` and `convert_lex`) upwards. Here are the changes for each file:

```auto
[jchanut@lir-frontal-1 nemo]$ git diff ext/AGRIF/LIB/fortran.c
diff --git a/ext/AGRIF/LIB/fortran.c b/ext/AGRIF/LIB/fortran.c
index b9bf767d..76eb03c4 100644
--- a/ext/AGRIF/LIB/fortran.c
+++ b/ext/AGRIF/LIB/fortran.c
@@ -377,7 +377,7 @@ extern YYSTYPE fortran_lval;
 
 int fortran_parse (void);
 
-
+extern int fortran_lex (void);
 
 /* Copy the second part of user declarations. */
 
@@ -10611,7 +10611,7 @@ static int input (void );
 #ifndef YY_DECL
 #define YY_DECL_IS_OURS 1
 
-extern int fortran_lex (void);
+/*extern int fortran_lex (void);*/
 
 #define YY_DECL int fortran_lex (void)
 #endif /* !YY_DECL */ode here

```

and:

```auto
[jchanut@lir-frontal-1 nemo]$ git diff ext/AGRIF/LIB/main.c
diff --git a/ext/AGRIF/LIB/main.c b/ext/AGRIF/LIB/main.c
index 52a9a9e6..219833a9 100644
--- a/ext/AGRIF/LIB/main.c
+++ b/ext/AGRIF/LIB/main.c
@@ -154,7 +154,7 @@ extern YYSTYPE convert_lval;
 
 int convert_parse (void);
 
-
+extern int convert_lex (void);
 
 /* Copy the second part of user declarations. */
 
@@ -2639,7 +2639,7 @@ static int input (void );
 #ifndef YY_DECL
 #define YY_DECL_IS_OURS 1
 
-extern int convert_lex (void);
+/*extern int convert_lex (void);*/
 
 #define YY_DECL int convert_lex (void)
 #endif /* !YY_DECL */

```

---

<div class="post-metadata">

**Author:** ![sennevilles](https://yyz2.discourse-cdn.com/free1/user_avatar/nemo-ocean.discourse.group/sennevilles/32/11_2.png) [@sennevilles](https://nemo-ocean.discourse.group/u/sennevilles)\
**Post date:** [11 February 2025 16:49 UTC](https://nemo-ocean.discourse.group/t/compilation-problem-with-test-cases-including-agrif-dome-vortex/834/6 "2025-02-11T16:49:16Z")

</div>

Hi,

I complete a DOME run with the nemo5-beta (no AGRIF and ln\_read\_cfg = .false.), but even if the NEMO 5 compile, I still get a segmentation fault when I run it, before the 1st time step complete (no time step file).

No AgriF:  
AGRIF\_FixedGrids.in:  
0  
281 361 121 169 2 2 2  
0

The last line of ocean.outpput (no E R R O R in the file):

```
      dyn_spg_ts : surface pressure gradient trend
       ~~~~~~~~~~ free surface with time splitting

```

And then I get a segmentation fault. Any Idea why? No problem when you test it?

Thank you for your time.

---

<div class="post-metadata">

**Author:** ![jchanut](https://yyz2.discourse-cdn.com/free1/user_avatar/nemo-ocean.discourse.group/jchanut/32/9_2.png) [@jchanut](https://nemo-ocean.discourse.group/u/jchanut)\
**Post date:** [12 February 2025 13:14 UTC](https://nemo-ocean.discourse.group/t/compilation-problem-with-test-cases-including-agrif-dome-vortex/834/7 "2025-02-12T13:14:13Z")

</div>

Hi,

How did you fix your compilation problem ?  
I checked DOME in the 5.0 release, and indeed, there are some issues. DOME is actually not part of our routine tests (the so called “sette” tests), so this has not been detected. It appears that the `bdyvol.F90` module located in `/tests/DOME/MY_SRC` is to be incriminated. They are some unallocated arrays (`rnf(:,:)` for example), which may explain your error. It’s quite easy to fix the problem by comparing the `bdyvol` module to the reference one located in `/src/OCE/BDY`. Fixing that, I however found some weird effects in the volume correction along boundaries (it is assumed that the total volume remains constant by adding a flux correction to the west open boundary that compensate for the inflow to the north).  
I will raise a ticket and fix the problem asap.

Jérôme

---

<div class="post-metadata">

**Author:** ![sennevilles](https://yyz2.discourse-cdn.com/free1/user_avatar/nemo-ocean.discourse.group/sennevilles/32/11_2.png) [@sennevilles](https://nemo-ocean.discourse.group/u/sennevilles)\
**Post date:** [12 February 2025 13:28 UTC](https://nemo-ocean.discourse.group/t/compilation-problem-with-test-cases-including-agrif-dome-vortex/834/8 "2025-02-12T13:28:01Z")

</div>

For the compilation , I replaced icx by cc as compiler in the arch file (as suggested by smasson).

```
    # %CC icx
    # %CFLAGS -O0 -lstdc++
    %CC cc
    %CFLAGS -O0  

```

Thank you for the verification on DOME, I’ll use the nemo5-beta until you had time to fix it. Can I be kept in touch once it’s done?

---

<div class="post-metadata">

**Author:** ![jchanut](https://yyz2.discourse-cdn.com/free1/user_avatar/nemo-ocean.discourse.group/jchanut/32/9_2.png) [@jchanut](https://nemo-ocean.discourse.group/u/jchanut)\
**Post date:** [12 February 2025 15:14 UTC](https://nemo-ocean.discourse.group/t/compilation-problem-with-test-cases-including-agrif-dome-vortex/834/9 "2025-02-12T15:14:02Z")

</div>

Here is a quick fix if you want to check: [Draft: Resolve "DOME experiment does not compile" (!832) · Merge requests · NEMO Workspace / Nemo · GitLab](https://forge.nemo-ocean.eu/nemo/nemo/-/merge_requests/832/diffs?commit_id=8eae2cf108ef124587f0b50390db5d147e85f9d1)

(Basically replace your `/tests/DOME/MY_SRC/bdyvol.F90` file by this one)

---

<div class="post-metadata">

**Author:** ![sennevilles](https://yyz2.discourse-cdn.com/free1/user_avatar/nemo-ocean.discourse.group/sennevilles/32/11_2.png) [@sennevilles](https://nemo-ocean.discourse.group/u/sennevilles)\
**Post date:** [12 February 2025 18:14 UTC](https://nemo-ocean.discourse.group/t/compilation-problem-with-test-cases-including-agrif-dome-vortex/834/10 "2025-02-12T18:14:40Z")

</div>

Perfect! It work now, thank you for your quick answers!
