How to install libgfortran.so.3 on ubuntu 20.04
Asked Answered
R

3

8

When I try to install libgfortran.so.3 on Ubuntu 20.04 using:

sudo apt-get install libgfortran3  

it shows:

E: Unable to locate package libgfortran3

How can I install Fortran on 20.04?

Rigger answered 15/7, 2020 at 6:40 Comment(1)
@FantasticMrFox It does not really make sense to mark every other word as code. See meta.#298864Finical
F
11

The problem here is that 20.04 doesn't support g++-6. To get around this you need a multi-step process:

  1. Put a temporary repository into /etc/apt/sources.list. For me that was deb http://gb.archive.ubuntu.com/ubuntu/ bionic main universe

  2. Now you can install gcc version 6 sudo apt-get install g++-6

  3. Make that the default version sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-6 6

  4. Now install gfortran sudo apt-get install libgfortran3

  5. Make sure it works strings /usr/lib/x86_64-linux-gnu/libgfortran.so.3.0.0 | grep GFORTRAN*

Fervency answered 29/1, 2021 at 14:29 Comment(3)
Thanks a lot for your input. Nevertheless I have the impression you could add also apt-get update somewhere between step 1 and 2. This will help a lot of new comers :-)Caveman
Thanks Edmund, it helped me a lot, and I just find step 3 is not necessary. :)Exclamatory
Getting error at step 2: sudo apt-get install g++-6 Package g++-6 is not available, but is referred to by another package. This may mean that the package is missing, has been obsoleted, or is only available from another source E: Package 'g++-6' has no installation candidateThreaten
P
1

To install libgfortran libraries in Ubuntu 20.04:

  1. First install gcc version 6
  2. Then install libgfrotran3

Use this link to download the files. Click here

Pyrenees answered 30/6, 2022 at 18:14 Comment(0)
B
0

libgfortran3 is not supported any more in Ubuntu 20.04 as it depends on an older version of gcc, which is no longer maintained in this version of the distribution. You can install a later version of libgfortran using:

sudo apt-get install libgfortran5
Byrdie answered 6/8, 2020 at 12:2 Comment(3)
I fear it may not satisfy the dependencies of the OP's software. Major versions of libgfortran are not backwards compatible. We had several similar questions before, like #44659367 In general, it is possible to have severalversions of GCC in one computer and it is possible to install an old GCC by compiling from source or by getting a binary somewhere.Finical
@VladimirF I am having a similar problem. My program needs libgfortran3 but after trying everything I can not find a way to install it. Can you tell me how to install gcc6 in ubuntu 20.04? Many thanks!Morion
@JoanaCarvalho Just download the source code and compile it. Follow the documentation gcc.gnu.org/wiki/InstallingGCC and gcc.gnu.org/install/index.html If you have any specific problems, open a question on this site.Finical

© 2022 - 2024 — McMap. All rights reserved.