[Numpy-discussion] numpy_quaternion and gcc 4.1.2

Charles R Harris charlesr.harris at gmail.com
Sun May 6 18:30:47 EDT 2012

On Sun, May 6, 2012 at 1:35 PM, Tom Aldcroft
<aldcroft at head.cfa.harvard.edu>wrote:

> I ran into a problem trying to build and import the numpy_quaternion
> extension on CentOS-5 x86_64:
> $ python setup.py build
> <SNIP>
> C compiler: gcc -pthread -fno-strict-aliasing -fPIC -g -O2 -DNDEBUG -g
> -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC
> compile options:
> '-I/data/cosmos2/ska/arch/x86_64-linux_CentOS-5/lib/python2.7/site-packages/numpy/core/include
> -I/data/cosmos2/ska/arch/x86_64-linux_CentOS-5/include/python2.7 -c'
> gcc: quaternion.c
> quaternion.c: In function \u2018quaternion_isfinite\u2019:
> quaternion.c:55: warning: implicit declaration of function
> \u2018isfinite\u2019
> gcc: numpy_quaternion.c
> gcc -pthread -shared build/temp.linux-x86_64-2.7/quaternion.o
> build/temp.linux-x86_64-2.7/numpy_quaternion.o -o
> build/lib.linux-x86_64-2.7/quaternion/numpy_quaternion.so
> running scons
> There was a subsequent import error with "numpy_quaternion.so:
> undefined symbol: isfinite".  This problem does not occur for Ubuntu
> 11.10 and I presume it is due to CentOS-5 gcc (4.1.2) defaulting to
> -c89.
> I fixed this in setup.py by adding "extra_compile_args['-std=c99']" to
> the add_extension() call.  Is there a more general way in numpy to
> deal with issues like this?
You might take a look at core/include/numpy/npy_math.h, which I suspect
goes with core/lib/libnpymath.a. Running nm on the latter, it looks like
there are some extra symbols exported, but that is a bit to the side.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/numpy-discussion/attachments/20120506/048c9a33/attachment.html>

More information about the NumPy-Discussion mailing list