Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

fails to compile on AIX #4723

Closed
fz0dbx opened this Issue · 4 comments

3 participants

Brent S. Elmer Julian Taylor Ralf Gommers
Brent S. Elmer

I am building numpy on AIX 6.1 using the xlc compilers. They are failing with errors like this:
creating build/temp.aix-6.1-2.7/build/src.aix-6.1-2.7/numpy/core/src/npysort
compile options: '-Ibuild/src.aix-6.1-2.7/numpy/core/src/private -Inumpy/core/include -Ibuild/src.aix-6.1-2.7/numpy/core/include/numpy -Inumpy/core/src/private -Inumpy/core/src -Inumpy/core -Inumpy/core/src/npymath -Inumpy/core/src/multiarray -Inumpy/core/src/umath -Inumpy/core/src/npysort -Inumpy/core/include -I/profit/freeware/python/aix/python2.7.6/include/python2.7 -Ibuild/src.aix-6.1-2.7/numpy/core/src/private -Ibuild/src.aix-6.1-2.7/numpy/core/src/private -Ibuild/src.aix-6.1-2.7/numpy/core/src/private -Ibuild/src.aix-6.1-2.7/numpy/core/src/private -c'
xlc_r: build/src.aix-6.1-2.7/numpy/core/src/npysort/heapsort.c
"/usr/include/stdio.h", line 528.12: 1506-343 (S) Redeclaration of fgetpos64 differs from previous declaration on line 323 of "/usr/include/stdio.h".
"/usr/include/stdio.h", line 528.12: 1506-377 (I) The type "long long" of parameter 2 differs from the previous type "long restrict".
"/usr/include/stdio.h", line 531.12: 1506-343 (S) Redeclaration of fseeko64 differs from previous declaration on line 471 of "/usr/include/stdio.h".
"/

The problem is that on AIX as well as other platforms, Python.h contains system level defines that are used in standard libraries. This particular problem is in stdio.h.
On AIX, Python is built with -DLARGE_FILES and this define is in Python.h(actually pyconfig.h included in Python.h.) Basically, since Python.h has these system level defines, Python.h should be included before any other include so that the defines are seen first before any other includes are processed. If you look at all of the Python source code, you will see that this is the case. In fact, most of the numpy source also does this and it probably is a know fact that it should be done. However, the following numpy source files do not include Python.h first or in some cases at all.
numpy/core/src/multiarray/methods.c
numpy/core/src/umath/test_rational.c.src
numpy/core/src/umath/operand_flag_test.c.src

The following don't have include Python.h at all and need to have for them to compile:
numpy/core/src/npysort/heapsort.c.src
numpy/core/src/npysort/quicksort.c.src
numpy/core/src/npysort/mergesort.c.src

Once I moved the #include Python.h to be the first include or added it if not there, numpy compiled.

Julian Taylor

can you create a patch or a pull request with the fixes?

Julian Taylor

we would need a patch if you still want this fixed for the next version, your description might be sufficient to fix it, but without a platform to test it its just guessing.

Ralf Gommers
Owner

Should be fixed for all three files in 661c4a5.

Julian Taylor

also added it to the 1.9.2 backport pr, so closing this issue, please reopen if the patch is incomplete

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.