Skip to content

Revert undefining some defines #103

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

Merged
merged 1 commit into from
Jul 8, 2023

Conversation

mrbean-bremen
Copy link
Contributor

@mrbean-bremen mrbean-bremen commented May 24, 2023

The reverted code undefines _POSIX_THREADS (and a couple of other defines), which are queried in PythonQt.h.
If it is not set on a POSIX system, we get the error:
Require native threads. See https://bugs.python.org/issue31370

As far as I can see, none of these defines comes from python.h, at least not in current versions of Python.

@mrbean-bremen
Copy link
Contributor Author

@iakov - please have a look.

@iakov
Copy link
Contributor

iakov commented May 24, 2023

No objections. Next time I'll add the exact test to CI or an explanation into the code comment. This maybe the case with some mingw, however I have no chance to check until the weekend.

But what Python version with what compiler produces the error in question? Maybe you can add the config to the CI (or just change/substitute the existing one)?

@mrbean-bremen
Copy link
Contributor Author

mrbean-bremen commented May 25, 2023

But what Python version with what compiler produces the error in question?

This happened in user code that included PythonQt.h right at the top of the file. It happened under gcc9, gcc11 and clang, with Python 3.9 and 3.11 (basically all tested POSIX systems).

I just noticed that I wrote in the summary about pthread.h instead of PythonQt.h - just corrected that. pythread.h is where the error originates.

- this has been introduced in MeVisLab#89 and breaks builds including "pythread.h"
@mrbean-bremen mrbean-bremen merged commit 30ca585 into MeVisLab:master Jul 8, 2023
@mrbean-bremen mrbean-bremen deleted the revert_undefs branch July 8, 2023 07:14
@he-hesce
Copy link
Contributor

he-hesce commented Jul 9, 2023

@mrbean-bremen: Though it could be that even if _POSIX_THREADS caused issues, it could be that undefining _POSIX_C_SOURCE and _XOPEN_SOURCE was beneficial (at least in cutting down compilation warning noise) as now there is a massive amount of redefinition warnings that pyconfig-64.h is redefining these two originally defined in features.h. Undeffing them also seems to be okay as it doesn't break anything it seems. Code compiles and runs fine. It was only the undeffing of _POSIX_THREADS which caused compilation issues.

@mrbean-bremen
Copy link
Contributor Author

Ok, thanks - seem to have thrown out the baby with the bathwater...
I'll check this later, and maybe just move the release tag after correcting it.

@he-hesce
Copy link
Contributor

he-hesce commented Jul 9, 2023

@mrbean-bremen : Sounds okay.

mrbean-bremen added a commit that referenced this pull request Jul 9, 2023
- only undefining _POSIX_THREADS had be a problem
- see #103
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

Successfully merging this pull request may close these issues.

3 participants