How to resolve 'error while loading shared libraries: libgfortran.so.4
Asked Answered
S

0

1

I was getting this error:

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

To resolve this, I searched "libgfortran.so.4" on google and I come to this site " How to install libgfortran.so.4 on ubuntu 16.06 "

So as given in this site tried to run the commands on terminal: Command 1:

  sudo add-apt-repository ppa:jonathonf/gcc-7.1
ERROR: ppa 'jonathonf/gcc-7.1' not found (use --login if private)

Command 2:

sudo apt-get install gcc-7 g++-7
E: Package 'gcc-7' has no installation candidate
E: Package 'g++-7' has no installation candidate

Command 3:

 sudo apt-get install gfortran-7
E: Unable to locate package gfortran-7

Please help me to resolve this issue so that I can get rid of the error.

Sanctus answered 2/6, 2023 at 9:34 Comment(6)
What command gives you the error? The repository you are trying is old and probably does not work any more. You can always compile any GCC version from source. It is not that difficult but some little experience with compilation is necessary. But first tell us what you are doing when you get the error and which Ubuntu version you have.Luben
Why do you want gcc-7 in particular? Why can't you just use whatever is provided by default?Bishopric
@IanBush Madhu needs the particular libgfortran version for some software that was compiled against it. But should really say which exact software in which version. Anyway, compiling GCC from source really isn't that hard, many smaller things are much worse.Luben
Actually i am trying to run the spectral energy distribution (SED) code to get SEDs of the astronomical sources.? Same problem happened with my PC so using above site instruction it got resolved but as same problem arise with my laptop but not getting solved with this site instructions or other things. Please guide me in this regard.Sanctus
As I wrote, you can compile GCC from source. Or recompile your software with a modrrn compiler. Don't forget to add the details I requested before.Luben
You didn't say what distro and version you are running,my understanding is that you just need to install libgfortran4. For Ubuntu 20 instructions here.Lattie

© 2022 - 2024 — McMap. All rights reserved.