Building things with

Robert Kern robert.kern at
Fri Sep 22 23:46:36 CEST 2006

James Stroud wrote:
> Robert Kern wrote:
>>> Sorry. To clarify, making libpython2.5a available in a 
>>> $LD_LIBRARY_PATH was necessary to build numpy and scipy.
>> I don't see how that could have affected anything. Static libraries 
>> aren't looked up in $LD_LIBRARY_PATH. Certainly not for build-time linking.
> OK--new thing learned for the day. <rant>I try things until a build 
> works. I consider everything I do until acquiring a working build as 
> necessary. Going back to see exactly what I did to make things work is 
> not a viable option given that every new program I want requires my 
> building it and all of its dependencies--a consequence of the [adjective 
> deleted] beuracratic constraints (with regard to the machine on my 
> desktop) that have evolved here. These constraints are no doubt a 
> byproduct of the "Institute" part of my signature below, associated 
> paranoia, and over-worked sys-admins.</rant>

:-) I've always thought that a Kubuntu LiveCD would be a useful path around much 
of that nonsense, but I've fortunately not been forced to attempt it.

>> What do your environment variables look like when you build?
> euler 2% echo $CPPFLAGS
> -I/data10/users/jstroud/Programs/include 
> -I/data10/users/jstroud/Programs/qt/include -I/usr/include 
> -I/data10/users/jstroud/Programs/include/freetype2/freetype
> euler 3% echo $LD_LIBRARY_PATH
> /data10/users/jstroud/Programs/lib:/data10/users/jstroud/Programs/qt/lib:/usr/lib:/usr/X11R6/lib/:/usr/local/lib:/usr/lib/gcc-lib/i386-redhat-linux/3.2.3:/data10/users/jstroud/Programs/ccp4-5.0.2/lib
> euler 4% echo $LDFLAGS
> -L/data10/users/jstroud/Programs/lib 
> -L/usr/lib/gcc-lib/i386-redhat-linux/3.2.3

Okay, this is possibly part of the problem. numpy.distutils handles FORTRAN code 
differently than other extension modules; this is why pure C extension modules 
both inside numpy and elsewehere were linking fine. Try unsetenving $CPPFLAGS 
and $LDFLAGS and adding those arguments to build_ext, if necessary.

Looking on line 516 of numpy/fcompiler/ (why there's a class 
definition in, I'll never know), it does look like the linker flags 
which are carefully constructed by numpy.distutils are indeed overridden by the 
user's setting of $LDFLAGS.

The fact that this appears to be incompatible with how distutils does it for 
everything else is a bug, IMO, although it *is* a useful feature if you really 
do need to completely control the linker flags. That's probably what the 
implementor was thinking. Although, sadly, not documenting. He should be back 
from his honeymoon, now, so I'll raise the issue with him.

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