[SciPy-user] Building with a non-standard gfortran

Johann Cohen-Tanugi cohen@slac.stanford....
Fri Nov 23 14:11:38 CST 2007


David M. Cooke wrote:
> On Nov 20, 2007, at 09:03 , Adam Mercer wrote:
>
>   
>> Hi
>>
>> Using MacPorts, the gfortran compiler, from gcc-4.2.x, is installed as
>> gfortran-mp-4.2.  I have been trying to build scipy with this compiler
>> and found that that numpy I need to build and install with
>>
>> $ python setup.py config_fc --fcompiler gnu95 \
>>    --f77exec /opt/local/bin/gfortran-mp-4.2 \
>>    --f90exec /opt/local/bin/gfortran-mp-4.2 build
>> $ python setup.py install --prefix=${NUMPY_LOCATION}
>>
>> however using the above for scipy fails on the install phase with it
>> being unable to locate a fortran compiler.  I therefore need to
>> install scipy with
>>
>> $ python setup.py config_fc --fcompiler gnu95 \
>>    --f77exec /opt/local/bin/gfortran-mp-4.2 \
>>    --f90exec /opt/local/bin/gfortran-mp-4.2 install --prefix=$ 
>> {SCIPY_LOCATION}
>>
>> Is this expected, as I would have expected install to inherit the
>> options that where used during the build phase?
>>     
>
> The options used in the build phase aren't stored, so, yes, they need  
> to be respecified. For numpy it doesn't matter, as the Fortran  
> compiler isn't used. Since we use distutils, you can set the config_fc  
> options in a file (either globally for the user in a  
> ~/.pydistutils.cfg, or per-package in a setup.cfg next to the setup.py  
> you're running) by adding the following section to the appropiate file
>
> [config_fc]
> fcompiler=gfortran
> f77exec=gfortran-mp-4.2
> f90exec=gfortran-mp-4.2
>
>   
Thanks for the tip, David. I tried it :
[cohen@localhost scipy-svn]$ which gfortran
/usr/bin/gfortran
[cohen@localhost scipy-svn]$ more ~/.pydistutils.cfg
[config_fc]
fcompiler=gfortran
f77exec=gfortran
f90exec=gfortran

and 'python setup.py build' does correctly use gfortran, but both numpy 
and scipy keep putting out
customize GnuFCompiler
gnu: no Fortran 90 compiler found
gnu: no Fortran 90 compiler found
customize GnuFCompiler
gnu: no Fortran 90 compiler found
gnu: no Fortran 90 compiler found
customize GnuFCompiler using build_ext

at install time....

Also, now that I am at it, there seems to be a doubling of the mach 
library, which should be solved for cleanliness :
customize UnixCCompiler using build_ext
library 'mach' defined more than once, overwriting build_info
{'sources': ['scipy/integrate/mach/i1mach.f', 
'scipy/integrate/mach/xerror.f', 'scipy/integrate/mach/r1mach.f', 
'scipy/integrate/mach/d1mach.f'], 'config_fc': {'noopt': 
('scipy/integrate/setup.pyc', 1)}, 'source_languages': ['f77']}...
with
{'sources': ['scipy/special/mach/i1mach.f', 
'scipy/special/mach/xerror.f', 'scipy/special/mach/r1mach.f', 
'scipy/special/mach/d1mach.f'], 'config_fc': {'noopt': 
('scipy/special/setup.pyc', 1)}, 'source_languages': ['f77']}...


best,
Johann


More information about the SciPy-user mailing list