Update gfortran library
There is some confusion with different versions of packages here, I suggest you remove all of those packages with
sudo apt remove gcc gcc-7 g++ g++-7 gfortran gfortran-7
first and then do a clean install of just the (-7
) packages you want. This way the system should get configured correctly. If you encounter problems, follow the instructions in this related answer.
Related videos on Youtube
tehfurbolg
Updated on September 18, 2022Comments
-
tehfurbolg over 1 year
I am confused by the versions I have on my machine. I am running Ubuntu 16.04.
The output of
gcc --version
andg++ --version
tells me that I have 7.2.0 installed. Great!When I do
gfortran --version
however, it tells me that I have 5.4.1 installed. When I updated (sudo apt-get install gfortran-7
), it correctly updated and now tells me that I already have the newest version. And when I dogfortran-7 --version
it correctly identifies the version. How can I tell the system that there is a newer version of gfortran "available" on my system? How do I overwrite this?edit: I already followed Cannot find -lgfortran but the symbolic link is already existant on my drive, so I tried updating and got to the above problem.
edit2: Additionally I just found out with
gfortran -v
that this gfortran still thinks gcc is at version 5.4.1 as well. :Sedit3: The output of
apt-cache policy gcc gfortran
is:gcc: Installed: 4:5.3.1-1ubuntu1 Candidate: 4:5.3.1-1ubuntu1 Version table: *** 4:5.3.1-1ubuntu1 500 500 http://de.archive.ubuntu.com/ubuntu xenial/main amd64 Packages 100 /var/lib/dpkg/status gfortran: Installed: 4:5.3.1-1ubuntu1 Candidate: 4:5.3.1-1ubuntu1 Version table: *** 4:5.3.1-1ubuntu1 500 500 http://de.archive.ubuntu.com/ubuntu xenial/main amd64 Packages 100 /var/lib/dpkg/status
The output of
gcc -v
isUsing built-in specs. COLLECT_GCC=gcc COLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-linux-gnu/7/lto-wrapper OFFLOAD_TARGET_NAMES=nvptx-none OFFLOAD_TARGET_DEFAULT=1 Target: x86_64-linux-gnu Configured with: ../src/configure -v --with-pkgversion='Ubuntu 7.2.0-1ubuntu1~16.04' --with-bugurl=file:///usr/share/doc/gcc-7/README.Bugs --enable-languages=c,ada,c++,go,brig,d,fortran,objc,obj-c++ --prefix=/usr --with-gcc-major-version-only --program-suffix=-7 --program-prefix=x86_64-linux-gnu- --enable-shared --enable-linker-build-id --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --libdir=/usr/lib --enable-nls --with-sysroot=/ --enable-clocale=gnu --enable-libstdcxx-debug --enable-libstdcxx-time=yes --with-default-libstdcxx-abi=new --enable-gnu-unique-object --disable-vtable-verify --enable-libmpx --enable-plugin --with-system-zlib --with-target-system-zlib --enable-objc-gc=auto --enable-multiarch --disable-werror --with-arch-32=i686 --with-abi=m64 --with-multilib-list=m32,m64,mx32 --enable-multilib --with-tune=generic --enable-offload-targets=nvptx-none --without-cuda-driver --enable-checking=release --build=x86_64-linux-gnu --host=x86_64-linux-gnu --target=x86_64-linux-gnu Thread model: posix gcc version 7.2.0 (Ubuntu 7.2.0-1ubuntu1~16.04)
The output of
gfortran -v
isUsing built-in specs. COLLECT_GCC=gfortran COLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-linux-gnu/5/lto-wrapper Target: x86_64-linux-gnu Configured with: ../src/configure -v --with-pkgversion='Ubuntu 5.4.1-2ubuntu1~16.04' --with-bugurl=file:///usr/share/doc/gcc-5/README.Bugs --enable-languages=c,ada,c++,java,go,d,fortran,objc,obj-c++ --prefix=/usr --program-suffix=-5 --enable-shared --enable-linker-build-id --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --libdir=/usr/lib --enable-nls --with-sysroot=/ --enable-clocale=gnu --enable-libstdcxx-debug --enable-libstdcxx-time=yes --with-default-libstdcxx-abi=new --enable-gnu-unique-object --disable-vtable-verify --enable-libmpx --enable-plugin --with-system-zlib --disable-browser-plugin --enable-java-awt=gtk --enable-gtk-cairo --with-java-home=/usr/lib/jvm/java-1.5.0-gcj-5-amd64/jre --enable-java-home --with-jvm-root-dir=/usr/lib/jvm/java-1.5.0-gcj-5-amd64 --with-jvm-jar-dir=/usr/lib/jvm-exports/java-1.5.0-gcj-5-amd64 --with-arch-directory=amd64 --with-ecj-jar=/usr/share/java/eclipse-ecj.jar --enable-objc-gc --enable-multiarch --disable-werror --with-arch-32=i686 --with-abi=m64 --with-multilib-list=m32,m64,mx32 --enable-multilib --with-tune=generic --enable-checking=release --build=x86_64-linux-gnu --host=x86_64-linux-gnu --target=x86_64-linux-gnu Thread model: posix gcc version 5.4.1 20160904 (Ubuntu 5.4.1-2ubuntu1~16.04)
edit4: The output of
whereis -b gcc gfortran gfortran-7
isgcc: /usr/bin/gcc /usr/lib/gcc gfortran: /usr/bin/gfortran gfortran-7: /usr/bin/gfortran-7
-
goo over 6 yearsEdit askubuntu.com/posts/948343/edit your Question and, using (Copy-And-Paste, Select pasted text, format with
{}
tool) the commands and results ofapt-cache policy gcc gfortran
,gcc -v
,gfortran -v
. -
tehfurbolg over 6 yearsDone. Thanks! I don't fully understand, but I feel that
apt-cache policy gcc gfortran
shows that older versions are still being used. (as didgfortran -v
) -
steeldriver over 6 yearsIt looks like you installed gcc-7 / g++-7 / gfortran7 from source - hence
apt
knows nothing about them. Perhaps you symlinked gcc and g++ to gcc-7 and g++-7 but didn't do the same for gfortran? -
dessert over 6 yearsThere is no package
gfortran-7
in 16.04, this package will only be available in 17.10. What Ubuntu version do you use? -
tehfurbolg over 6 years@dessert: I am using 16.04 (just checked again!) @steeldriver: Hmm, at least gfortran-7 I installed yesterday via
sudo apt-get install gfortran-7
, but I remember having a small problem with the others. How would I link them though? -
dessert over 6 yearsDid you install these packages without using
apt
ordpkg
? If so, no wonder it can't find them… -
tehfurbolg over 6 yearsI am uncertain about gcc and g++ (and maybe I will remove and re-install them) but at least gfortran-7 I installed via apt (
sudo apt-get install
) yesterday. But how could I have installed them otherwise? I didn't use a tarball and set up everything myself, at most I used a different command thansudo apt-get
. -
dessert over 6 yearsMaybe you added a PPA that provides the
gfortran-7
package? Does this help? -
dessert over 6 yearsPlease provide the outputs of
whereis -b gcc gfortran gfortran-7
. -
tehfurbolg over 6 yearsI added the output of
whereis
to the question. And yes I do have the Ubuntu toolchain ppa and I remeber using it when installing gcc and g++! I didn't use it (explicitly) when installing gfortran-7 yesterday though. I had found the link you provided, but as I only needed one version of all of them to run, I thought it would not help me.
-
-
tehfurbolg over 6 yearsOkay, I removed all of them and then installed
gcc-7
,g++-7
andgfortran-7
. Now forwhereis X-7
it always finds something. I'll test around with it and definetily learned a couple of things here. Thank you!