[SciPy-dev] Re: Another issue with scipy_distutils and FORTRAN files

Berthold Höllmann hoel at gl-group.com
Tue Mar 30 09:02:24 CST 2004

Berthold Höllmann <hoel at gl-group.com> writes:

> Pearu Peterson <pearu at scipy.org> writes:
>> On Mon, 29 Mar 2004, [ISO-8859-15] Berthold Höllmann wrote:
>>> Our FORTRAN code often uses "include" statements. The FORTRAN compiler
>>> we use (DF 6.1, ifc 7.1,  WorkShop 6 update 2 Fortran) recognize the
>>> -I flag for pointing to an include directory. I seems scipy_distutils
>>> have lost the ability to regognize the "include_dirs" argument to
>>> "Extensions". The compiler does not find the include files anymore.
>> Hmm, I just checked and I could not reproduce this: paths in 
>> the include_dirs keyword argument of an Extension class are shown
>> in `compile options:`. Try for example
>>   cd scipy_distutils/tests/f2py_f90_ext
>>   python setup.py config_fc --fcompiler=intel build
>> after updating/installing scipy_core and f2py from CVS.
>> However, f2py was not able to find the include files. This is now fixed
>> in f2py CVS.
> I have no idea what went wrong here, but now it works,


It turned out, the problem is how to tell include directiories when
generating a library. We use

flibs = [('fortmisc',
          {'sources': lib_src,
           'include_dirs': [os.path.join("lib", "numfort")],

and setting 



Running os.system('( /usr/software/fitools/opt/intel/compiler70_l_fc_pc_7.1.038/ia32/bin/ifc -72 -w90 -w95 -KPIC -cm -O3 -unroll -tpp5 -xM -c lib/numfort/NB.F -o build/temp.linux-i686-2.2/lib/numfort/NB.o ; echo $? > /tmp/@6992.7 ) 2>&1 | tee /tmp/@6992.6 ')

I guess the the correct fix lies in _compiler in fcompiler.py. The line

        command = compiler + cc_args + s_args + o_args + extra_postargs

should be

        command = compiler + cc_args + s_args + o_args + extra_postargs + pp_opts

(at least this works for me). Of course "NB.F" only compiles with
another (helpfull) patch to fcompiler.f. I changed 

    language_map = {'.f':'f77',


    src_extensions = ['.for','.ftn','.f77','.f','.f90','.f95','.F','.F90']

Probably 'language_map' shold reflect that '.F' and '.F90' files
should be preprocessed using fpp, and fpp must be explicitly switche
on on some platforms.

Kind regards

Berthold Höllmann
Germanischer Lloyd AG
CAE Development
Vorsetzen 35
20459 Hamburg
Phone: +49(0)40 36149-7374
Fax: +49(0)40 36149-7320
e-mail: hoel at gl-group.com
Internet: http://www.gl-group.com 
This e-mail contains confidential information for the exclusive attention of the intended addressee. Any access of third parties to this e-mail is unauthorised. Any use of this e-mail by unintended recipients such as copying, distribution, disclosure etc. is prohibited and may be unlawful. When addressed to our clients the content of this e-mail is subject to the General Terms and Conditions of GL's Group of Companies applicable at the date of this e-mail.  
GL's Group of Companies does not warrant and/or guarantee that this message at the moment of receipt is authentic, correct and its communication free of errors, interruption etc.  

More information about the Scipy-dev mailing list