问题
Is it possible to update gfortran
without updating the GCC in a Linux operating system?
回答1:
Well, since gfortran
is part of the GCC, just updating gfortran
could be a little tricky. However, you can download the gfortran
binaries, as well as the required gcc-infrastructure
package from the official site.
You can unzip the two archives into a folder (e.g., /usr/local/gfortran
) and start using this version of GCC (incl. gfortran
) alongside the version provided by your GNU Linux system. It might be helpful to set up a short shell script to adjust the PATH
and LD_LIBRARY_PATH
to use this local version. The gfortran
site provides further details and examples on how to achieve that.
In essence, you need to do something like this:
export PATH="/usr/local/gfortran/bin:$PATH"
and
if [ -z "$LD_LIBRARY_PATH" ]; then
LD_LIBRARY_PATH="/usr/local/gfortran/lib"
else
LD_LIBRARY_PATH="/usr/local/gfortran/lib:$LD_LIBRARY_PATH"
fi
export LD_LIBRARY_PATH
provided that you installed the local version in /usr/local/gfortran
.
来源:https://stackoverflow.com/questions/36178094/updating-gfortran-without-updating-gcc