-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
python PortGroup: require C11 with py313 packages due to atomics requirement, adjust a few subports #26830
base: master
Are you sure you want to change the base?
Conversation
Notifying maintainers: |
With atomics, looks like this is a general requirement. At least I kept getting the same error with a sequence of py313 ports now (whichever had compiled code), like:
etc. |
as python is needed to build clang, there is a potential for bootstrapping problems doing this. You'll have to check to make sure bootstrapping still can be done. |
@kencu This is not done for Python itself, Ken. It is in port group, and only for py313 ports. Does any Clang use py313 subports for bootstrap? |
Some clangs are building with python310, some with python311. They do use various python supports I notice. Usually -- if you require some functionality in the root (perl, python, R, etc) then you have to build the root with the enabled features (like atomics) and then the different modules the same way. It works like that with c+11 support, for example. Just a heads-up though -- when you require newer compiler features for ports that are used building the toolchain, bootstrapping loops can happen and need to be looked for. |
@kencu Could you maybe take a look at the commits first? There is no change to pythons whatsoever. There is no global change for any python packages prior to py313. Python313 port already sets C11: macports-ports/lang/python313/Portfile Line 58 in e7a4022
So again, could you please illustrate which potential problem can requiring C11 create? And how someone would end up building a py313-* port without C11 compiler and without python313 itself, which requires C11 compiler? :) |
My comment begins and ends with: When you change how python works, you have to look at bootstrapping and make sure you haven't broken it, as python is part of the clang bootstrapping process. The rest I leave to you, to make sure you're happy you haven't broken anything. |
I wonder about the C99 changes - that is a Python header, should that be handled in the python PortGroup instead? |
That would probably make life easier, since while not all python312 ports need that, seems quite a number of them do. |
@reneeotten Could you say what is the correct way to pass
Just setting |
I don't think I love the idea of explicitly passing |
This almost seems like something that needs a bit of support in base. Some kind of settings like Theoretically, it isn't necessary to code in all the knowledge about which each compiler defaults to, it could be tested with So maybe it should look more like This logic doesn't have to live in base, it's definitely something that could be tried out in the python portgroup at first, but I suspect that more and more ports will need changes like this to keep building on ancient OS/Xcode versions. |
Regarding implementation, I think this could be done in the python group with the following logic, generally speaking:
|
@tobypeterson In fact we can do it in a simple way, setting this flag only for |
@reneeotten @tobypeterson Could someone review this please? We need the fix. |
# python3.12/internal/pycore_frame.h:134: error: | ||
# ‘for’ loop initial declaration used outside C99 mode | ||
if {[string match *gcc-4.* ${configure.compiler}]} { | ||
python.add_cflags yes |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think this does anything, since add_cflags is checked earlier in this method.
Description
This does not change anything for Pythons themselves; this simply extends requirement for C11 from Python 3.13 to py313 packages, otherwise those fail to build, since Python 3.13 checks for C11 atomics and does not find it for old Xcode gcc.
@reneeotten I do not know how wide is c99 requirement for python312, it may be that many ports pass
-std=c99
anyway from upstream code, or it is a recent change, or I did not build affected ports earlier. Do you think this rather should also be done via PG?Since pythons 311+ themselves cannot be built with pre-C11 compilers anyway, it may also be okay just to require it for py312+ ports, though it is not a requirement with py312- ones, strictly speaking.
Type(s)
Tested on
macOS 10.6
Xcode 3.2
Verification
Have you
port lint
?sudo port test
?sudo port -vst install
?