[Numpy-discussion] distutils: compiler used by add_library

Ondřej Čertík ondrej.certik at gmail.com
Wed Aug 29 18:52:57 EDT 2012


Hi Matyáš,

On Wed, Aug 29, 2012 at 3:20 AM, Matyáš Novák <logik at centrum.cz> wrote:
> Hi,
> I wrote extension some numerical extension for python, that requires
> compiling
> and linking additional fortran sources. I find out, that these libraries
> can be easily added
> using config.add_library() function, but there is a problem.
> The --fcompiler command doesn't propagate to the stage where the
> libraries are compiled,
> so the default (and in my case wrong) compiler is used.  (If I try
> compile the files using
> add_extension method, they are compiled by desired compiler, but I need
> combine more
> sources in one extension so I think that I can't use add_extension).
> Is there any way how to force python to use the right compiler, or at
> least hardcode the
> compiler in the setup.py?

Maybe somebody can help with your particular question,
but I was also struggling with similar issues when mixing Fortran, C and Python
and settled on using cmake for compiling and linking Fortran, C and
Python extension .so
modules, as well as installing the Python .py files.

Ondrej



More information about the NumPy-Discussion mailing list