Title: Fixed compile on cygwin.
Type: Stage: resolved
Components: Build, Installation, Interpreter Core Versions: Python 3.7
Status: closed Resolution:
Dependencies: Superseder:
Assigned To: Nosy List: Decorater, erik.bray, masamoto, vstinner
Priority: normal Keywords: patch

Created on 2017-03-04 03:49 by Decorater, last changed 2017-09-11 03:55 by Decorater. This issue is now closed.

File name Uploaded Description Edit
cygwin_build.patch Decorater, 2017-03-04 05:00 review
Pull Requests
URL Status Linked Edit
PR 447 closed Decorater, 2017-03-04 03:58
Messages (16)
msg288949 - (view) Author: Decorater (Decorater) * Date: 2017-03-04 03:49
Cygwin had an issue with building and installing python after it was configured. The main issue was the TLS key stuff which would make python fail to fully build or work correctly. This issue contains a patch for cygwin specifically to make it compile and work fully. It uses the __CYGWIN__ macro for separating the code from this patch with the TLS code on the other targets. This should help fix issues that was present in the standard library and in the repo for cygwin as well.
msg288954 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2017-03-04 05:01

@AraHaan: "By the way guys I will be working on cpython to work on some changes to a few things for cygwin to compile using the official cpython source code on 3.5, 3.6, and 3.7. (...)"

Cygwin is not currently officially supported by CPython (or am I wrong?), so changes should only be made in Python 3.7 (master branch). I'm neutral on supporting Cygwin. In the meanwhile, you can prepare a CPython fork, and then come back with atomic commits as PR? Since I expect many changes, you may also discuss Cygwin support on python-dev.

What is the current status of the Cygwin support? Is it possible to build Python using Cygwin? How many tests fail?

To have an official support, we need an assigned developer and a buildbot:
msg288955 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2017-03-04 05:05
+/* Define if pthread_key_t is compatible with int. */

Is this change the implementation of the issue #25658?
msg288956 - (view) Author: Decorater (Decorater) * Date: 2017-03-04 05:12
Yes, it is because of the fact in Cygwin it will cause an compile Error when ints are involved forcing other methods to be put in place.
msg288957 - (view) Author: Decorater (Decorater) * Date: 2017-03-04 05:13
For now I stuck it under cygwin only but it could easily move out to not only cygwin if desired.
msg288958 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2017-03-04 05:14
Please explain why you want to support Cygwin. Which Cygwin and Windows versions are you targetingW
msg288961 - (view) Author: Decorater (Decorater) * Date: 2017-03-04 05:21
I use cygwin to test things that I write in python to see if they work under linux without having to boot up into an linux VM to find out as it would be too slow to even do that with the computer I have. And besides cygwin makes all of this faster. The version of Cygwin I have is 2.877 (64 bit).

Long story short this thing for a 64 bit computer is limited to only 2 CPU cores and 4 GB's of memory right now. All of that plays into why an VM would be too slow to even run or compile python (it would take forever to even open up the terminal).
msg288968 - (view) Author: Decorater (Decorater) * Date: 2017-03-04 06:46
Well then I am thinking about figuring out how to make an batch file under tools/buildbot to target cygwin building in windows. tbh windows 7 or newer on cygwin is fine with me. It is just that I need to figure out how to make it invoke Cygwin.bat and yet also somehow input everything it needs to the cygwin console for building and testing python.

Feel free to let me know if anyone has an idea on this.
msg288969 - (view) Author: Decorater (Decorater) * Date: 2017-03-04 06:48
Also I just realized my Cygwin updated to 2.7.0 as well.
msg288975 - (view) Author: Masayuki Yamamoto (masamoto) * Date: 2017-03-04 10:52
The patch can split to several issues, moreover, some issues are able to pick up as general not Cygwin specific. Perhaps, it will be an opportunity to fix even if Cygwin specific, if we could explain the implicit issue on implementation. See #4032, #25658, #25720, #27374, #28441 and #28459. Of course your patch has solutions for issues that are not yet known in the bug tracker.
msg288982 - (view) Author: Decorater (Decorater) * Date: 2017-03-04 15:52
hmm maybe if TSS is available on all platforms maybe python could use that instead of TLS so that way I would not have to have a lot of __CYGWIN__'s all over the place. However I am not sure if all of the OS's that are on the buildbot for python supports TSS. hmm
msg288983 - (view) Author: Decorater (Decorater) * Date: 2017-03-04 15:54
And yeah that is why I stuck most of the changes in here under __CYGWIN__ macros for now until I know otherwise that all of the changes will not break other platforms.
msg289008 - (view) Author: Masayuki Yamamoto (masamoto) * Date: 2017-03-05 11:47
We should avoid to submit quickfix to official as much as we can. Especially the case of unofficial (or inarticulate) support platform, a patch for specific platform is probably rejected because the code won't be maintained.

Thread Specific Storage API (TSS) has been designed to work on more platforms, but it has incompatible changing and the API merging needs official acceptance for the PEP 539. (Please wait PEP author, or you can discuss for the new API or alternatives, see #25658 for details)
msg289012 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2017-03-05 14:32
Please remove TSS from the Cygwin patch in that case.
msg291969 - (view) Author: Erik Bray (erik.bray) * (Python triager) Date: 2017-04-20 12:37
This seems to be fixing a number of different Cygwin issues, many of which are known (some of these patches come from the Cygwin port of Python).  However, some of these issues are already being handled separately, such as #25658, and I think rather than one big mongo patch it wold be good to break this up into individual issues.

I was also just planning to submit some individual patches for review.
msg301855 - (view) Author: Decorater (Decorater) * Date: 2017-09-11 03:55
Closing this in favor of
Date User Action Args
2017-09-11 03:55:14Decoratersetstatus: open -> closed

messages: + msg301855
stage: resolved
2017-04-20 12:37:17erik.braysetnosy: + erik.bray
messages: + msg291969
2017-03-05 14:32:36vstinnersetmessages: + msg289012
2017-03-05 11:47:17masamotosetmessages: + msg289008
2017-03-04 15:54:33Decoratersetmessages: + msg288983
2017-03-04 15:52:47Decoratersetmessages: + msg288982
2017-03-04 10:52:59masamotosetnosy: + masamoto
messages: + msg288975
2017-03-04 06:48:18Decoratersetmessages: + msg288969
2017-03-04 06:46:07Decoratersetmessages: + msg288968
2017-03-04 05:21:11Decoratersetmessages: + msg288961
2017-03-04 05:14:23vstinnersetmessages: + msg288958
2017-03-04 05:13:48Decoratersetmessages: + msg288957
2017-03-04 05:12:44Decoratersetmessages: + msg288956
2017-03-04 05:05:24vstinnersetmessages: + msg288955
2017-03-04 05:01:21vstinnersetnosy: + vstinner
messages: + msg288954
2017-03-04 05:00:52Decoratersetfiles: - cygwin_build.patch
2017-03-04 05:00:05Decoratersetfiles: + cygwin_build.patch
2017-03-04 03:58:48Decoratersetpull_requests: + pull_request373
2017-03-04 03:50:18Decoratersetfiles: + cygwin_build.patch
keywords: + patch
2017-03-04 03:49:42Decoratercreate