-
Notifications
You must be signed in to change notification settings - Fork 111
Closed
krystophny/fpm
#2Description
Bug Description
When using the openmp = "*"
dependency in fpm.toml, fpm applies OpenMP compiler flags (like -fopenmp
) to all source files, including C files. This causes compilation failures when the default C compiler is clang, which doesn't support -fopenmp
.
Reproduction Steps
- Create a project with both Fortran and C source files
- Add
openmp = "*"
to dependencies in fpm.toml - Run
fpm build
on macOS (where clang is the default C compiler)
Expected Behavior
OpenMP flags should only be applied to Fortran files when using OpenMP dependency, or there should be a way to specify different compilers for C and Fortran files.
Actual Behavior
Build fails with:
clang: error: unsupported option '-fopenmp'
Environment
- OS: macOS
- fpm version: latest
- Default C compiler: clang (doesn't support -fopenmp)
- Default Fortran compiler: gfortran (supports -fopenmp)
Proposed Solutions
- Only apply OpenMP flags to Fortran source files
- Allow separate compiler configuration for C files (e.g.,
[build.c]
section) - Provide environment variable to override C compiler (e.g.,
FPM_CC
)
This affects mixed-language projects that want to use OpenMP in Fortran while having simple C utility functions.
Metadata
Metadata
Assignees
Labels
No labels