2

After updating to MacOS Mojave, I get an error when compiling with gfortran.

gfortran: warning: couldn’t understand kern.osversion ‘18.0.0
ld: library not found for -lcrt1.o
collect2: error: ld returned 1 exit status

This error did not occur before the update. I tracked similar threads and followed their proposed solutions. However, I got further errors when following ...

  • Update XCode: Now updated to version 10.0.
  • Run xcode-select --install: I get the following error: xcode-select: error: command line tools are already installed, use "Software Update" to install updates. Following this thread, I did softwareupdate --list and get No new software available.. I conclude, that XCode updating is not the problem here. I also made sure that additional tools are installed upon first opening the updated XCode.

  • Following this thread, where a similar error was reported, I did brew doctor. Something goes wrong here. I get Warning: Your Xcode (1) is outdated; Please update to Xcode 7.1. Apparently it doesn't recognise to confirmed fact that my XCode is at 10.0. What can be done about that?

  • Following this thread, I did brew upgrade gcc and get this error: Warning: You are using OS X 10.14.; ....

  • With so many brewing errors, I checked the brew troubleshooting site, and followed their recommendations. I did cd /usr/local && sudo chown -R $(whoami) bin etc include lib sbin share var opt Cellar Caskroom Frameworks and again brew update and get this error: Error: The /usr/local directory is not writable. .... Following the recommendation in the error message, I did sudo chown -R $(whoami):admin /usr/local but get the error chown: /usr/local: Operation not permitted.

  • brew reinstall gcc sounds like I would get the same error as in the previous point. Haven't tried so far, worrying for making the mess even worse.

Bottom line: I drowned in errors and see no solution. Any ideas what's the problem and how to solve it are appreciated!

divibisan
  • 11,659
  • 11
  • 40
  • 58
stineb
  • 461
  • 1
  • 5
  • 11

1 Answers1

3

I was experiencing the same problems (I think the crt1.0 error relates to the usage of Fortran commands like GET_COMMAND_ARGUMENT), and also didn't have any luck after trying all the steps you describe in your post, but it got fixed instantly when I installed gfortran 8.2 for MacOS 10.14 with the installer that you can find here: https://github.com/fxcoudert/gfortran-for-macOS/releases (got there via the gcc website: https://gcc.gnu.org/wiki/GFortranBinaries#MacOS).

I hope this also fixes the problems for you!