Skip to content

Conversation

@anton-seaice
Copy link
Collaborator

@anton-seaice anton-seaice commented Dec 19, 2025

First I run some experiments and then change is finalised, see

#83 (comment)

@anton-seaice
Copy link
Collaborator Author

 ==> [2025-12-19-03:32:44.628171] No patches needed for cice5
==> [2025-12-19-03:32:44.650460] cice5: Executing phase: 'set_deps_targets'
==> [2025-12-19-03:32:44.713073] cice5: Executing phase: 'edit'
==> [2025-12-19-03:32:44.754735] cice5: Executing phase: 'build'
==> [2025-12-19-03:32:45.975931] Error: ProcessError: Command exited with status 2:
    '/tmp/root/spack-stage/spack-stage-cice5-git.0126c7ac338f3c5d05519764cecf925cbc5d1422_stable-obk6sniut3dcoxtoh5u5dkimpmbl5ifj/spack-src/bld/spack-build.sh' 'auscom' '360x300' '24x1' '24'

3 errors found in build log:
     260    Building dependency for sat_vapor_pres_mod.d
     261    Building dependency for shr_orb_mod.d
     262    Building dependency for surface_flux_mod.d
     263    Building dependency for version_mod.d
     264    mpifort -P -traditional -DLINUX -DPAROPT -DNXGLOB=360 -DNYGLOB=300 
                        -DNUMIN=11 -DNUMAX=99             -DTRAGE=1 -DTRFY=1 -D
            TRLVL=1             -DTRPND=1 -DNTRAERO=0 -DTRBRI=1             -DN
            BGCLYR=0 -DTRBGCS=2             -DNICECAT=5 -DNICELYR=4            
             -DNSNWLYR=1             -DBLCKX=15 -DBLCKY=300 -DMXBLCKS=1 -Dgathe
            r_scatter_barrier -Dncdf -DPIO -DAusCOM -Dcoupled -DOASIS3_MCT -I. 
            -I/tmp/root/spack-stage/spack-stage-cice5-git.0126c7ac338f3c5d05519
            764cecf925cbc5d1422_stable-obk6sniut3dcoxtoh5u5dkimpmbl5ifj/spack-s
            rc/drivers/auscom -I/tmp/root/spack-stage/spack-stage-cice5-git.012
            6c7ac338f3c5d05519764cecf925cbc5d1422_stable-obk6sniut3dcoxtoh5u5dk
            impmbl5ifj/spack-src/source -I/tmp/root/spack-stage/spack-stage-cic
            e5-git.0126c7ac338f3c5d05519764cecf925cbc5d1422_stable-obk6sniut3dc
            oxtoh5u5dkimpmbl5ifj/spack-src/mpi -I/tmp/root/spack-stage/spack-st
            age-cice5-git.0126c7ac338f3c5d05519764cecf925cbc5d1422_stable-obk6s
            niut3dcoxtoh5u5dkimpmbl5ifj/spack-src/io_pio -I/tmp/root/spack-stag
            e/spack-stage-cice5-git.0126c7ac338f3c5d05519764cecf925cbc5d1422_st
            able-obk6sniut3dcoxtoh5u5dkimpmbl5ifj/spack-src/csm_share -I. -I/op
            t/release/linux-rocky8-x86_64/gcc-13.2.0/oasis3-mct-stable-azws3fnu
            qlfgq2p5v2d64wdvur5zobdt/include/psmile.MPI1 -I/opt/release/linux-r
            ocky8-x86_64/gcc-13.2.0/parallelio-2.6.2-gkrdy2kdydaql3x634ew4namno
            kq267p/include -I/opt/release/linux-rocky8-x86_64/gcc-13.2.0/oasis3
            -mct-stable-azws3fnuqlfgq2p5v2d64wdvur5zobdt/include -I/opt/release
            /linux-rocky8-x86_64/gcc-13.2.0/libaccessom2-access-om2-jw7h6mxv362
            txj54a6qg6x5347ab2yah/include -I/opt/release/linux-rocky8-x86_64/gc
            c-13.2.0/netcdf-fortran-4.6.1-ff7gembhstandrvuicgw44lbaukzl44y/incl
            ude /tmp/root/spack-stage/spack-stage-cice5-git.0126c7ac338f3c5d055
            19764cecf925cbc5d1422_stable-obk6sniut3dcoxtoh5u5dkimpmbl5ifj/spack
            -src/source/ice_kinds_mod.F90 -o ice_kinds_mod.f90
     265    /lib/../lib64/crt1.o: In function `_start':
  >> 266    (.text+0x24): undefined reference to `main'
  >> 267    collect2: error: ld returned 1 exit status
  >> 268    make: *** [/tmp/root/spack-stage/spack-stage-cice5-git.0126c7ac338f
            3c5d05519764cecf925cbc5d1422_stable-obk6sniut3dcoxtoh5u5dkimpmbl5if
            j/spack-src/bld/Makefile:120: ice_kinds_mod.o] Error 1
     269    exit 2

See build log for details:
  /tmp/root/spack-stage/spack-stage-cice5-git.0126c7ac338f3c5d05519764cecf925cbc5d1422_stable-obk6sniut3dcoxtoh5u5dkimpmbl5ifj/spack-build-out.txt

@anton-seaice
Copy link
Collaborator Author

anton-seaice commented Dec 19, 2025

@manodeep - do you have any ideas why this change fails for gcc and not for intel?

The -P flag is there, this is failing trying to do preprocessing

This doesn't impact when using CMake, maybe I should just not worry about the Makefile build ?

@anton-seaice
Copy link
Collaborator Author

anton-seaice commented Dec 19, 2025

-P

Inhibit generation of linemarkers in the output from the preprocessor. This might be useful when running the preprocessor on something that is not C code, and is sent to a program that might be confused by the linemarkers.

@anton-seaice
Copy link
Collaborator Author

@manodeep
Copy link
Collaborator

Yes - the -P flag should do the trick of pre-processing - not sure why it fails. May be a -c is needed?

Can you manually run that line and see what it does?

@anton-seaice
Copy link
Collaborator Author

hmm

[as2285@gadi-login-02 source]$ gfortran ice_kinds_mod.F90 
/half-root/usr/bin/../lib/gcc/x86_64-redhat-linux/8/../../../../lib64/crt1.o: In function `_start':
(.text+0x24): undefined reference to `main'
collect2: error: ld returned 1 exit status
[as2285@gadi-login-02 source]$ gfortran -P ice_kinds_mod.F90 
/half-root/usr/bin/../lib/gcc/x86_64-redhat-linux/8/../../../../lib64/crt1.o: In function `_start':
(.text+0x24): undefined reference to `main'
collect2: error: ld returned 1 exit status
[as2285@gadi-login-02 source]$ gfortran -cpp ice_kinds_mod.F90 
/half-root/usr/bin/../lib/gcc/x86_64-redhat-linux/8/../../../../lib64/crt1.o: In function `_start':
(.text+0x24): undefined reference to `main'
collect2: error: ld returned 1 exit status
[as2285@gadi-login-02 source]$ gfortran -P -traditional ice_kinds_mod.F90 
/half-root/usr/bin/../lib/gcc/x86_64-redhat-linux/8/../../../../lib64/crt1.o: In function `_start':
(.text+0x24): undefined reference to `main'
collect2: error: ld returned 1 exit status
[as2285@gadi-login-02 source]$ which gcc
/opt/nci/bin/gcc

@anton-seaice
Copy link
Collaborator Author

gfortran -E -P ice_kinds_mod.F90 -o ice_kinds_mod.f90

works

however

ifx -E -P ice_kinds_mod.F90 -o ice_kinds_mod.f90

does not, it writes output to the terminal (See IFX manual)

@anton-seaice
Copy link
Collaborator Author

anton-seaice commented Jan 5, 2026

This changes closes #51 by setting different arguments to conduct preprocessing for intel and gfortran compilers.

intel needs "-fpp -P" whilst gfortran needs "-cpp -E"

Using the intel compiler for preprocessing defines some compiler specific directives (e.g. __INTEL_COMPILER__) which are not available if preprocessing using cpp directely.

@anton-seaice anton-seaice marked this pull request as ready for review January 5, 2026 02:01
@anton-seaice anton-seaice self-assigned this Jan 5, 2026
@anton-seaice anton-seaice changed the title makefile using gc for preproc Use gfortran for preprocessing instead of cpp Jan 5, 2026
@anton-seaice anton-seaice changed the title Use gfortran for preprocessing instead of cpp Use fortran compilers for preprocessing instead of cpp Jan 5, 2026
Copy link

@dougiesquire dougiesquire left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. Does the compiler detection also need to be added to the access-esm1.6 branch?

@anton-seaice
Copy link
Collaborator Author

LGTM. Does the compiler detection also need to be added to the access-esm1.6 branch?

Planning to fix this by merging the branches in #68 :)

@anton-seaice anton-seaice merged commit fed0fc3 into master Jan 5, 2026
7 checks passed
@anton-seaice anton-seaice deleted the gcc-tests branch January 5, 2026 21:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants