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

**URL:** <https://fortran-lang.discourse.group/t/gfortran-error-unknown-value-native-for-mtune/6172>\
**Category:** Help\
**Created:** [July 18, 2023, 11:55pm UTC](https://fortran-lang.discourse.group/t/gfortran-error-unknown-value-native-for-mtune/6172 "2023-07-18T23:55:50Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![nicholaswogan](https://avatars.discourse-cdn.com/v4/letter/n/f1d935/32.png) [@nicholaswogan](https://fortran-lang.discourse.group/u/nicholaswogan)\
**Post date:** [July 18, 2023, 11:55pm UTC](https://fortran-lang.discourse.group/t/gfortran-error-unknown-value-native-for-mtune/6172/1 "2023-07-18T23:55:50Z")

</div>

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](https://github.com/conda-forge/photochem-feedstock/pull/1)

[log.txt](https://fortran-lang.discourse.group/uploads/short-url/yeiQA8wAShxQRb5rsbkj6KfHKiu.txt) (151.4 KB)

```sh
[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?

---

<div class="post-metadata">

**Author:** ![MarDie](https://yyz2.discourse-cdn.com/free1/user_avatar/fortran-lang.discourse.group/mardie/32/54_2.png) [@MarDie](https://fortran-lang.discourse.group/u/MarDie)\
**Post date:** [July 19, 2023, 5:46am UTC](https://fortran-lang.discourse.group/t/gfortran-error-unknown-value-native-for-mtune/6172/2 "2023-07-19T05:46:34Z")

</div>

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))](https://gcc.gnu.org/onlinedocs/gcc/Submodel-Options.html) seems to be the right starting place for learning which options are available.

---

<div class="post-metadata">

**Author:** ![nicholaswogan](https://avatars.discourse-cdn.com/v4/letter/n/f1d935/32.png) [@nicholaswogan](https://fortran-lang.discourse.group/u/nicholaswogan)\
**Post date:** [July 19, 2023, 5:55am UTC](https://fortran-lang.discourse.group/t/gfortran-error-unknown-value-native-for-mtune/6172/3 "2023-07-19T05:55:07Z")

</div>

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