[Numpy-discussion] scipy.scons branch: building numpy and scipy with scons

David Cournapeau cournape@gmail....
Tue Dec 4 23:38:58 CST 2007


On Dec 5, 2007 1:19 PM, Robert Kern <robert.kern@gmail.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).

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.

>
> That's the basic idea. Rigorously, it's probably a bit more involved when you
> start considering two-level namespaces and framework.
>
scons handles frameworks, but I feel that it is gcc specific.

> 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 ?

To sum it up: I think that implementation-wise, scons on mac os X has
many gcc-only idiosyncraties; fortunately, once we know exactly what
the flags should be in which cases, this is only a matter of changing
the intel tools (for intel compilers on mac os X). OTOH, API-wise,
there is no gcc idiodyncraties, which is the thing which matters in
the mid-term: scons tools abstraction is quite good IMHO, and you
don't have to fear breaking unrelated things like you do with
distutils.

All this should be modified to be sent upstream to scons, also.

cheers,

David


More information about the Numpy-discussion mailing list