Skip to content
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

Don't add -g0 to Pybind11Extension if $CFLAGS sets -g. #3436

Merged
merged 1 commit into from
Nov 8, 2021
Merged

Don't add -g0 to Pybind11Extension if $CFLAGS sets -g. #3436

merged 1 commit into from
Nov 8, 2021

Conversation

anntzer
Copy link
Contributor

@anntzer anntzer commented Nov 3, 2021

On Unix, setuptools prepends $CFLAGS and $CPPFLAGS to the compiler flags
(they always come before extra_compile_args and anything else; see
distutils.sysconfig.customize_compiler). In practice, the environment
variables are useful e.g. to quickly generate a debug build (e.g. by
setting CFLAGS=-g), but Pybind11Extension currently unconditionally
overwrites this with -g0.

Instead, check the environment variables and only insert -g0 if not
overridden by them.

Description

Suggested changelog entry:

Flags starting with ``-g`` in ``$CFLAGS`` and ``$CPPFLAGS`` are no longer overridden by ``.Pybind11Extension``.

pybind11/setup_helpers.py Outdated Show resolved Hide resolved
On Unix, setuptools prepends $CFLAGS and $CPPFLAGS to the compiler flags
(they always come before extra_compile_args and anything else; see
distutils.sysconfig.customize_compiler).  In practice, the environment
variables are useful e.g. to quickly generate a debug build (e.g. by
setting CFLAGS=-g), but Pybind11Extension currently unconditionally
overwrites this with -g0.

Instead, check the environment variables and only insert -g0 if not
overridden by them.
@henryiii henryiii merged commit b11ff91 into pybind:master Nov 8, 2021
@github-actions github-actions bot added the needs changelog Possibly needs a changelog entry label Nov 8, 2021
@anntzer anntzer deleted the g0cflags branch November 8, 2021 21:48
@henryiii henryiii removed the needs changelog Possibly needs a changelog entry label Dec 21, 2021
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