Skip to content

AIX Support - Do not undef _XOPEN_SOURCE #12535

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
Teej42 opened this issue Oct 16, 2018 · 3 comments
Closed

AIX Support - Do not undef _XOPEN_SOURCE #12535

Teej42 opened this issue Oct 16, 2018 · 3 comments
Milestone

Comments

@Teej42
Copy link

Teej42 commented Oct 16, 2018

Bug report

The unsetting of _XOPEN_SOURCE is preventing compilation of matplotlib on AIX platforms, due to the use of _XOPEN_SOURCE to define the use of pthread_mutex_timedlock within /usr/include/pthread.h. We need to add a check for _AIX to disable this.

Code for reproduction

On an AIX server with relevant packages installed from AIX Toolbox website, install using command - pip install matplotlib==2.2.3

Actual outcome

/usr/bin/gcc -maix32 -D_LARGE_FILES -pthread -fno-strict-aliasing -D_GNU_SOURCE -fPIC -fno-strict-aliasing -fwrapv -D_LINUX_SOURCE_COMPAT -I/usr/include -I/opt/freeware/include -I/opt/freeware/include/ncurses -DNDEBUG -D_GNU_SOURCE -fPIC -fno-strict-aliasing -fwrapv -DFREETYPE_BUILD_TYPE=system -DPY_ARRAY_UNIQUE_SYMBOL=MPL_matplotlib_ft2font_ARRAY_API -DNPY_NO_DEPRECATED_API=NPY_1_7_API_VERSION -D__STDC_FORMAT_MACROS=1 -I/opt/freeware/lib/python2.7/site-packages/numpy/core/include -I/opt/freeware/lib/python2.7/site-packages/numpy/core/include -I/opt/freeware/include -I/opt/freeware/include/freetype2 -I/usr/local/include -I/usr/include -I. -I/opt/freeware/include/python2.7 -c src/ft2font_wrapper.cpp -o build/temp.aix-7.1-2.7/src/ft2font_wrapper.o
In file included from /opt/freeware/lib/gcc/powerpc-ibm-aix7.1.0.0/6.3.0/include/c++/powerpc-ibm-aix7.1.0.0/pthread/bits/gthr-default.h:30:0,
from /opt/freeware/lib/gcc/powerpc-ibm-aix7.1.0.0/6.3.0/include/c++/powerpc-ibm-aix7.1.0.0/pthread/bits/gthr.h:148,
from /opt/freeware/lib/gcc/powerpc-ibm-aix7.1.0.0/6.3.0/include/c++/ext/atomicity.h:35,
from /opt/freeware/lib/gcc/powerpc-ibm-aix7.1.0.0/6.3.0/include/c++/bits/basic_string.h:39,
from /opt/freeware/lib/gcc/powerpc-ibm-aix7.1.0.0/6.3.0/include/c++/string:52,
from /opt/freeware/lib/gcc/powerpc-ibm-aix7.1.0.0/6.3.0/include/c++/stdexcept:39,
from src/py_exceptions.h:7,
from src/ft2font_wrapper.cpp:4:
/opt/freeware/lib/gcc/powerpc-ibm-aix7.1.0.0/6.3.0/include/c++/powerpc-ibm-aix7.1.0.0/pthread/bits/gthr-posix.h:118:1: error: 'pthread_mutex_timedlock' was not declared in this scope
__gthrw(pthread_mutex_timedlock)
^
/opt/freeware/lib/gcc/powerpc-ibm-aix7.1.0.0/6.3.0/include/c++/powerpc-ibm-aix7.1.0.0/pthread/bits/gthr-posix.h: In function 'int __gthread_mutex_timedlock(__gthread_mutex_t*, const __gthread_time_t*)':
/opt/freeware/lib/gcc/powerpc-ibm-aix7.1.0.0/6.3.0/include/c++/powerpc-ibm-aix7.1.0.0/pthread/bits/gthr-posix.h:768:69: error: '__gthrw_pthread_mutex_timedlock' cannot be used as a function
return _gthrw(pthread_mutex_timedlock) (__mutex, __abs_timeout);
^
error: command '/usr/bin/gcc' failed with exit status 1

Expected outcome

Successful installation.

Matplotlib version

  • Operating system: AIX 7.1
  • Matplotlib version: 2.2.3
  • Python version: 2.7.15

More details here:

https://www.ibm.com/developerworks/community/forums/html/topic?id=b6fca107-76a3-4059-b27d-7bbbbaf804fb#repliesPg=0

@Teej42
Copy link
Author

Teej42 commented Oct 16, 2018

This also affects the GCC's isnan() declaration, also from the other forum:

Undefining _XOPEN_SOURCE takes out isnan from math.h
#if (_XOPEN_SOURCE<600) || defined(_ALL_SOURCE)
extern int isnan();
So the global declaration is gone and "using ::isnan" will not work.

@Teej42
Copy link
Author

Teej42 commented Oct 16, 2018

The code that will needs to be modified are:

$ grep -r "XOPEN_SOURCE" *
extern/ttconv/pprdrv_tt.cpp:#ifdef _XOPEN_SOURCE
extern/ttconv/pprdrv_tt.cpp:# undef _XOPEN_SOURCE
src/_png.cpp:# ifdef _XOPEN_SOURCE
src/_png.cpp:# undef _XOPEN_SOURCE
src/mplutils.h:#ifdef _XOPEN_SOURCE
src/mplutils.h:# undef _XOPEN_SOURCE
src/numpy_cpp.h:#ifdef _XOPEN_SOURCE
src/numpy_cpp.h:# undef _XOPEN_SOURCE

@tacaswell
Copy link
Member

Fixed by #12548 and backported via #12618

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants