Skip to content

gh-131842: Allow to pass custom CFLAGS and LDFLAGS to the compilation of builtin extension modules#131847

Open
pablogsal wants to merge 1 commit intopython:mainfrom
pablogsal:configldflags
Open

gh-131842: Allow to pass custom CFLAGS and LDFLAGS to the compilation of builtin extension modules#131847
pablogsal wants to merge 1 commit intopython:mainfrom
pablogsal:configldflags

Conversation

@pablogsal
Copy link
Copy Markdown
Member

@pablogsal pablogsal commented Mar 28, 2025

Comment thread Doc/using/configure.rst Outdated
Comment thread Doc/using/configure.rst Outdated
@pablogsal
Copy link
Copy Markdown
Member Author

Does someone has a better name for this flags? I don't like that we have PY_STDMODULE_CFLAGS and PY_STDMODULE_CFLAGS

@pablogsal pablogsal force-pushed the configldflags branch 2 times, most recently from 0cc69ae to f936956 Compare March 28, 2025 15:07
Comment thread Doc/using/configure.rst Outdated
Comment thread Doc/using/configure.rst Outdated
Comment thread Doc/using/configure.rst
Comment thread Doc/using/configure.rst
Comment thread Doc/using/configure.rst Outdated
Comment thread Doc/whatsnew/3.13.rst Outdated
@pablogsal
Copy link
Copy Markdown
Member Author

I live in the past. I need to move all of this to 3.14 🤦

@vstinner
Copy link
Copy Markdown
Member

You should add "needs backport to 3.13" label if you want to add this feature to Python 3.13.

@ned-deily
Copy link
Copy Markdown
Member

ned-deily commented Mar 28, 2025

A terminology question: builtin (or built-in) is used elsewhere to mean linked statically with the interpreter / python library, like here. The intent for this PR is to apply to all standard library extension modules, static and dynamically loaded, right? If so, we should find another word for the variables and descriptions.

@pablogsal
Copy link
Copy Markdown
Member Author

pablogsal commented Mar 28, 2025

A terminology question: builtin (or built-in) is used elsewhere to mean linked statically with the interpreter / python library, like here. The intent for this PR is to apply to all standard library extension modules, static and dynamically loaded, right? If so, we should find another word for the variables and descriptions.

Agreed. See #131847 (comment)

Any ideas of a better name?

@vstinner
Copy link
Copy Markdown
Member

Any ideas of a better name?

I suggest to reuse the "extra" term: PY_EXTRA_STDMODULE_CFLAGS and PY_EXTRA_STDMODULE_LDFLAGS.

@pablogsal pablogsal force-pushed the configldflags branch 2 times, most recently from 4c459a4 to 2f61043 Compare March 28, 2025 16:44
…lation of builtin extension modules

Signed-off-by: Pablo Galindo <pablogsal@gmail.com>
@ned-deily
Copy link
Copy Markdown
Member

I think this PR warrants more discussion. See my comment on the issue.

@pablogsal
Copy link
Copy Markdown
Member Author

Ok I answered in the issue let's move the discussion there #131842 (comment)

@python-cla-bot
Copy link
Copy Markdown

python-cla-bot Bot commented Apr 6, 2025

All commit authors signed the Contributor License Agreement.

CLA signed

Copy link
Copy Markdown
Contributor

@erlend-aasland erlend-aasland left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Currently, we use PY_STDMODULE_CFLAGS for shared extension modules and PY_BUILTIN_MODULE_CFLAGS for built-in extension modules. This PR is slightly confusing, since it adds extra {C,LD}FLAGS for built-in extension modules using naming similar to what we use for shared extension modules.

I think we should follow the existing naming scheme, and I also think we should consider introduce variables for both shared and built-in modules. Alternatively, we could use a more neutral name (for example PY_EXTRA_MODULE_*FLAGS) and apply those to both shared and built-in extension modules.

Comment thread Doc/using/configure.rst

.. envvar:: PY_EXTRA_STDMODULE_LDFLAGS

Equivalent flag to :envvar:`LDLAGS_NODIST` but it only applies to **all** builtin extension
Copy link
Copy Markdown
Contributor

@erlend-aasland erlend-aasland Sep 21, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
Equivalent flag to :envvar:`LDLAGS_NODIST` but it only applies to **all** builtin extension
Equivalent flag to :envvar:`LDFLAGS_NODIST` but it only applies to **all** builtin extension

Comment thread Doc/whatsnew/3.14.rst
with :c:expr:`Py_NO_LINK_LIB`. (Contributed by Jean-Christophe
Fillion-Robin in :gh:`82909`.)

* Two new configure flags are added: :envvar:`CFLAGS_BUILTIN_MODULE` and
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
* Two new configure flags are added: :envvar:`CFLAGS_BUILTIN_MODULE` and
* Two new configure flags are added: :envvar:`PY_EXTRA_STDMODULE_CFLAGS` and

Comment thread Doc/whatsnew/3.14.rst
Fillion-Robin in :gh:`82909`.)

* Two new configure flags are added: :envvar:`CFLAGS_BUILTIN_MODULE` and
:envvar:`LDFLAGS_BUILTIN_MODULE`. These flags allows refistributors to
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
:envvar:`LDFLAGS_BUILTIN_MODULE`. These flags allows refistributors to
:envvar:`PY_EXTRA_STDMODULE_LDFLAGS`. These flags allows refistributors to

@github-actions
Copy link
Copy Markdown

This PR is stale because it has been open for 30 days with no activity.

@github-actions github-actions Bot added the stale Stale PR or inactive for long period of time. label Apr 23, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

awaiting core review stale Stale PR or inactive for long period of time.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants