pythoncgccclangpycparser

Clang + pycparser fail to parse pythread.h header from CPython 3.7


Clang + pycparser fail to parse pythread.h header from CPython 3.7, but this was working in CPython 3.7-dev in Travis CI.

opt/python/3.7.0/include/python3.7m/pythread.h:122:5: error: "Require native
      threads. See https://bugs.python.org/issue31370"
#   error "Require native threads. See https://bugs.python.org/issue31370"

It is not obvious whether I should try gcc instead of clang, pass specific threading flags to compiler or extend pycparser with additional "faked" libc headers due to code not compliant with C99?

More details in this issue:

https://github.com/pythonnet/pythonnet/issues/609#issuecomment-412959577


Solution

  • This is now fixed, like Eli B. suggested it was a missing #define to the compiler:

    https://github.com/pythonnet/pythonnet/blob/py37/tools/geninterop/geninterop.py#L177

    "-D _POSIX_THREADS"