在 Ubuntu 20.04 上安装旧版本的 Gfortran

在 Ubuntu 20.04 上安装旧版本的 Gfortran

如何在 Ubuntu 20.04 上安装 Gfortran 4.5?

答案1

这个 Fortran 版本可用在 Ubuntu 11.04 中。
我建议创建施鲁特使用 11.04 并在此处安装旧的 fortran:

sudo apt-get install schroot debootstrap -y

cat <<EOF | sudo tee /etc/schroot/chroot.d/natty.conf
[natty]
description=Ubuntu 11.04
directory=/srv/chroot/natty
root-users=$USER
type=directory
users=$USER
EOF

sudo mkdir -p /srv/chroot/natty
sudo debootstrap --no-check-gpg natty /srv/chroot/natty

cat <<EOF | sudo tee /srv/chroot/natty/etc/apt/sources.list
deb http://old-releases.ubuntu.com/ubuntu natty main restricted universe multiverse
deb http://old-releases.ubuntu.com/ubuntu natty-updates main restricted universe multiverse
EOF

schroot -c natty -u root apt-get update
schroot -c natty -u root apt-get install gcc gfortran

然后使用以下命令在 schroot 中执行你的程序:

schroot -c natty /home/user/old-program

或者通过以下方式编译

cd /home/user/source-code
schroot -c natty make

相关内容