Gfortran: Error: unknown value ‘native’ for ‘-mtune’

I am trying to build a fortran package on Conda-Forge using their servers. Compilation fails for the Apple Silicon build with the error unknown value 'native' for '-mtune', using gfortran 12.2.0 built by conda-forge. This is puzzling because I have tried on my local Apple Silicon machine to compile fortran with this same compiler (e.g. gfortran test.f90 -c -mtune=native), and I do not get the same error.

Below is the relevant part of the error. I have also attached the whole output in the log.txt file. Also, here is the relevant pull request: ARM OSX Migrator by regro-cf-autotick-bot · Pull Request #1 · conda-forge/photochem-feedstock · GitHub

log.txt (151.4 KB)

[  0%] Building Fortran object _deps/h5fortran-build/CMakeFiles/h5fortran.dir/src/interface.f90.o
  f951: Error: unknown value ‘native’ for ‘-mtune’
  f951: note: valid arguments are: cortex-a34 cortex-a35 cortex-a53 cortex-a57 cortex-a72 cortex-a73 thunderx thunderxt88p1 thunderxt88 octeontx octeontx81 octeontx83 thunderxt81 thunderxt83 ampere1 emag xgene1 falkor qdf24xx exynos-m1 phecda thunderx2t99p1 vulcan thunderx2t99 cortex-a55 cortex-a75 cortex-a76 cortex-a76ae cortex-a77 cortex-a78 cortex-a78ae cortex-a78c cortex-a65 cortex-a65ae cortex-x1 ares neoverse-n1 neoverse-e1 octeontx2 octeontx2t98 octeontx2t96 octeontx2t93 octeontx2f95 octeontx2f95n octeontx2f95mm a64fx tsv110 thunderx3t110 zeus neoverse-v1 neoverse-512tvb saphira cortex-a57.cortex-a53 cortex-a72.cortex-a53 cortex-a73.cortex-a35 cortex-a73.cortex-a53 cortex-a75.cortex-a55 cortex-a76.cortex-a55 cortex-r82 cortex-a510 cortex-a710 cortex-x2 neoverse-n2 demeter generic
  make[2]: *** [_deps/h5fortran-build/CMakeFiles/h5fortran.dir/build.make:153: _deps/h5fortran-build/CMakeFiles/h5fortran.dir/src/interface.f90.o] Error 1
  make[1]: *** [CMakeFiles/Makefile2:6453: _deps/h5fortran-build/CMakeFiles/h5fortran.dir/all] Error 2
  make: *** [Makefile:156: all] Error 2

Any wisdom is appreciated! Why am I getting this -mtune error?

I’ve encountered the same error. I believe that the issue stems from the fact that conda is doing cross-compiling. Hence, optimizing for native does not make sense because the code will run on a non-native machine.
For the moment, I just remove the -mtune option completely. But I believe it would make sense to tune to the instruction set of Apple silicon. Submodel Options (Using the GNU Compiler Collection (GCC)) seems to be the right starting place for learning which options are available.

2 Likes

It looks like removing -mtune did the trick, and now everything compiles.