Skip to content

fix: resolve MPI linker group issues and propagate library search paths#1250

Open
ijatinydv wants to merge 1 commit intofortran-lang:mainfrom
ijatinydv:fix/1226-link-flag-propagation
Open

fix: resolve MPI linker group issues and propagate library search paths#1250
ijatinydv wants to merge 1 commit intofortran-lang:mainfrom
ijatinydv:fix/1226-link-flag-propagation

Conversation

@ijatinydv
Copy link

This PR resolves the linking failures reported in #1226, specifically for projects using external C++ dependencies like libtorch.

Key Fixes:

  • MPI Grouping: Added the missing -Wl,--end-group in src/metapackage/fpm_meta_mpi.f90. Previously, the unclosed group caused the linker to incorrectly wrap subsequent libraries into the circular dependency search, leading to resolution errors.
  • Flag Propagation: Added logic in src/fpm_targets.f90to extract -L search paths from c-flags and cxx-flags. This ensures these paths are actually passed to the Fortran linker during the executable link step, which was previously missing.

Testing:

  • Added and verified a new internal helper extract_library_paths with various inputs (single/multiple paths, no paths, and trailing flags).
  • Ran fpm test and verified standard builds to ensure no regressions in core dependency handling.

Closes #1226

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.

Difficulty building FTorch examples with fpm

1 participant