I’m trying to compile a (very) simple Fortran program that uses the HDF5 library:
program test
use hdf5
end program test
If I try to compile this program with gfortran inside a nix-shell, I get the following error:
% nix-shell -p hdf5-fortran gfortran
% gfortran test_hdf5.f90
test_hdf5.f90:3:6:
3 | use hdf5
| 1
Fatal Error: Cannot open module file ‘hdf5.mod’ for reading at (1): No such file or directory
compilation terminated.
Looking at the hdf5-gfortran derivation, I see that it does contain the module in question:
I think you’re going to have to create some sort of an environment with a shell.nix and write a Makefile that uses that environment to call gfortran with the -I arguments
Thanks for the suggestion. I can patch the Makefile to include that directory, but I’m surprised that the gfortran wrapper does not do it automatically?