I am compiling C++, Fortran, and OpenMPI code using Homebrew installed packages. I also use the make (GNU Make 4.3) and cmake (3.24.1) packages installed with Homebrew. I compile the test programs as follows:
### C++ ###
int main (int argc, char** argv)
{
int x=2;
return 0;
}
$ g++ test.cc
> clang: error: invalid version number in '-mmacosx-version-min=12.5'
### Fortran ###
program hello
print *, "Hello, world!"
end program hello
$ gfortran test.f90
> clang: error: invalid version number in '-mmacosx-version-min=12.5'
I get a clang error: clang: error: invalid version number in '-mmacosx-version-min=12.5' when using gcc-12 and gfortran-12. The version number requirement in the above error changes depending on the gcc version installed. For example, gcc-10 and gcc-11 result in clang: error: invalid version number in '-mmacosx-version-min=12.0'.
What's interesting is that the error invoked is coming from Apple clang even though I am not using it for compiling any of the programs.
Some relevant specs:
- macOS Monterey 12.5.1
- xcode-select version 2395
- xcode-select path: /Library/Developer/CommandLineTools
$ /usr/bin/clang --version
Apple clang version 13.1.6 (clang-1316.0.21.2.5)
Target: x86_64-apple-darwin21.6.0
Thread model: posix
InstalledDir: /Library/Developer/CommandLineTools/usr/bin
Update: I now installed gfortran using the intel standalone installer here, I still get the same error.