I am using MACOS Big Sur.
I installed the gcc 9 by
brew install gcc#9
But I found my gfortran is gfortran8.2. So I uninstall the gfortran and reinstall it by
brew install gfortran
But the version is
bash-3.2$ gfortran --version
GNU Fortran (Homebrew GCC 10.2.0_4) 10.2.0
Copyright (C) 2020 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty;
How I can install a gfortran9(link to gcc#9) by brew in Mac
Related
The new MacOS Ventura seems to have broken gfortran MacOS version control. To reproduce my error you only have to do
gfortran --version
And the output is
gfortran: warning: could not understand version ‘13.00.00’
GNU Fortran (GCC) 11.3.0
Copyright (C) 2021 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
This in itself is just a warning so it might not be a big deal but it breaks "./configure" scripts that require some MacOS versions, e.g. if you try to compile LoopTools you get the following error (in the log file)
arm64-apple-darwin20.0.0-gfortran: warning: could not understand version '13.00.00'
ld: -rpath can only be used when targeting Mac OS X 10.5 or later
collect2: error: ld returned 1 exit status
Since the version cannot be properly read it cannot be compared.
Is there some sort of work around this bug?
I had installed gfortran through conda but aparantly the version is from last year.
I solved it by removing it from conda (had to remove conda entirely due to linking issues) and installed it with brew : brew install gcc.
Just trying to determine the version of gcc-11 installed by Homebrew, I get an error:
gcc-11 --version
gcc-11: warning: could not understand version '13.00.00'
gcc-11 (Homebrew GCC 11.3.0_2) 11.3.0
Copyright (C) 2021 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
I know this is beta software (macOS), but is there a way to make gcc-11 recognize version 13.00.00?
I have tried all the solutions of similar questions and none works.
I have installed gcc in /usr/local/bin and this my PATH variable
echo $PATH
/usr/local/gcc-12.1.0/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin
But when i run gcc --version command, my linux can't find it, why?
gcc --version
gcc (Ubuntu 9.4.0-1ubuntu1~20.04.1) 9.4.0
Copyright (C) 2019 Free Software Foundation, Inc.
It still points to the older 9.4.0 version.
Could someone help me use the new version of the gcc compiler.
Thanks!
You should use update-alternatives tool to install gcc-12 as an alternative and to make it the default one.
I am trying to compile a "hello world" text file, but keep receiving an error in my mac terminal:
(base) name#Names-MacBook-Pro-3 File % gfortran -o test.exe try.f90
c.lang (LLVM option parsing): Unknown command line argument '-x86-pad-for-
align=false'. Try: 'clang (LLVM option parsing) --help'.
My fortran version:
GNU Fortran (Homebrew GCC 11.3.0_1) 11.3.0
text file (try.f90) that I wrote in VS:
program try
print*,'hello world!'
end program try
I tried with a space and without a space before print. The code I am using is from a youtuber who uses Atom text editor and the video is from 2020.
I am stuck. Please help.
I resolved my issue by updating Xcode. There was an incompatibility between gfortran and clang. To see available updates:
softwareupdate --list see the list of outdated software.
softwareupdate --install <name>
I faced the same issue and it seems the root cause was Xcode vs Command Line Tools were used. Probably some inconsistency (e.g. I might have upgraded the cli but not the gui).
Anyway, before
$ xcode-select --print-path
/Applications/Xcode.app/Contents/Developer/
I fixed this with
$ sudo xcode-select -switch /Library/Developer/CommandLineTools
and then gcc-12 or gfortran from homebrew worked as expected.
FWIW
$ clang --version
Apple clang version 13.0.0 (clang-1300.0.29.30)
Target: x86_64-apple-darwin20.6.0
Thread model: posix
InstalledDir: /Library/Developer/CommandLineTools/usr/bin
$ gcc-12 --version
gcc-12 (Homebrew GCC 12.2.0) 12.2.0
Copyright (C) 2022 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
On OS X 10.11.6, I installed gcc 6.2.0 using homebrew. It lives over in usr/local/Cellar/gcc/6.2.0/bin. After getting it to link (it didn't do this automagically), I cd there and try the solution from this other thread to create an alias
ln -s gcc-6 gcc
then gcc --version gives me
cc (GCC) 4.9.2 20141029 (prerelease)
Copyright (C) 2014 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
All this is because trying to install things crashes because of -rdynamic flags, that I hope is fixed in a newer version.
You created the symlink with the proper target name (gcc) but forgot to set the PATH to your newly installed location (or set it after the system path).
What's confusing is that your system already has a version of gcc installed. You have to override the default path so your gcc command comes first.
edit your ~/.profile file and check PATH adjustment. Add a line in the end which contains:
export PATH=/usr/local/Cellar/gcc/6.2.0/bin:$PATH
Then open a new terminal and ensure that which gcc prints
/usr/local/Cellar/gcc/6.2.0/bin/gcc