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

Robert Kern robert.kern at gmail.com
Tue Dec 4 14:27:54 EST 2007


David Cournapeau wrote:
> Some of the most interesting things I can think of which work with scons:
>     - you can control fortran and C flags from the command line: CFLAGS 
> and FFLAGS won't override necessary flags, only optimization flags, so 
> you can easily play with warning, optimization flags. For example:
> 
> CFLAGS='-W -Wall -Wextra -DDEBUG' FFLAGS='-DDEBUG -W -Wall -Wextra' 
> python setupscons build
> 
> for debugging will work. No need to care about -fPIC and co, all this is 
> handled automatically.

Can I override the flags which are handled automatically without modifying
numpy? I just spent much of last night trying to get Intel Fortran on OS X
working, and I had to dive into numpy.distutils.fcompiler.intel a lot. This is
mildly acceptable, if irritating, for a numpy developer, but not acceptable for
even a sophisticated user. Even if we were to keep our knowledge-base of Fortran
compiler flags immediately up-to-date with every release of every Fortran
compiler we follow, people will still be stuck with older versions of numpy.

numpy.distutils' behavior of using LDFLAGS, for example, to completely replace
the flags instead of extending them mitigated this, somewhat. It allowed someone
to work around the stale flags in numpy.distutils in order to get something
built. This is a hack, and it causes confusion when this isn't the desired
behavior, but it worked.

But can we do something better with scons? One option which would work both with
scons and the current numpy.distutils is to provide something like
LDFLAGS_NO_REALLY which replaces the flags and let LDFLAGS just extend the
flags. That doesn't help the ultimate problem, but it makes the workaround more
user-friendly. Another option is to have our Fortran compiler "knowledge-base"
separable from the rest of the package. scons could try to import them from,
say, numpy_fcompilers first and then look inside numpy.distutils if
numpy_fcompilers is not found. That way, a user could download a fresh
"knowledge-base" into their source tree (and possibly tweak it) without the
burden of installing a new numpy.

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