[Distutils] "pip wheel numpy" giving undefined reference errors

Dan Stromberg drsalists at gmail.com
Thu Mar 26 20:44:49 CET 2015


On Wed, Mar 25, 2015 at 12:50 PM, Dan Stromberg <drsalists at gmail.com> wrote:
> Hi again.
>
> When I try to build a numpy wheel (using openblas statically, and
> libpython2.7 statically as well), I get a lot of errors like:
>
>   /tmp/pip-build-ZlPgN7/numpy/build/src.linux-x86_64-2.7/numpy/core/include/numpy/__multiarray_api.h:1642:
> undefined reference to `PyExc_AttributeError'
>   /tmp/pip-build-ZlPgN7/numpy/build/src.linux-x86_64-2.7/numpy/core/include/numpy/__multiarray_api.h:1642:
> undefined reference to `PyErr_SetString'
>   /tmp/pip-build-ZlPgN7/numpy/build/src.linux-x86_64-2.7/numpy/core/include/numpy/__multiarray_api.h:1642:
> undefined reference to `PyExc_ImportError'
>
> My first thought was "OK, I'll put -lpython2.7 in $LDFLAGS and export
> it", but that didn't appear to help.

I got past this by creating a drs-gcc and drs-gfortran shell wrappers,
that feed $LDFLAGS "$@" $LDFLAGS as command line arguments to gcc and
gfortran respectively.  I had to define $CC and $FC to make the
wrappers get used - before invoking pip wheel.  I also defined $F90 -
not sure if one or both of those fortran variables helped.

I've done a lot of software builds, but I've never had to resort to
that kind of trickery before.  Perhaps that's because most of my
builds were using dynamic libraries rather than static.


More information about the Distutils-SIG mailing list