[Numpy-discussion] How to tell numpy to use gfortran as a compiler ?

Robert Kern robert.kern@gmail....
Sun Feb 25 21:00:42 CST 2007

David Cournapeau wrote:
> Sturla Molden wrote:
>> g77 is a Fortran 77 compiler. The development of g77 is halted.
>> gfortran is a Fortran 77, 90, and 95 compiler. It is the current Fortran
>> compiler in the GNU Compiler Collection (GCC).
>> You can compile the reference implementation of BLAS and LAPACK with both
>> g77 and gfortran, as these libraries are written in Fortran 77. ATLAS is
>> written in C and some Fortran 77.
>> gfortran are able to do some optimizations that g77 cannot, e.g.
>> autovectorization using SSE and MMX extensions and profile-guided
>> optimizations. Also be aware that if you use gfortran and GCC 4, the C
>> compiler is better as well.
> Ok, that clears things you, thank you. Now, I have to understand why 
> --fcompiler=gnu95 still calls gfortran....

You mean g77? Anyways, I think I know why you are having problems. Passing
--fcompiler to the config command only affects the Fortran compiler that is used
during configuration phase (where we compile small C programs to determine what
your platform supports, like isnan() and the like). It does not propagate to the
rest of the build_ext phase where you want it. Use config_fc to set up your
Fortran compiler for all of the phases:

  $ python setup.py config_fc --fcompiler=gnu95 build

Robert Kern

"I have come to believe that the whole world is an enigma, a harmless enigma
 that is made terrible by our own mad attempt to interpret it as though it had
 an underlying truth."
  -- Umberto Eco

More information about the Numpy-discussion mailing list