Repository navigation
build: add warning guard for MinGw and MS-MPI on windows - #2998
nandininmmahesh-dotcom wants to merge 1 commit into
Conversation
|
Nice to have a heads-up for this combination. One question on the condition: Minor: the inserted |
5f6d8d1 to
df3e737
Compare
Meson's dependency('mpi') incorrectly passes full library path to -l flag
(e.g., -lC:/Program Files.../msmpi), which Mingw's linker rejects.
Fix: On Windows+MinGW with MPI enabled/auto, declare_dependency with explicit
-L<libdir> -lmsmpi flags, using standard MS-MPI install paths. Also check
for libmsmpi.a import library and warn with creation instructions if missing.
Use get_option('with-mpi').allowed() to cover both 'enabled' and 'auto'
(default), since Meson auto-detects MS-MPI on Windows in 'auto' mode.
Fixes su2code#1468
6840344 to
048728c
Compare
Thanks for the review! Both points addressed in the latest commit (048728c):
The fix goes beyond a warning: it constructs a proper declare_dependency() with separate -L -lmsmpi flags so the build actually succeeds. Also checks for libmsmpi.a and prints creation instructions if missing. |
Title: build: fix MinGW MS-MPI linking on Windows (fixes #1468)
Body:
Problem
On Windows with MinGW GCC, building SU2 with MS-MPI fails at link time with:
ld.exe: cannot find -lC:\Program Files (x86)\Microsoft SDKs\MPI\Lib\x64\msmpi
Meson's dependency('mpi') detection incorrectly constructs the linker flag as -l<full_path> instead of separate -L
-l flags.Solution
When detecting host_machine.system() == 'windows' + compiler == 'gcc' + with-mpi allowed (enabled or auto), create a proper declare_dependency() with:
Also checks for libmsmpi.a import library and provides clear instructions to create it if missing:
cmd
gendef msmpi.dll
dlltool -d msmpi.def -l libmsmpi.a
Testing
Verified meson configuration succeeds on Linux (falls through to standard MPI detection)
Windows users can now build with:
bash
python meson.py build -Denable-autodiff=true -Denable-directdiff=true -Denable-pywrapper=true -Dwith-mpi=enabled
(also works with default -Dwith-mpi=auto)
Fixes #1468
Checklist: