Skip to content

Python 3.8+ issue with #undef _POSIX_THREADS #105

@he-hesce

Description

@he-hesce

Compiling code using PythonQt release 3.4.1 on Rocky Linux 9.2 with Python 3.9 gives the following compile error:

/usr/include/python3.9/pythread.h:136:5: error: #error "Require native threads. See https://bugs.python.org/issue31370"
  136 | #   error "Require native threads. See https://bugs.python.org/issue31370"
      |     ^~~~~
/usr/include/python3.9/pythread.h:145:5: error: ‘NATIVE_TSS_KEY_T’ does not name a type
  145 |     NATIVE_TSS_KEY_T _key;
      |     ^~~~~~~~~~~~~~~~

By commenting out the #undef of _POSIX_THREADS (hence keeping _POSIX_THREADS defined) in src/PythonQtPythonInclude.h it builds and works fine.

$ cat /etc/redhat-release 
Rocky Linux release 9.2 (Blue Onyx)

$ python --version
Python 3.9.16

$ qmake --version
QMake version 3.1
Using Qt version 5.15.3 in /usr/lib64

$ gcc --version
gcc (GCC) 11.3.1 20221121 (Red Hat 11.3.1-4)

Otherwise release 3.4.1 is working fine (without bespoke fixes/patches) for me now on CentOS 7 (Python 2.7), Rocky 8 (Python 3.6), Rocky 9 (Python 3.9), Ubuntu 20.04 LTS (Python 3.8), and Ubuntu 22.04 LTS (Python 3.10).

Only Python 3.8+ builds are affected by the _POSIX_THREADS issue so that also includes Ubuntu 22.04 LTS (Python 3.10) and Ubuntu 20.04 LTS (Python 3.8) in addition to Rocky 9 (Python 3.9). On all three platforms, not undefining _POSIX_THREADS solves the issue.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions