Skip to content

Conversation

@jreniel
Copy link
Member

@jreniel jreniel commented Dec 16, 2025

When compiling with make -jN, a transient race condition can occur where multiple utilities attempt to write .mod files to the shared include directory simultaneously:

f951: Fatal Error: Cannot rename module file '../../include/global.mod0' to '../../include/global.mod': No such file or directory

This happens because utilities like gen_source and interpolate_unstructured define their own module global, and without explicit build ordering, they can compile in parallel and conflict.

Fix: Add add_dependencies() to utility CMakeLists.txt files to ensure utillib is built first, serializing module file generation.

Changes:

  • Grid_Scripts: add dependency for interpolate_unstructured
  • Pre-Processing: add dependencies for targets using utillib modules
  • Particle_Tracking: add dependency for ptrack3
  • ArcGIS: fix incorrect schism_geometry link (should be utillib)

Add explicit add_dependencies() to utility CMakeLists.txt files to ensure
utillib is built before utilities that use its modules. This prevents
"Cannot rename module file" errors when building with make -jN.

Changes:
- Grid_Scripts: add dependency for interpolate_unstructured
- Pre-Processing: add dependencies for targets using utillib modules
- Particle_Tracking: add dependency for ptrack3
- ArcGIS: fix incorrect schism_geometry link to utillib
@jreniel jreniel requested a review from josephzhang8 December 16, 2025 21:02
Switch CMP0074 policy to NEW behavior to resolve deprecation warning.
The OLD behavior will be removed in a future CMake version. The NEW
behavior allows find_package() to properly use <PackageName>_ROOT
variables for finding packages.
@jreniel
Copy link
Member Author

jreniel commented Dec 17, 2025

Also added a fix for

CMake Deprecation Warning at CMakeLists.txt:9 (cmake_policy):              
  The OLD behavior for policy CMP0074 will be removed from a future version
  of CMake.                                                                
                                                                           
  The cmake-policies(7) manual explains that the OLD behaviors of all      
  policies are deprecated and that a policy should be set to OLD only under
  specific short-term circumstances.  Projects should be ported to the NEW 
  behavior and not rely on setting a policy to OLD.                        

@jreniel jreniel force-pushed the fix/cmake-race-condition branch from 1c02586 to 58f33b1 Compare December 17, 2025 17:38
@jreniel
Copy link
Member Author

jreniel commented Dec 17, 2025

Tested.

@josephzhang8
Copy link
Member

All: please review. These changes seem reasonable.

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.

2 participants