Multiple Fortran support in Debian/Ubuntu

Ok, I got it now… the mighty multiarch. I do remember now that Debian had multiarch supported even back when I was a Debian user - but I never used multiarch myself. In the distributions I am involved now, the general principle is “it’s there, not enabled by default, not recommended”. So I’m afraid I can’t help much about it. For 32-bit Fortran libs (or any 32-bit libs for that matter,) I just rebuild packages natively, in the 32-bit version of the distribution. Even if multiarch was encouraged, I would do the same, to be honest.

I had a closer look in .mod files. In my systems, most of them are in INCDIR, with the notable exception of gfortran itself (of course.) Its .mod files are in LIBDIR/gcc/.../finclude/. Presumably they thought “they are binary files, so LIBDIR it is” (I disagree, and I am not the only one.) But even then, they distinguished them from normal lib files, so they placed them in a separate subdirectory called finclude. That alone should tell you we are talking about header files here, just in binary form.

Another exception is plplot. Its .mod files are in LIBDIR/fortran/modules/plplot/. I weird choice indeed. In fact this is just a plplot convention, there is nothing else in LIBDIR/fortran/ except their stuff.
The rest of the .mod files are either not related to Fortran at all, or just placed in INCDIR.

Essentially, gfortran .mod files are gzipped plain files. If you decompress them (you might need to change the suffix to .gz first,) you will get a plain text file. And if you have a closer look at it, you will see it’s basically a header file, just not in the format you are probably familiar from C header files. The problem is that’s not standardised. How exactly a .mod file is formatted and saved depends on the compiler. For instance, LFortran does creates .mod files totally different than gfortran’s. But the principle is the same: the equivalent of header files.

It would be nice if packagers finally agree to place Fortran .mod files in their proper place, or at least one place, whatever that would be. Their obvious home should clearly be INCDIR, if you ask me.

1 Like