0

I am trying to run the makefile of a program in Fortran 77 that I did not write.

It specifies the following flags:

FLT_FLAGS = -native -libmil

and then uses them to compile a Fortran 77 program:

f77 -O -native -libmil -c a2.f

but fails:

f77: error: unrecognized command line option ‘-native’
makefile:107: recipe for target 'vg.a(a2.o)' failed
make: *** [vg.a(a2.o)] Error 1

The only thing I have been able to find with respect to this issue is that -native is obsolete, and maybe that's why gfortran (f77) does not recognize it: https://docs.oracle.com/cd/E37069_01/html/E37076/aevft.html#scrolltoc

Vladimir Vargas
  • 1,744
  • 4
  • 24
  • 48
  • 1
    Wait, so which compiler do you use, Oracle or gfortran? What does `f77 -v` print? How do you call gfortran? There is nothing like a Fortran native flag, every compiler has its own flags. – Vladimir F Героям слава Mar 20 '18 at 17:35
  • See the -mtune and -march flags for GCC (including gfortran) https://stackoverflow.com/questions/10559275/gcc-how-is-march-different-from-mtune – Vladimir F Героям слава Mar 20 '18 at 17:37
  • @VladimirF `f77 -v` prints `COLLECT_GCC=f77 COLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-linux-gnu/5/lto-wrapper Target: x86_64-linux-gnu Configured with:` [...] `Thread model: posix gcc version 5.4.0 20160609 (Ubuntu 5.4.0-6ubuntu1~16.04.9) `. I haven't seen any license on the code I am using because a professor gave it to me. The code comes from: https://aip.scitation.org/doi/abs/10.1063/1.168405 and I don't know if I should publish it here for the community to help me. – Vladimir Vargas Mar 20 '18 at 17:47

1 Answers1

2

You are using gfortran version 5.4. I wouldn't call f77 but gfortran directly if I were you.

The correct gfortran option similar to -native in some other compilers is -march=native or -mtune=native. See the manual and GCC: how is march different from mtune?

Don't forget to use other optimization flags like -O2 or -O3. The native option alone is not too useful.

  • 1
    Unfortuntelly this is not how this site works. Take a food reaad of [ask] and [mcve]. You must describe your errors and give steps to reproduce them *inside the question itself*. If they are new errors you should ask a *new question*. – Vladimir F Героям слава Mar 21 '18 at 07:22