I've written a blog post about installing g77 on Ubuntu >=14.04. But the main details are:
Add the Ubuntu 8.04 repo's. Do this by editing the sources.list:
sudo -H gedit /etc/apt/sources.list
Then to the bottom of that file add:
deb http://old-releases.ubuntu.com/ubuntu/ hardy universe
deb-src http://old-releases.ubuntu.com/ubuntu/ hardy universe
deb http://old-releases.ubuntu.com/ubuntu/ hardy-updates universe
deb-src http://old-releases.ubuntu.com/ubuntu/ hardy-updates universe
Then run an update and install g77:
sudo apt-get update
sudo apt-get install g77
You might get lucky and g77 might work for you straight away. Likely you'll get an error message, something like:
/usr/bin/ld: cannot find -lgcc_s
collect2: ld returned 1 exit status
This means ld can't find a library (libgcc_s). Find the library yourself, check where ld is looking, and put a link there:
sudo find /usr/ -name libgcc_s.so
ld -lgcc_s --verbose
sudo ln -s /usr/lib/gcc/x86_64-linux-gnu/4.8/libgcc_s.so /usr/lib/x86_64-linux-gnu/
(you may have to modify the target and link in the link command depending on the return from the find and ld commands)
EDIT:
David Foerster suggests in the comments that mixing Ubuntu versions is a bad idea. So I should mention that after installing g77 I would then usually edit the /etc/apt/sources.list file again and comment out the 8.04 repos: i.e.
sudo -H gedit /etc/apt/sources.list
and then:
## deb http://old-releases.ubuntu.com/ubuntu/ hardy universe
## deb-src http://old-releases.ubuntu.com/ubuntu/ hardy universe
## deb http://old-releases.ubuntu.com/ubuntu/ hardy-updates universe
## deb-src http://old-releases.ubuntu.com/ubuntu/ hardy-updates universe
I've been installing, and running, g77 like this for the last 5 years or so without any difficulties.
gfortran
. How sure are you that it needs g77 "to work"? – steeldriver Oct 15 '16 at 21:37gfortran
, and post specific errors if you have them. – steeldriver Oct 15 '16 at 22:14