我正在使用 Ubuntu 16.04.2 LTS,想要安装gfortran
版本5.3。当我使用以下任一输入时gfortran
5.4已安装,但它与我尝试运行的程序不兼容。
sudo apt-get install gfortran
apt-get install csh gfortran
我正在尝试运行量子力学软件 GAMESS,据我所知,它需要针对每个编译器进行特定修改。当我尝试使用 gfortran 5.4 安装 GAMESS 时,我收到一条输出unrecognized version of gfortran
。我查看了代码,最新支持的版本是 5.3。
我如何安装旧gfortran
版本5.3?另外,像下面这样的操作是否可以删除版本 5.4 以避免冲突?谢谢!
sudo apt-get remove --auto-remove gfortran
需要澄清的是,我不确定为什么 gamess 不接受 5.3 之后的版本,但我遇到了太多错误,无法完成 5.4 版本的安装。此外,当我输入时,apt-cache policy gfortran
我得到以下输出:
gfortran:
Installed: 4:5.3.1-1ubuntu1
Candidate: 4:5.3.1-1ubuntu1
Version table:
*** 4:5.3.1-1ubuntu1 500
500 http://us.archive.ubuntu.com/ubuntu xenial/main amd64 Packages
100 /var/lib/dpkg/status
答案1
Ubuntu 16.04 LTS
-std
您可以尝试使用手册中描述的选项,
man gfortan
-std=std
Specify the standard to which the program is expected to conform,
which may be one of f95, f2003, f2008, gnu, or legacy. The default
value for std is gnu, which specifies a superset of the Fortran 95
standard that includes all of the extensions supported by GNU
Fortran, although warnings will be given for obsolete extensions
not recommended for use in new code. The legacy value is
equivalent but without the warnings for obsolete extensions, and
may be useful for old non-standard programs. The f95, f2003 and
f2008 values specify strict conformance to the Fortran 95, Fortran
2003 and Fortran 2008 standards, respectively; errors are given for
all extensions beyond the relevant language standard, and warnings
are given for the Fortran 77 features that are permitted but
obsolescent in later standards. -std=f2008ts allows the Fortran
2008 standard including the additions of the Technical
Specification (TS) 29113 on Further Interoperability of Fortran
with C and TS 18508 on Additional Parallel Features in Fortran.
Ubuntu 14.04 LTS
Ubuntu 14.04.1 LTS 已支持 5 年,直到 2019 年 4 月。我在从 iso 文件创建的持久实时系统中进行了测试ubuntu-14.04.1-desktop-amd64.iso
和韓國。
当我将 gfortran 安装到此系统时,它是版本4.8.4
GNU Fortran (Ubuntu 4.8.4-2ubuntu1~14.04.3) 4.8.4
以下命令行对话框说明了我所拥有的和我所做的。如果您对 Ubuntu 16.04 LTS 不满意,您可以尝试使用 Ubuntu 14.04 LTS。也许它更适合您想要编译的软件。
ubuntu@ubuntu:~$ sudo lsblk -fm
NAME FSTYPE LABEL MOUNTPOINT NAME SIZE OWNER GROUP MODE
sda sda 29.1G root disk brw-rw----
├─sda1 ntfs usbdata /media/ubuntu/usbdata ├─sda1 7G root disk brw-rw----
├─sda2 ├─sda2 1K root disk brw-rw----
├─sda3 vfat usbboot /media/ubuntu/usbboot ├─sda3 244M root disk brw-rw----
├─sda4 iso9660 Ubuntu 14.04.1 LTS amd64 /cdrom ├─sda4 999.5M root disk brw-rw----
└─sda5 ext4 casper-rw └─sda5 20.9G root disk brw-rw----
sr0 sr0 1024M root cdrom brw-rw----
loop0 squashfs /rofs loop0 938.7M root disk brw-rw----
ubuntu@ubuntu:~$ df -h
Filesystem Size Used Avail Use% Mounted on
/cow 21G 71M 20G 1% /
udev 1.9G 4.0K 1.9G 1% /dev
tmpfs 384M 1.2M 383M 1% /run
/dev/sda4 981M 981M 0 100% /cdrom
/dev/loop0 939M 939M 0 100% /rofs
none 4.0K 0 4.0K 0% /sys/fs/cgroup
tmpfs 1.9G 4.0K 1.9G 1% /tmp
none 5.0M 0 5.0M 0% /run/lock
none 1.9G 76K 1.9G 1% /run/shm
none 100M 56K 100M 1% /run/user
/dev/sda5 21G 71M 20G 1% /media/ubuntu/casper-rw
/dev/sda3 241M 46M 196M 19% /media/ubuntu/usbboot
/dev/sda1 7.0G 37M 7.0G 1% /media/ubuntu/usbdata
ubuntu@ubuntu:~$ sudo apt-get update
Ign cdrom://Ubuntu 14.04.1 LTS _Trusty Tahr_ - Release amd64 (20140722.2) trusty InRelease
Ign cdrom://Ubuntu 14.04.1 LTS _Trusty Tahr_ - Release amd64 (20140722.2) trusty/main Translation-en_US
Ign cdrom://Ubuntu 14.04.1 LTS _Trusty Tahr_ - Release amd64 (20140722.2) trusty/main Translation-en
Ign cdrom://Ubuntu 14.04.1 LTS _Trusty Tahr_ - Release amd64 (20140722.2) trusty/restricted Translation-en_US
Ign cdrom://Ubuntu 14.04.1 LTS _Trusty Tahr_ - Release amd64 (20140722.2) trusty/restricted Translation-en
Get:1 http://security.ubuntu.com trusty-security InRelease [65.9 kB]
Ign http://archive.ubuntu.com trusty InRelease
Get:2 http://archive.ubuntu.com trusty-updates InRelease [65.9 kB]
Get:3 http://security.ubuntu.com trusty-security/main amd64 Packages [643 kB]
Hit http://archive.ubuntu.com trusty Release.gpg
Get:4 http://archive.ubuntu.com trusty-updates/main amd64 Packages [999 kB]
Get:5 http://security.ubuntu.com trusty-security/restricted amd64 Packages [14.0 kB]
Get:6 http://security.ubuntu.com trusty-security/main Translation-en [345 kB]
Get:7 http://security.ubuntu.com trusty-security/restricted Translation-en [3,491 B]
Get:8 http://archive.ubuntu.com trusty-updates/restricted amd64 Packages [17.1 kB]
Get:9 http://archive.ubuntu.com trusty-updates/main Translation-en [491 kB]
Get:10 http://archive.ubuntu.com trusty-updates/restricted Translation-en [3,978 B]
Hit http://archive.ubuntu.com trusty Release
Hit http://archive.ubuntu.com trusty/main amd64 Packages
Hit http://archive.ubuntu.com trusty/restricted amd64 Packages
Hit http://archive.ubuntu.com trusty/main Translation-en
Hit http://archive.ubuntu.com trusty/restricted Translation-en
Ign http://archive.ubuntu.com trusty/main Translation-en_US
Ign http://archive.ubuntu.com trusty/restricted Translation-en_US
Fetched 2,648 kB in 2s (1,235 kB/s)
Reading package lists... Done
ubuntu@ubuntu:~$ sudo apt-get install gfortran
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following extra packages will be installed:
cpp-4.8 gcc-4.8 gcc-4.8-base gfortran-4.8 libasan0 libatomic1 libgcc-4.8-dev
libgfortran-4.8-dev libgfortran3 libgomp1 libitm1 libquadmath0 libstdc++6
libtsan0
Suggested packages:
gcc-4.8-locales gcc-4.8-multilib gcc-4.8-doc libgcc1-dbg libgomp1-dbg
libitm1-dbg libatomic1-dbg libasan0-dbg libtsan0-dbg libquadmath0-dbg
gfortran-multilib gfortran-doc gfortran-4.8-multilib gfortran-4.8-doc
libgfortran3-dbg
The following NEW packages will be installed:
gfortran gfortran-4.8 libgfortran-4.8-dev libgfortran3
The following packages will be upgraded:
cpp-4.8 gcc-4.8 gcc-4.8-base libasan0 libatomic1 libgcc-4.8-dev libgomp1
libitm1 libquadmath0 libstdc++6 libtsan0
11 upgraded, 4 newly installed, 0 to remove and 687 not upgraded.
Need to get 17.4 MB of archives.
After this operation, 19.3 MB of additional disk space will be used.
Do you want to continue? [Y/n] y
Get:1 http://archive.ubuntu.com/ubuntu/ trusty/main gfortran amd64 4:4.8.2-1ubuntu6 [1,252 B]
Get:2 http://security.ubuntu.com/ubuntu/ trusty-security/main libtsan0 amd64 4.8.4-2ubuntu1~14.04.3 [94.9 kB]
Get:3 http://security.ubuntu.com/ubuntu/ trusty-security/main libquadmath0 amd64 4.8.4-2ubuntu1~14.04.3 [126 kB]
Get:4 http://security.ubuntu.com/ubuntu/ trusty-security/main libitm1 amd64 4.8.4-2ubuntu1~14.04.3 [28.5 kB]
Get:5 http://security.ubuntu.com/ubuntu/ trusty-security/main libgomp1 amd64 4.8.4-2ubuntu1~14.04.3 [23.1 kB]
Get:6 http://security.ubuntu.com/ubuntu/ trusty-security/main libatomic1 amd64 4.8.4-2ubuntu1~14.04.3 [8,636 B]
Get:7 http://security.ubuntu.com/ubuntu/ trusty-security/main libasan0 amd64 4.8.4-2ubuntu1~14.04.3 [63.1 kB]
Get:8 http://security.ubuntu.com/ubuntu/ trusty-security/main gcc-4.8 amd64 4.8.4-2ubuntu1~14.04.3 [5,047 kB]
Get:9 http://security.ubuntu.com/ubuntu/ trusty-security/main cpp-4.8 amd64 4.8.4-2ubuntu1~14.04.3 [4,595 kB]
Get:10 http://security.ubuntu.com/ubuntu/ trusty-security/main libgcc-4.8-dev amd64 4.8.4-2ubuntu1~14.04.3 [1,688 kB]
Get:11 http://security.ubuntu.com/ubuntu/ trusty-security/main gcc-4.8-base amd64 4.8.4-2ubuntu1~14.04.3 [16.2 kB]
Get:12 http://security.ubuntu.com/ubuntu/ trusty-security/main libstdc++6 amd64 4.8.4-2ubuntu1~14.04.3 [259 kB]
Get:13 http://security.ubuntu.com/ubuntu/ trusty-security/main libgfortran3 amd64 4.8.4-2ubuntu1~14.04.3 [248 kB]
Get:14 http://security.ubuntu.com/ubuntu/ trusty-security/main libgfortran-4.8-dev amd64 4.8.4-2ubuntu1~14.04.3 [269 kB]
Get:15 http://security.ubuntu.com/ubuntu/ trusty-security/main gfortran-4.8 amd64 4.8.4-2ubuntu1~14.04.3 [4,883 kB]
Fetched 17.4 MB in 23s (724 kB/s)
(Reading database ... 169556 files and directories currently installed.)
Preparing to unpack .../libtsan0_4.8.4-2ubuntu1~14.04.3_amd64.deb ...
Unpacking libtsan0:amd64 (4.8.4-2ubuntu1~14.04.3) over (4.8.2-19ubuntu1) ...
Preparing to unpack .../libquadmath0_4.8.4-2ubuntu1~14.04.3_amd64.deb ...
Unpacking libquadmath0:amd64 (4.8.4-2ubuntu1~14.04.3) over (4.8.2-19ubuntu1) ...
Preparing to unpack .../libitm1_4.8.4-2ubuntu1~14.04.3_amd64.deb ...
Unpacking libitm1:amd64 (4.8.4-2ubuntu1~14.04.3) over (4.8.2-19ubuntu1) ...
Preparing to unpack .../libgomp1_4.8.4-2ubuntu1~14.04.3_amd64.deb ...
Unpacking libgomp1:amd64 (4.8.4-2ubuntu1~14.04.3) over (4.8.2-19ubuntu1) ...
Preparing to unpack .../libatomic1_4.8.4-2ubuntu1~14.04.3_amd64.deb ...
Unpacking libatomic1:amd64 (4.8.4-2ubuntu1~14.04.3) over (4.8.2-19ubuntu1) ...
Preparing to unpack .../libasan0_4.8.4-2ubuntu1~14.04.3_amd64.deb ...
Unpacking libasan0:amd64 (4.8.4-2ubuntu1~14.04.3) over (4.8.2-19ubuntu1) ...
Preparing to unpack .../gcc-4.8_4.8.4-2ubuntu1~14.04.3_amd64.deb ...
Unpacking gcc-4.8 (4.8.4-2ubuntu1~14.04.3) over (4.8.2-19ubuntu1) ...
Preparing to unpack .../cpp-4.8_4.8.4-2ubuntu1~14.04.3_amd64.deb ...
Unpacking cpp-4.8 (4.8.4-2ubuntu1~14.04.3) over (4.8.2-19ubuntu1) ...
Preparing to unpack .../libgcc-4.8-dev_4.8.4-2ubuntu1~14.04.3_amd64.deb ...
Unpacking libgcc-4.8-dev:amd64 (4.8.4-2ubuntu1~14.04.3) over (4.8.2-19ubuntu1) ...
Preparing to unpack .../gcc-4.8-base_4.8.4-2ubuntu1~14.04.3_amd64.deb ...
Unpacking gcc-4.8-base:amd64 (4.8.4-2ubuntu1~14.04.3) over (4.8.2-19ubuntu1) ...
Processing triggers for man-db (2.6.7.1-1) ...
Setting up gcc-4.8-base:amd64 (4.8.4-2ubuntu1~14.04.3) ...
(Reading database ... 169556 files and directories currently installed.)
Preparing to unpack .../libstdc++6_4.8.4-2ubuntu1~14.04.3_amd64.deb ...
Unpacking libstdc++6:amd64 (4.8.4-2ubuntu1~14.04.3) over (4.8.2-19ubuntu1) ...
Setting up libstdc++6:amd64 (4.8.4-2ubuntu1~14.04.3) ...
Processing triggers for libc-bin (2.19-0ubuntu6) ...
Selecting previously unselected package libgfortran3:amd64.
(Reading database ... 169568 files and directories currently installed.)
Preparing to unpack .../libgfortran3_4.8.4-2ubuntu1~14.04.3_amd64.deb ...
Unpacking libgfortran3:amd64 (4.8.4-2ubuntu1~14.04.3) ...
Selecting previously unselected package libgfortran-4.8-dev:amd64.
Preparing to unpack .../libgfortran-4.8-dev_4.8.4-2ubuntu1~14.04.3_amd64.deb ...
Unpacking libgfortran-4.8-dev:amd64 (4.8.4-2ubuntu1~14.04.3) ...
Selecting previously unselected package gfortran-4.8.
Preparing to unpack .../gfortran-4.8_4.8.4-2ubuntu1~14.04.3_amd64.deb ...
Unpacking gfortran-4.8 (4.8.4-2ubuntu1~14.04.3) ...
Selecting previously unselected package gfortran.
Preparing to unpack .../gfortran_4%3a4.8.2-1ubuntu6_amd64.deb ...
Unpacking gfortran (4:4.8.2-1ubuntu6) ...
Processing triggers for man-db (2.6.7.1-1) ...
Setting up libtsan0:amd64 (4.8.4-2ubuntu1~14.04.3) ...
Setting up libquadmath0:amd64 (4.8.4-2ubuntu1~14.04.3) ...
Setting up libitm1:amd64 (4.8.4-2ubuntu1~14.04.3) ...
Setting up libgomp1:amd64 (4.8.4-2ubuntu1~14.04.3) ...
Setting up libatomic1:amd64 (4.8.4-2ubuntu1~14.04.3) ...
Setting up libasan0:amd64 (4.8.4-2ubuntu1~14.04.3) ...
Setting up cpp-4.8 (4.8.4-2ubuntu1~14.04.3) ...
Setting up libgcc-4.8-dev:amd64 (4.8.4-2ubuntu1~14.04.3) ...
Setting up gcc-4.8 (4.8.4-2ubuntu1~14.04.3) ...
Setting up libgfortran3:amd64 (4.8.4-2ubuntu1~14.04.3) ...
Setting up libgfortran-4.8-dev:amd64 (4.8.4-2ubuntu1~14.04.3) ...
Setting up gfortran-4.8 (4.8.4-2ubuntu1~14.04.3) ...
Setting up gfortran (4:4.8.2-1ubuntu6) ...
update-alternatives: using /usr/bin/gfortran to provide /usr/bin/f95 (f95) in auto mode
Processing triggers for libc-bin (2.19-0ubuntu6) ...
ubuntu@ubuntu:~$ gfortran --version
GNU Fortran (Ubuntu 4.8.4-2ubuntu1~14.04.3) 4.8.4
Copyright (C) 2013 Free Software Foundation, Inc.
GNU Fortran comes with NO WARRANTY, to the extent permitted by law.
You may redistribute copies of GNU Fortran
under the terms of the GNU General Public License.
For more information about these matters, see the file named COPYING
ubuntu@ubuntu:~$ gfortran -dumpversion
4.8
ubuntu@ubuntu:~$ lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description: Ubuntu 14.04.1 LTS
Release: 14.04
Codename: trusty
ubuntu@ubuntu:~$ uname -a
Linux ubuntu 3.13.0-32-generic #57-Ubuntu SMP Tue Jul 15 03:51:08 UTC 2014 x86_64 x86_64 x86_64 GNU/Linux
ubuntu@ubuntu:~$
请注意,我还没有测试更新和升级已安装的 14.04 LTS 系统后会发生什么。