You may have encountered an error message like the following while compiling PETSc on macOS,
Cannot use fblaslapack without Fortran, make sure you do NOT have --with-fc=0
This message is not particularly helpful, especially if you are sure that you already have gfortran installed. If you print src/configure.log
, you may find that the error is from something else entirely, or from a missing or unrecognized FFLAGS
option. These issues are relatively easy to fix. Sometimes, however, configure.log
provides no additional information. In these cases, the following steps may help to clear up the root cause.
- If you installed
gcc
via Homebrew, double check that it is installed by running brew list
.
- Run
brew doctor
to check for issues with Homebrew and/or package installation.
- If you have both Xcode and the Command Line Tools installed, check that their versions agree.
- If you use Homebrew,
brew config
will give you this information.
- Otherwise, run
/Applications/Xcode.app/Contents/Developer/usr/bin/xcodebuild -version
to get your Xcode version and pkgutil --pkg-info=com.apple.pkg.CLTools_Executables
(see line that starts with `version: to get the Command Line Tools version).
- If the version do not agree (the major and minor version numbers at least) and running
xcode-select --install
does not resolve the issue, run sudo rm -rf /Library/Developer/CommandLineTools
, navigate to https://developer.apple.com/download/all/ in a Web browser, and download and manually install the 'Command Line Tools for Xcode' package that agrees with the version of Xcode that you have installed. Note that you may need to start a new terminal session after this step.