-
-
Notifications
You must be signed in to change notification settings - Fork 31.5k
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
Allow to pass custom CFLAGS and LDFLAGS to the compilation of builtin extension modules #131842
Comments
@erlend-aasland, isn't this already supported for individual modules with the *_CFLAGS and *_LIBS configure options? I don't know if we still have or did have a global options for all extension modules. |
Yes, this is already supported (and mostly documented IIRC). |
What we are missing is a global option for ALL extension modules. Also, Additionally, the individual flags aren't available for all modules, just a select few. |
Right, we do not have anything like that IIRC. Thanks for clarifying. |
…lation of builtin extension modules
…lation of builtin extension modules Signed-off-by: Pablo Galindo <[email protected]>
…lation of builtin extension modules Signed-off-by: Pablo Galindo <[email protected]>
…lation of builtin extension modules Signed-off-by: Pablo Galindo <[email protected]>
Small note x-posted from #131781 (comment): I checked and @ned-deily was right: as confusing as it is the The PR still applies as we are adding a global addition for all of them |
Correct, configure is not consequent regarding LIBS and LDFLAGS. That's worth a cleanup. |
One further point of confusion (to which I may have added in my comment above): AFAIK, the intent is that those *_CFLAGS and *_LIBS configure options are for each third-party library we use (not each extension module) and their values apply to every extension module that uses that library; there are some third-party libs that are linked to more than one stdlib extension module. If there are any third-party libs that aren't covered, that's a bug. |
…lation of builtin extension modules Signed-off-by: Pablo Galindo <[email protected]>
…lation of builtin extension modules Signed-off-by: Pablo Galindo <[email protected]>
…lation of builtin extension modules Signed-off-by: Pablo Galindo <[email protected]>
Thinking about this topic some more, especially after we've cleared up some initial confusion, it seems to me a key insight that the changes for 3.11+ made was to focus on the third-party libraries used by the various stdlib extension modules independently from the extension modules themselves, something we didn't really have previously. In general, we now have at least two ways to tailor compile and link details for each third-party library or package of libraries: one, using If so, is there anything missing? There aren't that many third-party libs that we use but I suppose you could argue that it may be tedious to add Beyond that can we identify any use cases where there is a need to supply additional information to stdlib extension modules builds that isn't related to third-party libs and isn't already covered by existing build options? If so, those would be more in the spirit of the original PR. If so and we deem both useful, maybe we need both kinds of options: ones that supply overridable defaults for (stdlib users of) the third-party libs and one that supplies options for all stdlib extension modules (whatever those options might be). In any case, it would be good to specify motivating use cases. As background, I've spent more than a dozen years on and off in this neck of Python's build system and every time I delve into it my brain ends up hurting. My observation is that every couple of years someone comes along with an issue in this area with the idea that it can be fixed by adding or deleting some new CFLAGS, CPPFLAGS, and/or LDFLAGS variables and, as a result, we accumulated a lot of cruft in configure and the makefile. I know I've been guilty of this myself. That's why I was very pleased to see the thoughtful design and work that @tiran and @erlend-aasland and others put into this a few years back by adopting newer, more standard configuration options, removing some of the cruft, and focusing on how we configure using the third-party libraries. I think we should be really careful that any changes we make in this area do not compromise this design. (I also think that, whatever if anything we decide to do here, that the topic of adding support for additional third-party libraries should be covered in the devguide and that documentation for the use of the existing options should be made more visible to builders of Python). Other thoughts? |
The global flags for extension modules are still needed because:
The per-library configuration remains valuable for specific needs, but global extension module flags would complement this by providing defaults that ensure consistent behavior while reducing maintenance overhead. |
@erlend-aasland what are your thoughts? |
This gives redistributors more control over the compilation flags of the extension modules. This allows among other things to pass custom RPATH/RUNPATH values that point to the correct PLATDIR
Check #131781 for the discussion and rationale of why we decided to allow this
Linked PRs
The text was updated successfully, but these errors were encountered: