[Numpy-discussion] scipy.scons branch: building numpy and scipy with scons
Wed Dec 5 00:11:28 CST 2007
David Cournapeau wrote:
> On Dec 5, 2007 1:19 PM, Robert Kern <email@example.com> wrote:
>> David Cournapeau wrote:
>>> Robert Kern wrote:
>>>> David Cournapeau wrote:
>>>>> - I have not yet tweaked fortran compiler configurations for
>>>>> optimizations except for gnu compilers
>>>> Can you give us a brief overview about how to do this? For example, the Intel
>>>> Fortran compiler's SHLINKFLAGS in scons-local/.../SCons/Tool/ifort.py are
>>>> incorrect for version 10 on OS X. Would I copy that file to scons/tool/ and make
>>>> my edits there? Do I then add 'ifort' to the list in scons/core/default.py?
>>> The basic rule is: if the code cannot run without a flag, the flag
>>> should be put in a tool, or at worse (but really if you have no choice)
>>> in numpyenv.py. If the flag is optimization, warning, etc... then it
>>> should be put into default.py. Basically, tools are not always
>>> up-to-date in scons, perticularly for fortran. So I provided a way to
>>> override the tools: as you noticed, you can put tools in
>>> .../scons/tools/, those will be picked up first. This is independent
>>> from adding ifort in scons/core/default.py.
>> Right. In this case, "-shared" needs to be "-dynamiclib" on OS X, so this should
>> go into the tool.
> That's strange: -shared should not be used at all on mac os X. Either
> -bundle or -dynamiclib should be used (this is in applelink tool, so
> this is independant from the compiler used, normally).
I was only reading code; I haven't tested building Fortran extensions, yet.
However, using a generic link tool would be the wrong thing to do for most
Fortran extensions, I think. Where does it get the correct Fortran runtime
libraries from? Some Fortran compilers really like to be the linker when mixing
> But I may have done something wrong, because I don't know much about
> mac os X idiosyncraties on this: basically, what's the difference
> between -dynamiclib and -bundle ?
> When I build python extension, I used the module scons builder, which
> is the same than shared library except on mac os X (on mac os X,
> shared libraries use -dynamiclib, modules use -bundle). I must confess
> that I used the thing which worked in thise case, without knowing
> exactly what i was doing.
ifort only supports -dynamiclib. For the regular linker, -bundle is correct for
building Python extensions; I may have to rethink about using ifort to link,
then. Basically, a bundle can be dynamically loaded while dylibs can't, so
Python uses bundles for extension modules.
What confuses me is that I successfully built some Fortran modules last night
using numpy.distutils and ifort -dynamiclib. Hmm.
>> One thing to note is that this option is only valid for GNU compilers. Linking
>> with ifort, I need to use -Wl,-undefined,dynamic_lookup .
> Can't we just add a linker flag instead of using it from the compiler
> ? We still use the apple linker with ifort/icc, no ?
I don't know. We'd have to locate all of the Fortran runtime libraries and add
them. How do we do that? Or is that already done?
"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