[petsc-users] compilation of fortran program that uses petsc hangs
Ruyter de Wildt, Martijn de
M.d.Ruyterd-Wildt at marin.nl
Tue Jul 7 04:01:11 CDT 2026
Good morning,
When I try to compile a fortran program that uses petsc, the make command hangs and I can only stop it by killing the make process. I could not find any information about this problem and hope that you can shed some light on it.
I can reproduce the problem with one of the examples that is included in the PETSc installation. To do this, I used the following steps:
* export PETSC_DIR=[PETSC_INSTALL_DIR]
* export PETSC_ARCH=
* mkdir -p test_petsc/build
* cp [PETSC_INSTALL_DIR]/share/petsc/examples/src/sys/tutorials/ex16f.F90 test_petsc
* cp [PETSC_INSTALL_DIR]/share/petsc/CMakeLists.txt test_petsc
* in CMakeLists.txt, I replaced all ‘ex1’ with ’ex16f’ and all ‘.c’ with ‘F.90’.
* cd test_petsc/build
* cmake ..
* make VERBOSE=1
The last command hangs after showing “Scanning dependencies of target test”.
Environment:
* HPC with Rocky Linux 9.7
* PETSc version 3.25.3, compiled from source using cmake
* mpi implementation: Intel 2021.16
* compiler: fortran Intel 2025.2.0 ifx
* CMake version 3.31.6
Other remarks:
* the problem did not occur when we still used an older version of PETSc, version 3.22.4 (without any changes in environment and/or build process)
* I can build the c version of the same file, ex16.c, without any problems and delay
* the problem seems to occur only when a .h file that depends on petscys.h is included in the fortran file (so also petscmath.h, petscerror.h, petscviever.h, etc.)
* it seems that the process gets stuck in an endless loop while scanning dependencies
* the actual fortran preprocessor:
ifx -I[PETSC_INSTALL_DIR]/include -E ../ex16f.F90 > test.i
does not hang and completes immediately
* the problem does not occur for PETSC 3.22.4 but it does occur for versions 3.24.6 and later
* with cmake 3.26.5 and 3.29.1 the problem also occurs
Kind regards,
Martijn de Ruyter de Wildt
dr. Martijn de Ruyter de Wildt | senior software engineer
Research & Development | CFD Development
T +31 317 49 35 60 | M +31 639 27 86 06 | M.d.Ruyterd-Wildt at marin.nl | https://urldefense.us/v3/__http://www.marin.nl__;!!G_uCfscf7eWS!Y6BnHJQKe2DGuqnJjk_yE1OUk7XUP-Nmg8aBT0f4h7TGV2qF_Bkf3Sf6n3XP-EKNVytXBEMbq9UBedSMcYjI1ZJXwTJqyxzs0Q$
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20260707/7d570f1e/attachment-0001.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: image919862.png
Type: image/png
Size: 5004 bytes
Desc: image919862.png
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20260707/7d570f1e/attachment-0004.png>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: image584880.png
Type: image/png
Size: 487 bytes
Desc: image584880.png
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20260707/7d570f1e/attachment-0005.png>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: image383088.png
Type: image/png
Size: 504 bytes
Desc: image383088.png
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20260707/7d570f1e/attachment-0006.png>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: image837199.png
Type: image/png
Size: 482 bytes
Desc: image837199.png
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20260707/7d570f1e/attachment-0007.png>
More information about the petsc-users
mailing list