fpm icon indicating copy to clipboard operation
fpm copied to clipboard

Incremental rebuild failure

Open awvwgk opened this issue 4 years ago • 3 comments

Working on a bigger project with fpm (~130 source files in 6 projects currently), I run frequently into issue with the incremental rebuild (once or twice a day), which forces me to delete the build/gfortran_* directories to start from scratch. Given the size of the project and its highly experimental stage it is hard to create a minimal reproducer right now.

The issue manifest in a compile time error due to type mismatch when adding a new component to a derived type or a runtime error / segmentation fault due to interface mismatches when changing dummy argument. The state is pretty much permanent once reached and selectively modifying files in the dependency tree does not trigger the complete rebuild as expected.

I'll try to create a minimal reproducer on the next occasion I run into this, but no promises.

awvwgk avatar Apr 26 '21 17:04 awvwgk

... selectively modifying files in the dependency tree does not trigger the complete rebuild as expected.

Based on this statement I would hazard a guess that a module dependency is not being detected properly.

It may perhaps be easier to pinpoint the bug if you focus on which files, when changed, do not trigger a rebuild as expected.

EDIT: It might be worth checking for a known limitation when detecting module use statements where there is a continuation before the module name:

https://github.com/fortran-lang/fpm/blob/a9adf2b3ed09d0769f1095ddf7c2c06f71f10161/src/fpm_source_parsing.f90#L67-L72

It seems this case fails silently which is not ideal - I'll take a look.

LKedward avatar Apr 26 '21 18:04 LKedward

No continuation characters and no preprocessor used for module names here.

awvwgk avatar Apr 26 '21 18:04 awvwgk

It's not really a minimal reproducer but I think I've been running into the same issue in this small project here: https://github.com/AshyIsMe/flox

I'm not sure if it's the *.mod files that sometimes fail to rebuild even though the source files have changed or if it's something else.

My quick hack workaround is this make clean rule defined here: https://github.com/AshyIsMe/flox/blob/main/Makefile

AshyIsMe avatar Sep 05 '21 05:09 AshyIsMe