Installation problem on Ubuntu 20.04: libgfortran.so.4: cannot open shared object file: No such file or directory

I tried to install FreeFem on Ubuntu 20.04, as recommended on Ubuntu installation.

Everything seems to be ok until I try to run my .edp script, when I get the error


FreeFem++: error while loading shared libraries: libgfortran.so.4: cannot open shared object file: No such file or directory

I found similar error messages on this forum, as well as other sources on the web, e.g. Ubuntu installation issue, and others.

Yet I am unable to solve it.
I have gfortran 11.3.0. It seems that gfortran 7 is needed, but I cannot even find a way to install it as it not on the Linux repositories.

I was hoping there would be some newer version of libgfortran.so.+, to link as in the solution I mentioned before, but I do not know how to find them.

If I issue the command, as suggested by another expert user non this forum


ls /usr/lib/libgfortran.so*


I get


ls: cannot access ‘/usr/lib/libgfortran.so*’: No such file or directory

Any suggestion please? I am really eager to get my scripts up and running again.
Thanks

This is not the recommended way to install FreeFEM. That one is: GitHub - FreeFem/FreeFem-sources: FreeFEM source code.

Thanks very much for this.
I did try the process you suggest, seemed to go through.
I got an error after autoreconf -i about some packages missing (unzip, bison), got this sorted, moved on, got some warnings during compilation of PETSc and other solvers, and a couple of failed steps at the make check step though).

Tried to run my .edp script with


FreeFem++ my_script.edp

and got the same error message as before

FreeFem++: error while loading shared libraries: libgfortran.so.4: cannot open shared object file: No such file or directory

This must be the previous installation done still being called. I searched about how to uninstall, and ended up with

rm -rf  /usr/local/share/freefem++ /usr/local/lib/ff++ 
rm -f /usr/local/bin/FreeFem++	/usr/local/bin/FreeFem++-nw /usr/local/bin/FreeFem++-mpi /usr/local/bin/FreeFem++-x11

Is this OK? How to uninstall it properly? Should have maybe done it before installing from source?

Now when I try

FreeFem++ my_script.edp

I get

Command ‘FreeFem++’ not found, but can be installed with:
sudo apt install freefem++

I wonder do I need to issue some

EXPORT PATH = <..>

command, , pointing to some FreeFeem++ executable?

Sorry I am really not that computer-literate, I apologise for the trivial issues.
I would have expected it to run anyhow, as I am issuing

FreeFem++ my_script.edp

from the FreeFem-sources directory, where my script is and presumably the FreeFem++ executable.

Thanks a lot for your support

You need to ensure that the binary is in your path indeed.

Made it, thanks . I still had an issue with not finding libhdf5.so.103, but creating a symbolic link to libhdf5_serial.so.103 (only _serial versions were in the installation) made it, it works a charm now, thank you very much