#1334 Fortran packaging guideline
Opened 3 months ago by lecris. Modified 3 months ago

Talking with some Fortran power-users, they have highlighted a few issues in the guidelines, which we want to discuss:
- Libraries are ABI incompatible, so along wtih %{_fmoddir} there should be an equivalent macro for the libraries
- Module files can easily have clashing names. Instead the upstream project should support the module files being in %{_fmoddir}/<ProjectName>/

Concerns:
- How do we link the libraries for non-cmake, non-pkg-config projects?


Please understand that you probably know more about fortran than the entire FPC combined.

Your best way forward is probably to open a PR for the changes you want to policy after speaking with other Fortran users (or even form a SIG?)

As to your question/concern ... we have no idea. Maybe if you explain the problem more we can help point you in the right direction, but again speaking to fortran users might be more helpful.

Metadata Update from @james:
- Issue tagged with: needinfo

3 months ago

Thanks I will try to update those guidelines and ping scitech_sig.

We would need to jointly discuss the library installation path though.

Basically the Fortran modules and libraries are ABI incompatible, so if the user installs flang-new and use it to link to a Fortran library (that is built with gfortran), the compilation will fail. For that reason the guideline suggests installing to %{_fmoddir} == /usr/lib64/gfortran/modules because these "headers" are compiler specific and should not be used outside of that compiler environment.

The issue is that the library are also ABI incompatible, so then it doesn't make sense to have only the Fortran modules in the compiler specific path, but not the libraries as well. So now the design question is, do we keep the libraries in the /usr/lib64 or do we move it to a compiler specific path? There are a few issues to discuss:
- Technically you would have the same issue in C++ with the name mangling of the symbols. Was there a similar discussion there?
- With Fortran you can make library functions have ISO_C_BINDING so it could be linked across compilers and languages. Fortran-to-fortran is still not guaranteed if it uses the module files as "headers"
- If the libraries are moved to library specific, how do we make it searchable and linked automatically like in /usr/lib64? This would be important if we have the libraries linked across languages
- The MPI guidelines use lmod and LD_LIBRARY_PATH, etc. to expose the appropriate library/headers. An equivalent design would be to use compiler specific modules, but I am not sure about this approach, because how would we make a default module always be loaded?

Login to comment on this ticket.

Metadata