1

I am trying to run fortran code on an Apple Macbook pro M1 chip machine running Big Sur v11.4. When testing my code I get the error

"f951: Error: unrecognized command-line option ‘-auxbase’".

I've written a test script test.f containing the following

program test
    print *, "Hello World"
end program test

The output of gcc -v:

Configured with: --prefix=/Applications/Xcode.app/Contents/Developer/usr --with-gxx-include-dir=/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/4.2.1
Apple clang version 12.0.5 (clang-1205.0.22.11)
Target: arm64-apple-darwin20.5.0
Thread model: posix
InstalledDir: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin

The output of gfortran -v:

Using built-in specs.
COLLECT_GCC=gfortran
Target: x86_64-apple-darwin13.4.0
Configured with: ../configure --prefix=/Users/pfesi/opt/anaconda3/envs/fermi --build=x86_64-apple-darwin13.4.0 --host=x86_64-apple-darwin13.4.0 --target=x86_64-apple-darwin13.4.0 --with-libiconv-prefix=/Users/pfesi/opt/anaconda3/envs/fermi --enable-languages=fortran --disable-multilib --enable-checking=release --disable-bootstrap --disable-libssp --with-gmp=/Users/pfesi/opt/anaconda3/envs/fermi --with-mpfr=/Users/pfesi/opt/anaconda3/envs/fermi --with-mpc=/Users/pfesi/opt/anaconda3/envs/fermi --with-isl=/Users/pfesi/opt/anaconda3/envs/fermi --with-native-system-header-dir=/Applications/Xcode_12.4.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.9.sdk/usr/include
Thread model: posix
gcc version 7.5.0 (GCC) 

The output of which gcc:

/usr/bin/gcc

The output of which gfortran:

/Users/pfesi/opt/anaconda3/envs/fermi/bin/gfortran

I'm not an expert on gfortran and any help will be highly appreciated.

  • Writing a file `test.py` containing Fortran code ... . Which command did you give to compile your file? – albert Jul 31 '21 at 10:42
  • Hi Albert, Sorry about the typo, I meant to write test.f and I've corrected it now. So I ran the command $gfortran test.f – Pfesi van Zyl Jul 31 '21 at 10:49
  • https://stackoverflow.com/questions/39596418/what-does-the-compiler-option-auxbase-strip-do might be of use – Ian Bush Jul 31 '21 at 11:09
  • As might https://gcc-help.gcc.gnu.narkive.com/np3hJuMV/auxbase-vs-auxbase-strip – Ian Bush Jul 31 '21 at 11:10
  • Hi Ian, went through your suggestions but for the life of me I cannot understand how any of them solve my issue at hand. I've just started using fortran and find those links confusing. – Pfesi van Zyl Jul 31 '21 at 16:47
  • These are mainly meant to help others find a solution - they basically say what -auxbase is and why it isn't in the standard documentation. I suspect it's an Apple specific problem, certainly gfortran 7.5 recognises -auxbase on my Linux box, but as I don't use Macs I can't help more. – Ian Bush Jul 31 '21 at 21:23
  • Hi Ian, thank you for pointing out it might be an Apple problem. I realised that after i installed x-code I then rushed to google to find out how to install gfortran without testing the x-code version first, which is why i ended up with incompatability issues. So in the end I ended up removing all brew installations and now my code works. – Pfesi van Zyl Aug 01 '21 at 03:47
  • This is a comment, not an answer (caveat emptor…) but I don't like that your `gcc` is the system's one and your `gfortran` is the one installed by anaconda. – gboffi Aug 02 '21 at 19:19
  • Hi @gboffi, I had tried to install Fortran in my conda virtual environment which caused a lot of issues and resulted in me creating this post. I only later discovered I shouldn't have done any of that in the first place and have since referred back to the Xcode install version which now works fine, both my gcc and gfortran now point to the same location. My only gripe now is that I need to figure out how to install Fortran without Xcode because I had to download 12GB worth of Xcode just to use Fortran :(. – Pfesi van Zyl Aug 04 '21 at 11:01
  • 12 GB is no more what they used to be… – gboffi Aug 04 '21 at 13:05

0 Answers0