Skip to content

Fix NAG Fortran build on macOS for GEOSldas#541

Open
weiyuan-jiang wants to merge 2 commits intomainfrom
feature/wjiang/apple_nag_geosldas
Open

Fix NAG Fortran build on macOS for GEOSldas#541
weiyuan-jiang wants to merge 2 commits intomainfrom
feature/wjiang/apple_nag_geosldas

Conversation

@weiyuan-jiang
Copy link
Copy Markdown
Contributor

This commit enables successful compilation of GEOSldas with NAG Fortran compiler on macOS by addressing three critical issues:

  1. NAG_Fortran.cmake (line 9):

    • Add MPI_Gather, MPI_Scatter, MPI_Alltoallv to MISMATCH flag
    • Fixes MPI type mismatch errors where different data types are passed to the same MPI function in different call sites
  2. NAG_Fortran.cmake (lines 20-28):

    • Configure CMake to use -I flag for Fortran includes
    • Clear CMAKE_Fortran_IMPLICIT_LINK_FRAMEWORK_DIRECTORIES
    • Prevents CMake from adding -F framework flags that NAG doesn't support
    • Fixes Fortran include path generation issues
  3. NAG_Fortran.cmake (lines 32-41):

    • Add -w=uep flag to suppress unrecognized option errors on macOS
    • Handles any remaining framework-related warnings gracefully
  4. FindBaselibs.cmake (lines 99-108):

    • Replace find_library() calls with direct framework names
    • Changes: find_library(FWSecurity NAMES Security) to: set(FWSecurity "-framework Security")
    • Prevents CMake from adding framework directories to Fortran include paths, which causes compilation errors with NAG

Without these changes, NAG Fortran fails to compile GEOSldas on macOS due to:

  • Unrecognized -F framework flags in Fortran compiler invocations
  • Malformed include paths missing -I separators
  • MPI function type mismatch errors

Tested on: macOS with NAG Fortran 7.2.43, OpenMPI 5.0.10rc2, Baselibs 9.9.0
Build result: 100% successful, all executables built

This commit enables successful compilation of GEOSldas with NAG Fortran
compiler on macOS by addressing three critical issues:

1. NAG_Fortran.cmake (line 9):
   - Add MPI_Gather, MPI_Scatter, MPI_Alltoallv to MISMATCH flag
   - Fixes MPI type mismatch errors where different data types are passed
     to the same MPI function in different call sites

2. NAG_Fortran.cmake (lines 20-28):
   - Configure CMake to use -I flag for Fortran includes
   - Clear CMAKE_Fortran_IMPLICIT_LINK_FRAMEWORK_DIRECTORIES
   - Prevents CMake from adding -F framework flags that NAG doesn't support
   - Fixes Fortran include path generation issues

3. NAG_Fortran.cmake (lines 32-41):
   - Add -w=uep flag to suppress unrecognized option errors on macOS
   - Handles any remaining framework-related warnings gracefully

4. FindBaselibs.cmake (lines 99-108):
   - Replace find_library() calls with direct framework names
   - Changes: find_library(FWSecurity NAMES Security)
     to: set(FWSecurity "-framework Security")
   - Prevents CMake from adding framework directories to Fortran
     include paths, which causes compilation errors with NAG

Without these changes, NAG Fortran fails to compile GEOSldas on macOS due to:
- Unrecognized -F framework flags in Fortran compiler invocations
- Malformed include paths missing -I separators
- MPI function type mismatch errors

Tested on: macOS with NAG Fortran 7.2.43, OpenMPI 5.0.10rc2, Baselibs 9.9.0
Build result: 100% successful, all executables built
@weiyuan-jiang weiyuan-jiang requested a review from a team as a code owner May 7, 2026 12:07
@weiyuan-jiang weiyuan-jiang added the 0 diff The changes in this pull request have verified to be zero-diff with the target branch. label May 7, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

0 diff The changes in this pull request have verified to be zero-diff with the target branch.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant