[Numpy-discussion] numpy_quaternion and gcc 4.1.2

Tom Aldcroft aldcroft at head.cfa.harvard.edu
Sun May 6 15:35:45 EDT 2012


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?

Thanks,
Tom



More information about the NumPy-Discussion mailing list