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

Robert Kern robert.kern@gmail....
Tue Dec 4 22:19:27 CST 2007

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.

> For Mac OS X, you may be bitten by  -undefined dynamic_lookup. This is 
> my fault: this flag is added at the wrong place, I put it temporarily in 
> the python extension builder, but this is not where it should be put. 
> Depending on its meaning, I can put it at the right place: does it give 
> the traditional unix semantic of enabling unresolved symbols instead of 
> the default one, which is similar to windows (even for shared code, 
> every symbol must be resolved) ?

That's the basic idea. Rigorously, it's probably a bit more involved when you
start considering two-level namespaces and framework.

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 .

Robert Kern

"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 mailing list