# Setting build options for OM3

**URL:** <https://forum.access-hive.org.au/t/setting-build-options-for-om3/4495>\
**Category:** Regional MOM6\
**Tags:** spack\
**Created:** [23 April 2025 04:25 UTC](https://forum.access-hive.org.au/t/setting-build-options-for-om3/4495 "2025-04-23T04:25:02Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![Paul.Gregory](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.access-hive.org.au/paul.gregory/32/2566_2.png) [@Paul.Gregory](https://forum.access-hive.org.au/u/Paul.Gregory)\
**Post date:** [23 April 2025 04:25 UTC](https://forum.access-hive.org.au/t/setting-build-options-for-om3/4495/1 "2025-04-23T04:25:02Z")

</div>

Hello.

NCI have gotten back to me with the tools they use for MPI debugging. See here

> **[How to Debug Parallel Programs - NCI Help - Opus - NCI Confluence](https://opus.nci.org.au/spaces/Help/pages/15866763/How+to+Debug+Parallel+Programs)**

Some I want to build a MOM6 executable with debugging so I can find out why it fails for this particular case (but runs successfully for many other configurations!).

Now I have to remember the procedures to compiling your own MOM6 versions.

I have installed Spack before, following these instructions.

[https://access-hive.org.au/models/run-a-model/build\_a\_model/#concretize-the-spack-environment](https://access-hive.org.au/models/run-a-model/build_a_model/#concretize-the-spack-environment)

I’ll follow @Helen’s instructions here to compile OM3

> [@ACCESS-ROM3 setup instructions](https://forum.access-hive.org.au/t/access-rom3-setup-instructions/4107):
>
> Introduction These are the steps needed to convert an ACCESS-OM3 model configuration to a regional model configuration run on NUPOC. If you would like to view an example setup there is one [here](https://github.com/ACCESS-NRI/access-om3-configs/tree/dev-regional_jra55do_ryf). To download this you need to run git clone --branch dev-regional\_jra55do\_ryf https://github.com/ACCESS-NRI/access-om3-configs/ if you want to see some of steps described in the instructions below then run cd access-om3-configs git log -16 This will provide a log of the changes performed to conver…

Just checking - those instructions state:

> I suggest skipping this step for now and waiting a couple of weeks before trying as there are some changes coming through that will make it easier.
> 
> The modifications are when you reach this step:
> 
> ```auto
> git clone https://github.com/ACCESS-NRI/ACCESS-ESM1.5.git
> spack env create mom5_dev ACCESS-ESM1.5/spack.yaml
> 
> ```
> 
> you need to change to this:
> 
> ```auto
> git clone https://github.com/ACCESS-NRI/ACCESS-OM3.git
> spack env create mom6_dev ACCESS-OM3/spack.yaml
> 
> ```
> 
> If you wait a couple of weeks, these next changes will not be necessary
> 
> Then, in spack.yaml you need to change
> 
> ```auto
> access-om3-nuopc:
> require:
> - '@git.0.3.1'
> 
> ```
> 
> to
> 
> ```auto
> access-om3-nuopc:
> require:
> - '@git.0.3.1'
> - configurations=MOM6
> - +mom_symmetric 
>         
> 
> ```

Are those still the current instructions for compiling OM3?

Last December I did manage to compile an older executable, see here

[https://21centuryweather.discourse.group/t/develop-a-regional-coupled-modelling-strategy/168/41](https://21centuryweather.discourse.group/t/develop-a-regional-coupled-modelling-strategy/168/41)

Thanks

---

<div class="post-metadata">

**Author:** ![Paul.Gregory](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.access-hive.org.au/paul.gregory/32/2566_2.png) [@Paul.Gregory](https://forum.access-hive.org.au/u/Paul.Gregory)\
**Post date:** [23 April 2025 07:26 UTC](https://forum.access-hive.org.au/t/setting-build-options-for-om3/4495/2 "2025-04-23T07:26:31Z")

</div>

Ok thanks.

I’ll run through everything from scratch and document every step.

Quick question - where do you specify DEBUG compilation for OM3?

I’m looking through CMakeLists.txt and the CMake .json files, and grepped for ‘debug’ in my OM3 source directory, but I can’t find the switch to enable DEBUG compilation.

Thanks

---

<div class="post-metadata">

**Author:** ![anton](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.access-hive.org.au/anton/32/1836_2.png) [@anton](https://forum.access-hive.org.au/u/anton)\
**Post date:** [30 April 2025 01:06 UTC](https://forum.access-hive.org.au/t/setting-build-options-for-om3/4495/3 "2025-04-30T01:06:57Z")

</div>

> [@Paul.Gregory](#):
>
> Ok thanks.
> 
> I’ll run through everything from scratch and document every step.
> 
> Quick question - where do you specify DEBUG compilation for OM3?
> 
> I’m looking through CMakeLists.txt and the CMake .json files, and grepped for ‘debug’ in my OM3 source directory, but I can’t find the switch to enable DEBUG compilation.
> 
> Thanks

As I understand it Debug is included in the CMake build and a [default spack variant.](https://spack.readthedocs.io/en/latest/build_systems/cmakepackage.html#cmake-arguments-provided-by-spack)

So in your spack environment file, add the `build_type=Debug` variant to the `access-om3-nuopc` package.

I’ve kicked off an build [here](https://github.com/ACCESS-NRI/ACCESS-OM3/pull/81) to see what happens, this is mostly untested. (We haven’t been regularly doing this, so no promises for example that a debug build will even run ).

---

<div class="post-metadata">

**Author:** ![Paul.Gregory](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.access-hive.org.au/paul.gregory/32/2566_2.png) [@Paul.Gregory](https://forum.access-hive.org.au/u/Paul.Gregory)\
**Post date:** [9 May 2025 03:11 UTC](https://forum.access-hive.org.au/t/setting-build-options-for-om3/4495/4 "2025-05-09T03:11:06Z")

</div>

Hi @anton

I’ve pulled the latest version of [GitHub - ACCESS-NRI/ACCESS-OM3: ACCESS-OM3 repository for spack configuration information](https://github.com/ACCESS-NRI/ACCESS-OM3.git) into my `Spack` directory, I’ve rebuilt my `mom6_env` environment and now I’m installing this version.

When I get onto compiling/installing a version using debug flags, do you want me to create a ‘development branch’ as outlined in

> **[Modify and build an ACCESS model's source code - ACCESS-Hive Docs](https://access-hive.org.au/models/run-a-model/build_a_model/#spack-version-local-package)**

?

Or is that overkill for a version that will most likely only ever sit on my local disk.

---

<div class="post-metadata">

**Author:** ![anton](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.access-hive.org.au/anton/32/1836_2.png) [@anton](https://forum.access-hive.org.au/u/anton)\
**Post date:** [9 May 2025 04:38 UTC](https://forum.access-hive.org.au/t/setting-build-options-for-om3/4495/5 "2025-05-09T04:38:04Z")

</div>

If the changes are ONLY to compiler flags, and no source code changes are needed, then there is no need for the `spack develop` process.

Make the changes to the compiler flags in the `spack.yaml`, then run concretise and install.

There are some notes here about setting flags:

> **[Spack](https://github.com/ACCESS-NRI/dev-docs/wiki/Spack#compiler-flag-override)**
>
> ACCESS-NRI internal development documentation. Contribute to ACCESS-NRI/dev-docs development by creating an account on GitHub.

and I updated the example [here](https://github.com/ACCESS-NRI/ACCESS-OM3/pull/81/files) with setting `fflags`

Note between posts we updated how access-om3 is built. There is now a seperate spack package for each model component now.

Is this for regional work? If using the [latest](https://github.com/ACCESS-NRI/ACCESS-OM3/commit/2cbdd45bb59b4e2a7982d6d9455b43822691d781) from main, you probably want to change to something like this:

```auto
spack:
  specs:
    - access-om3@git.2025.05.000
  packages:
    # Main Dependencies
    access3:
      require:
        - '@git.2025.03.0'
        - configurations=MOM6
    access-mom6:
      require:
        - '@git.2025.02.000'
        - '~asymmetric_mem'
    access3-share:
      require:
        - '@git.2025.03.0'
... #leave Other Dependencies etc unchanged

```

You can then add `build_type` and `cflags` and `fflags` to each of those packages.

---

<div class="post-metadata">

**Author:** ![Paul.Gregory](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.access-hive.org.au/paul.gregory/32/2566_2.png) [@Paul.Gregory](https://forum.access-hive.org.au/u/Paul.Gregory)\
**Post date:** [9 May 2025 04:44 UTC](https://forum.access-hive.org.au/t/setting-build-options-for-om3/4495/6 "2025-05-09T04:44:17Z")

</div>

Thanks Anton. This is for regional work. I will follow your guidelines.

Thanks

---

<div class="post-metadata">

**Author:** ![Paul.Gregory](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.access-hive.org.au/paul.gregory/32/2566_2.png) [@Paul.Gregory](https://forum.access-hive.org.au/u/Paul.Gregory)\
**Post date:** [9 May 2025 06:43 UTC](https://forum.access-hive.org.au/t/setting-build-options-for-om3/4495/7 "2025-05-09T06:43:34Z")

</div>

Ok in `environments/mom6_dev/spack.yaml` I changed

```auto
    access-mom6:
      require:
        - '@git.2025.02.000'
        - '+asymmetric_mem'

```

To

```auto
    access-mom6:
      require:
        - '@git.2025.02.000'
        - '+asymmetric_mem'
        - build_type=Debug
        - 'fflags="-g"''

```

To just recompile the mom6 executable with debug symbols.

`$ spack install` then executed with the following:

```auto
	[+] /usr (external glibc-2.28-gkllvhliut5hnwpt7ydwtbnemqcwxc5u)
==> openmpi@4.1.7 : has external module in ['openmpi/4.1.7']
[+] /apps/openmpi/4.1.7 (external openmpi-4.1.7-dsgaldxhkofee6argfqcozt6fd3zcq52)
[+] /g/data/gb02/pag548/spack/0.22/release/linux-rocky8-x86_64_v4/gcc-14.1.0/gcc-runtime-14.1.0-dmmd5lphbqt7scvbujxcotxgmlxvtlvt
[+] /g/data/gb02/pag548/spack/0.22/release/linux-rocky8-x86_64_v4/oneapi-2025.0.4/intel-oneapi-runtime-2025.0.4-otx2alpzeflc56jg5fimh4dygkmmurd2
[+] /g/data/gb02/pag548/spack/0.22/release/linux-rocky8-x86_64_v4/oneapi-2025.0.4/zlib-ng-2.1.6-e6syrfr5fdorrhuf726b2z5nfwwmu5a7
[+] /g/data/gb02/pag548/spack/0.22/release/linux-rocky8-x86_64_v4/oneapi-2025.0.4/zstd-1.5.6-wvekoquwtk3aq5dkfnsy7nmbeklieovx
...
etc

```

But that hasn’t changed the modified times of any files in

```auto
./release/linux-rocky8-x86_64_v4/gcc-14.1.0/gcc-runtime-14.1.0-dmmd5lphbqt7scvbujxcotxgmlxvtlvt/lib/

```

or

```auto
./release/linux-rocky8-x86_64_v4/oneapi-2025.0.4/

```

Do I need to run the `concrete` step again so it actually re-compiles the source with debug symbols?

EDIT: Yes I do. From the NRI docs

" [Concretizing](https://spack.readthedocs.io/en/latest/environments.html#concretizing) the _Spack_ environment is necessary anytime the environment’s `spack.yaml` gets changed, to force _Spack_ to update its knowledge of the environment configuration."

So after making those edits, I ran

```auto
$ spack concretize -f 
==> Error: Spack concretizer internal error. Please submit a bug report and include the command, environment if applicable and the following error message.
    access-om3@git.2025.05.000=2025.05.000 is unsatisfiable, errors are:
    internal_error("Reuse version weight used for build package")
    internal_error("must choose a single version to satisfy version constraints")
    internal_error("version weights must exist and be unique")

```

Clearly I’ve broken the package configuration. Time to do some more reading.

BTW any suggestions about spack tutorials? I’m reading through the slides available here:

> **[Tutorial: Spack 101 — Spack Tutorial documentation](https://spack-tutorial.readthedocs.io/en/latest/)**

---

<div class="post-metadata">

**Author:** ![anton](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.access-hive.org.au/anton/32/1836_2.png) [@anton](https://forum.access-hive.org.au/u/anton)\
**Post date:** [9 May 2025 07:22 UTC](https://forum.access-hive.org.au/t/setting-build-options-for-om3/4495/8 "2025-05-09T07:22:28Z")

</div>

1. For regional, you want to use `~asymmetric_mem` (i.e. NOT-asymmetric\_mem, which is equivalent to the old +MOM\_symmetric)

2. Yes you need to run `spack concretise` again

Possibly `spack concretise --reuse-deps -f`. If that doesn’t do anything, then `spack concretise --fresh -f`

Spack concretise should print output to the terminal. If there is no output nothing happened.

Next to each package (on the left) in the concretise printout there should be a `+` (use existing install) , - (build & install), or e (use external install). There should be a `-` next to access-mom6

```auto
$ spack concretize -f 
==> Error: Spack concretizer internal error. Please submit a bug report and include the command, environment if applicable and the following error message.
    access-om3@git.2025.05.000=2025.05.000 is unsatisfiable, errors are:
    internal_error("Reuse version weight used for build package")
    internal_error("must choose a single version to satisfy version constraints")
    internal_error("version weights must exist and be unique")

```

This error means (approximately), _spack has tried to match the package you are requesting against one that is already installed. spack found access-om3 package already installed but its different to what your spack.yaml is requesting._ If you use the --reuse-deps or --fresh flag with concretise, it will tell spack to replace the existing installation of the access-om3 package with a new build of it.

I am not sure on spack docs - hoping @harshula has suggestions

---

<div class="post-metadata">

**Author:** ![Paul.Gregory](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.access-hive.org.au/paul.gregory/32/2566_2.png) [@Paul.Gregory](https://forum.access-hive.org.au/u/Paul.Gregory)\
**Post date:** [9 May 2025 08:05 UTC](https://forum.access-hive.org.au/t/setting-build-options-for-om3/4495/9 "2025-05-09T08:05:35Z")

</div>

OK this didn’t work.

```auto
$ spack concretize --reuse-deps -f 
==> Error: concretization failed for the following reasons:

   1. Cannot select a single "version" for package "access3-share"
   2. Cannot select a single "version" for package "access3"
   3. cannot satisfy a requirement for package 'esmf'.
   4. cannot satisfy a requirement for package 'access3-share'.
   5. cannot satisfy a requirement for package 'access3'.
   6. access3: A configurations variant must be set, can be one or many of ('MOM6', 'CICE6', 'WW3', 'MOM6-WW3', 'MOM6-CICE6', 'CICE6-WW3', 'MOM6-CICE6-WW3')
   7. access3: A configurations variant must be set, can be one or many of ('MOM6', 'CICE6', 'WW3', 'MOM6-WW3', 'MOM6-CICE6', 'CICE6-WW3', 'MOM6-CICE6-WW3')
        required because conflict is triggered when configurations=none 
        required because conflict constraint  

```

But this did.

```auto
 spack concretize --fresh -f 
==> Warning: using "cmake@3.24.2" which is a deprecated version
==> Concretized access-om3@git.2025.05.000=2025.05.000
 - xiebyhy access-om3@git.2025.05.000=2025.05.000%oneapi@2025.0.4 build_system=bundle arch=linux-rocky8-x86_64_v4
 - ohls2xb ^access3@git.2025.03.0=2025.03.0%oneapi@2025.0.4~ipo build_system=cmake build_type=Release configurations=MOM6-CICE6,MOM6-CICE6-WW3 generator=make arch=linux-rocky8-x86_64_v4
[+] q7a6p2x ^access-cice@git.CICE6.6.0-1=6.6.0-1%oneapi@2025.0.4+access3~ipo~openmp build_system=cmake build_type=Release generator=make io_type=PIO arch=linux-rocky8-x86_64_v4
[+] bab6hiz ^parallelio@2.6.2%oneapi@2025.0.4+fortran~ipo~logging+mpi~ncint~pnetcdf+shared~timing build_system=cmake build_type=Release generator=make arch=linux-rocky8-x86_64_v4
 - nz62ock ^access-mom6@git.2025.02.000=2025.02.000%oneapi@2025.0.4 fflags=-g +access3+asymmetric_mem~ipo~openmp build_system=cmake build_type=Debug generator=make arch=linux-rocky8-x86_64_v4
[+] kcucsid ^fms@git.2024.03=2024.01.02-git.26%oneapi@2025.0.4~deprecated_io~gfs_phys+internal_file_nml~ipo+large_file~openmp~pic~quad_precision~yaml build_system=cmake build_type=Release constants=GFDL generator=make precision=32,64 arch=linux-rocky8-x86_64_v4
...
etc

```

So onto `spack install` which successfully built and installed `access-mom6-git`, but failed to build `access3`. Snippets from the `stdout`.

```auto
==> Installing access-mom6-git.2025.02.000=2025.02.000-nz62ocks3w3h7kapo2dgvgxt527podyr [24/27]
==> No binary for access-mom6-git.2025.02.000=2025.02.000-nz62ocks3w3h7kapo2dgvgxt527podyr found: installing from source
==> No patches needed for access-mom6
==> access-mom6: Executing phase: 'cmake'
==> access-mom6: Executing phase: 'build'
==> access-mom6: Executing phase: 'install'
==> access-mom6: Successfully installed access-mom6-git.2025.02.000=2025.02.000-nz62ocks3w3h7kapo2dgvgxt527podyr
  Stage: 8.35s. Cmake: 19.74s. Build: 2m 6.01s. Install: 1.47s. Post-install: 1.16s. Total: 2m 40.88s
[+] /g/data/gb02/pag548/spack/0.22/release/linux-rocky8-x86_64_v4/oneapi-2025.0.4/access-mom6-git.2025.02.000_2025.02.000-nz62ocks3w3h7kapo2dgvgxt527podyr
[+] /g/data/gb02/pag548/spack/0.22/release/linux-rocky8-x86_64_v4/oneapi-2025.0.4/access-cice-git.CICE6.6.0-1_6.6.0-1-q7a6p2xadrqkpwqitsvuufoudeisgxi4
==> Installing access3-git.2025.03.0=2025.03.0-ohls2xbbwpj5gzygz6fx7lwveepcdxvc [26/27]
==> No binary for access3-git.2025.03.0=2025.03.0-ohls2xbbwpj5gzygz6fx7lwveepcdxvc found: installing from source
==> No patches needed for access3
==> access3: Executing phase: 'cmake'
==> access3: Executing phase: 'build'
==> Error: ProcessError: Command exited with status 2:
    'make' '-j16'

```

Where can I find the build log?

Thanks for your help - I can pick this up again next week.

---

<div class="post-metadata">

**Author:** ![anton](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.access-hive.org.au/anton/32/1836_2.png) [@anton](https://forum.access-hive.org.au/u/anton)\
**Post date:** [11 May 2025 23:04 UTC](https://forum.access-hive.org.au/t/setting-build-options-for-om3/4495/10 "2025-05-11T23:04:59Z")

</div>

Hi Paul

Normally it prints the path the spack build log to the terminal. I think its typically 'spack-build.out` or something like that.

I realised my instructions weren’t very clear. I made a new example [here](https://github.com/ACCESS-NRI/ACCESS-OM3/pull/86/files). The pre-release infrastructure we have will make a (temporary) build from that environment file (spack.yaml) and leave a comment with the path to the new build, if you want to use it.

---

<div class="post-metadata">

**Author:** ![anton](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.access-hive.org.au/anton/32/1836_2.png) [@anton](https://forum.access-hive.org.au/u/anton)\
**Post date:** [12 May 2025 00:42 UTC](https://forum.access-hive.org.au/t/setting-build-options-for-om3/4495/11 "2025-05-12T00:42:23Z")

</div>

My [tests](https://github.com/ACCESS-NRI/ACCESS-OM3/actions/runs/14961293553) all failed with linking errors.

Do debug builds rely on having their dependent libraries also using debug build types ?

---

<div class="post-metadata">

**Author:** ![Paul.Gregory](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.access-hive.org.au/paul.gregory/32/2566_2.png) [@Paul.Gregory](https://forum.access-hive.org.au/u/Paul.Gregory)\
**Post date:** [12 May 2025 02:16 UTC](https://forum.access-hive.org.au/t/setting-build-options-for-om3/4495/12 "2025-05-12T02:16:25Z")

</div>

Hi Anton

I’m at the CoE hackathon this week so I’ll be slow in replying.

Generally, if you are building an executable for debugging, all libraries will need to be compiled with debug symbols.

I’m unsure how the MOM6 code interacts with the other binaries (esmf, nuopcy etc) but we may have to add ‘-g’ to all other libraries used within MOM6?

I had assumed that the if you didn’t have debug symbols compiled w/esmf or nuopcy libraries, the debugger will just pass through any modules imported without debug symbols and carry on as normal.

(As you can tell, it’s been a while since I’ve been into the weeks debugging complex Fortran source).

When building rMOM6, spack correctly builds and installs the `access-mom6` repo but fails with with `access3` repo. What does that code do? Is is the Fortran source which combines the MOM6 and CICE modules?

I might try to add ‘-g’ to the CICE build flags. I’ll also update my `spack.yaml` to reflect the changes your made to specify symmetric memory etc.

I will also check out some old Fortran source from an older project I build, play around with ‘-g’ to remember what I’ve forgotten about using ‘-g’ symbols in some libraries.

BTW I couldn’t find any `.out` or `.log` files that were created last Friday night.

```auto
$ find . -name '*.out'
./spack/var/spack/repos/tutorial/packages/hdf5/test/dump.out
./spack/var/spack/repos/builtin/packages/hdf/test/storm110.out
./spack/var/spack/repos/builtin/packages/sqlite/test/dump.out
./spack/var/spack/repos/builtin/packages/m4/test/hello.out
./spack/var/spack/repos/builtin/packages/libsigsegv/test/smoke_test.out
./spack/var/spack/repos/builtin/packages/pocl/example1.out
./spack/var/spack/repos/builtin/packages/hdf5/test/dump.out
$ find . -name '*.log'
./environments/mom6_dev/.spack-env/._view/4i2bucb5onztwymj4nixfyixsvoh2aks/.spack/pkgconf/archived-files/spack-src/config.log
./environments/mom6_dev/.spack-env/._view/4i2bucb5onztwymj4nixfyixsvoh2aks/.spack/fortranxml/archived-files/spack-src/config.log
./environments/mom6_dev/.spack-env/._view/4i2bucb5onztwymj4nixfyixsvoh2aks/.spack/netcdf-fortran/archived-files/spack-src/config.log
./release/linux-rocky8-x86_64_v4/oneapi-2025.0.4/netcdf-fortran-4.6.1-cgiqrwtnubuunpbnldlr6bzwnvr7axwh/.spack/archived-files/spack-src/config.log
./release/linux-rocky8-x86_64_v4/oneapi-2025.0.4/libiconv-1.17-ke6wac5eiwo6iunhzyiuzua7rm7vomti/.spack/archived-files/spack-src/config.log
./release/linux-rocky8-x86_64_v4/oneapi-2025.0.4/pkgconf-2.2.0-uceimu4ka7s5img5e2a3si4gobfot7f3/.spack/archived-files/spack-src/config.log
./release/linux-rocky8-x86_64_v4/oneapi-2025.0.4/libsigsegv-2.14-tg4yy6k6if2clgyedtkxjrn352ielq3j/.spack/archived-files/spack-src/config.log
./release/linux-rocky8-x86_64_v4/oneapi-2025.0.4/fortranxml-4.1.2-w3qlf2kquynkgzx56gw4qp5gugzsrdp2/.spack/archived-files/spack-src/config.log
./release/linux-rocky8-x86_64/intel-2021.10.0/netcdf-fortran-4.6.1-2rodmlet2itybhmrtv6c4mxwwuf365gk/.spack/archived-files/spack-src/config.log
./release/linux-rocky8-x86_64/intel-2021.10.0/netcdf-c-4.9.2-ziq6jbzf6iolb2sfsbacme66hcxfroar/.spack/archived-files/spack-src/config.log
./release/linux-rocky8-x86_64/intel-2021.10.0/libsigsegv-2.14-ou7jkjx57rak4vlkm6ifyoodv4jgxed7/.spack/archived-files/spack-src/config.log
./release/linux-rocky8-x86_64/intel-2021.10.0/fortranxml-4.1.2-bcbruwvclii2pzaistgkxzakmq4hqglj/.spack/archived-files/spack-src/config.log
./release/linux-rocky8-x86_64/intel-2021.10.0/libiconv-1.17-55ipnyeeqcpbfgaqfanu36viaqqni3sx/.spack/archived-files/spack-src/config.log
./release/linux-rocky8-x86_64/intel-2021.10.0/netcdf-fortran-4.6.1-3iyx7hnvowobxccwlf3isebu5ykypflz/.spack/archived-files/spack-src/config.log
./release/linux-rocky8-x86_64/intel-2021.10.0/pkgconf-2.2.0-vrupasu7smpgcbarzpdwap45fcvjbjoa/.spack/archived-files/spack-src/config.log

```

---

<div class="post-metadata">

**Author:** ![anton](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.access-hive.org.au/anton/32/1836_2.png) [@anton](https://forum.access-hive.org.au/u/anton)\
**Post date:** [12 May 2025 05:17 UTC](https://forum.access-hive.org.au/t/setting-build-options-for-om3/4495/13 "2025-05-12T05:17:03Z")

</div>

No worries

Sorry for the vague instructions - try looking in `/scratch/{USER}/{PROJECT}/tmp/spack-stage/...` for `spack-build-*` files.

`access-MOM6` builds a library with the MOM6 code.

`access3` builds the final executable and links to MOM6 and the mediator/data/shared code (from the `access3-share` repo)

---

<div class="post-metadata">

**Author:** ![anton](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.access-hive.org.au/anton/32/1836_2.png) [@anton](https://forum.access-hive.org.au/u/anton)\
**Post date:** [12 May 2025 06:35 UTC](https://forum.access-hive.org.au/t/setting-build-options-for-om3/4495/14 "2025-05-12T06:35:55Z")

</div>

It looks like we tend to already set `-g` as a build flag when the build type of Debug is specified. (e.g. [here](https://github.com/ACCESS-NRI/MOM6/blob/e088c8b7f6c2b18b72edd568aa009e13396ec0c3/CMakeLists.txt#L45) it is for MOM6)

---

<div class="post-metadata">

**Author:** ![Paul.Gregory](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.access-hive.org.au/paul.gregory/32/2566_2.png) [@Paul.Gregory](https://forum.access-hive.org.au/u/Paul.Gregory)\
**Post date:** [13 May 2025 05:11 UTC](https://forum.access-hive.org.au/t/setting-build-options-for-om3/4495/15 "2025-05-13T05:11:52Z")

</div>

Hi Anton.

Grabbed a few moments in the hackathon to try this. I modified my`spack.yml` according to [your link](https://github.com/ACCESS-NRI/ACCESS-OM3/pull/86/files)

```auto
	spack:
	  specs:
	    - access-om3@git.2025.05.000
	  packages:
	    # Main Dependencies
	    access3:
	      require:
	        - '@git.2025.03.0'
	        - configurations=MOM6-CICE6,MOM6-CICE6-WW3
	        - build_type=Debug
	    access-cice:
	      require:
	        - '@git.CICE6.6.0-1'
	        - io_type=PIO
	        - build_type=Debug
	    access-mom6:
	      require:
	        - '@git.2025.02.000'
	        - '~asymmetric_mem'
	        - build_type=Debug
	    access-ww3:
	      require:
	        - '@git.2025.03.0'
	        - build_type=Debug
	    access3-share:
	      require:
	        - '@git.2025.03.0'
	        - build_type=Debug

```

I left the lower dependencies (e.g. netcdf) unchanged.

Some components compiled and installed:

```auto
==> access-mom6: Successfully installed access-mom6-git.2025.02.000=2025.02.000-bmoklvmdkhx2wf4ol4f4c4xamqx345fo

==> access-cice: Successfully installed access-cice-git.CICE6.6.0-1=6.6.0-1-itp33tqxlkapdi2f7dowdm2mk2zksipv

==> access3-share: Successfully installed access3-share-git.2025.03.0=2025.03.0-owex7brdpgjc2qaeppashaybc24flovc

```

But access3-git failed with a linking error.

```auto
bin/ld: cannot find -lm
/bin/ld: attempted static link of dynamic object `/g/data/gb02/pag548/spack/0.22/release/linux-rocky8-x86_64_v4/oneap
i-2025.0.4/netcdf-c-4.9.2-faxerxqp66ncohntmknr46mwiods57hf/lib64/libnetcdf.so

==> Warning: Skipping build of access3-git.2025.03.0=2025.03.0-27iycvrrzsgpp5ngod4q5vllnkg22wvs since access-ww3-git.2025.03.0=2025.03.0-plfsbxpojkcvdar2szp3t5warhalgfou failed

```

Is that the same error you had?

I then altered the netcdf section of `spack.yml`:

```auto
    netcdf-c:
      require:
        - '@4.9.2'
        - ~shared build_system=cmake build_type=RelWithDebInfo

```

But the error remains. It’s odd that one component fails (`access3-git`) while others succeed.

Do you want me to clone your OM3 debug configuration and run that, just to make sure we are on the same page?

---

<div class="post-metadata">

**Author:** ![anton](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.access-hive.org.au/anton/32/1836_2.png) [@anton](https://forum.access-hive.org.au/u/anton)\
**Post date:** [13 May 2025 05:16 UTC](https://forum.access-hive.org.au/t/setting-build-options-for-om3/4495/16 "2025-05-13T05:16:39Z")

</div>

Ok thanks Paul - that’s weirdly good news. That is the error I’m having

I think that it’s related to moving from the intel-classic compiler (ifort) to the oneapi compiler (ifx). I am just trying to confim that.

I can’t find anything that changes between Debug and Release related to linking. e.g. `-lm` is present in the Release build, netcdf-c is a .so in Release build and works fine during linking etc … I will have a look at the build flags we set for Debug builds next.

---

<div class="post-metadata">

**Author:** ![anton](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.access-hive.org.au/anton/32/1836_2.png) [@anton](https://forum.access-hive.org.au/u/anton)\
**Post date:** [13 May 2025 22:56 UTC](https://forum.access-hive.org.au/t/setting-build-options-for-om3/4495/17 "2025-05-13T22:56:48Z")

</div>

Hi Paul

The failure is related to the `-check uninit` flag - see [Debug builds broken · Issue #94 · ACCESS-NRI/ACCESS-OM3 · GitHub](https://github.com/ACCESS-NRI/ACCESS-OM3/issues/94)

---

<div class="post-metadata">

**Author:** ![Paul.Gregory](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.access-hive.org.au/paul.gregory/32/2566_2.png) [@Paul.Gregory](https://forum.access-hive.org.au/u/Paul.Gregory)\
**Post date:** [13 May 2025 23:28 UTC](https://forum.access-hive.org.au/t/setting-build-options-for-om3/4495/18 "2025-05-13T23:28:45Z")

</div>

Morning Anton. That’s some good detective work.

So the plan is to edit the  
`set(CMAKE_Fortran_FLAGS_DEBUG`  
statement to remove  
`-check uninit`

from the `access3` CMake files and try install again?

EDIT :

Or follow your updated `spack.yaml` here?

> <https://github.com/ACCESS-NRI/ACCESS-OM3/blob/om3-mom6-debug-example/spack.yaml>

UPDATE : I copied your config above, i.e.

```auto
    access3:
      require:
        - '@git.2025.03.0'
        - configurations=MOM6
        - fflags="-O0 -g -check bounds -check pointers -fpe0 -check noarg_temp_created"

```

but that hasn’t changed the compiler flags. From the `spack install` log

```auto
/g/data/gb02/pag548/spack/0.22/spack/lib/spack/env/oneapi/ifx -L/apps/openmpi-mofed5.8-pbs2021.1/4.1.7/lib -pthread -
qno-opt-dynamic-align -convert big_endian -assume byterecl -ftz -traceback -assume realloc_lhs -fp-model precise -O0 
-g -check uninit -check bounds -check pointers -fpe0 -check noarg_temp_created CMakeFiles/ww3_strt.dir/model/src/ww3_s
trt.F90.o -o ww3_strt -Wl,-rpath,/g/data/gb02/pag548/spack/0.22/release/linux-rocky8-x86_64_v4/oneapi-2025.0.4/netcdf
-fortran-4.6.1-cgiqrwtnubuunpbnldlr6bzwnvr7axwh/lib:

```

you can see that `-check uninit` is still being passed. So I’m going to make changes to the definition of  
`set(CMAKE_Fortran_FLAGS_DEBUG`  
for access3

---

<div class="post-metadata">

**Author:** ![anton](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.access-hive.org.au/anton/32/1836_2.png) [@anton](https://forum.access-hive.org.au/u/anton)\
**Post date:** [14 May 2025 00:19 UTC](https://forum.access-hive.org.au/t/setting-build-options-for-om3/4495/19 "2025-05-14T00:19:23Z")

</div>

> [@Paul.Gregory](#):
>
> So I’m going to make changes to the definition of  
> `set(CMAKE_Fortran_FLAGS_DEBUG`  
> for access3

Sounds good - this is probably the simplest workaround for now. (You’ll need to use `spack develop` on the `access3` package)

I’m not sure why the fflags didn’t get passed through as expected. I’ll investigate.

We’ll have to figure out if we think the check is important or not, and then make a plan.

---

<div class="post-metadata">

**Author:** ![Paul.Gregory](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.access-hive.org.au/paul.gregory/32/2566_2.png) [@Paul.Gregory](https://forum.access-hive.org.au/u/Paul.Gregory)\
**Post date:** [14 May 2025 06:34 UTC](https://forum.access-hive.org.au/t/setting-build-options-for-om3/4495/20 "2025-05-14T06:34:38Z")

</div>

Hi Anton.

Which `access3` package will I be modifying?

Is it

> **[GitHub - ACCESS-NRI/access3-share: Shared code for access 3 models using NUOPC +...](https://github.com/ACCESS-NRI/access3-share/tree/main)**
>
> main

I’ve executed

```auto
$ spack develop access3@git.2025.03.0

```

I’m now trying to see where the source code is.

EDIT : Found it, its installed it in  
`environments/mom6_dev/access3/`

Edited line 5 of ./environments/mom6\_dev/access3/CMakeLists.txt  
From

```auto
  set(CMAKE_Fortran_FLAGS_DEBUG "-O0 -g -check uninit -check bounds -
`check pointers -fpe0 -check noarg_temp_created")

```

to

```auto
  set(CMAKE_Fortran_FLAGS_DEBUG "-O0 -g -check bounds -check pointers -fpe0 -check noarg_temp_created")

```

Edited out lines 12-16 of `spack.yaml`

```auto
# access3:
 # require:
 # - '@git.2025.03.0'
 # - configurations=MOM6-CICE6,MOM6-CICE6-WW3
 # - fflags="-O0 -g -check bounds -check pointers -fpe0 -check noarg_temp_created"

```

Lines 80 onwards now contains

```auto
  develop:
    access3:
      spec: access3@git.2025.03.0=2025.03.0

```

Concretise failed:

```auto
$ spack concretize --fresh -f
==> Error: concretization failed for the following reasons:

   1. access3: A configurations variant must be set, can be one or many of ('MOM6', 'CICE6', 'WW3', 'MOM6-WW3', 'MOM6-CICE6', 'CICE6-WW3', 'MOM6-CICE6-WW3')
   2. access3: A configurations variant must be set, can be one or many of ('MOM6', 'CICE6', 'WW3', 'MOM6-WW3', 'MOM6-CICE6', 'CICE6-WW3', 'MOM6-CICE6-WW3')
        required because conflict is triggered when configurations=none 
        required because conflict constraint 

```

So tried to add configuration at line 83 of `spack.yaml`

```auto
  develop:
    access3:
      spec: access3@git.2025.03.0=2025.03.0
       - configurations=MOM6-CICE6,MOM6-CICE6-WW3

```

But that didn’t solve it.

[Next page](https://forum.access-hive.org.au/t/setting-build-options-for-om3/4495.md?page=2)
