dh_fortran_mod command not found

In this troubleshooting guide we learn how to fix dh_fortran_mod command not found error message

Introduction

When you run more command in linux terminal / console, you get the following error message

dh_fortran_mod: command not found

or when using sudo you get the following error message

sudo: dh_fortran_mod: command not found

Solutions to dh_fortran_mod: command not found

How To Fix dh_fortran_mod: command not found in Ubuntu / Debian / Kali Linux / Raspbian

In Ubuntu dh_fortran_mod is provided by dh-fortran-mod package.

dh-fortran-mod is:

Modules were introduced in the 1990 revision of the Fortran standard. When the Fortran compiler processes a source file containing a module, it produces both an object file and a ‘.mod’ file. The latter plays a role similar to header files in C, since it is needed when compiling other source files which make use of the module.

The ‘.mod’ files are however platform dependent, and their format changes with the gfortran version.

This package provides the dh_fortran_mod command, which simplifies the inclusion of ‘.mod’ files in binary packages. First, it places the ‘.mod’ files in the correct platform- and gfortran-dependent location. Second, it adds the right dependency information on gfortran version(s).

Inclusion of dh_fortran_mod in dh sequence is also provided under the name ‘fortran_mod’.

To fix this problem, we can install more using the command below.

sudo apt-get -y install dh-fortran-mod

This command might take some time to finish depending on your machine internet connection.

You can also use apt command to install dh-fortran-mod.

sudo apt -y install dh-fortran-mod

Or if you have aptitude installed you can use the following command.

sudo aptitude install dh-fortran-mod

Summary

In this tutorial we learn how to fix dh_fortran_mod command not found error in Ubuntu / Debian / Kali Linux or Raspbian distribution.