gh-131865: Properly apply exported CFLAGS for dtrace/systemtap builds#131866
gh-131865: Properly apply exported CFLAGS for dtrace/systemtap builds#131866vstinner merged 3 commits intopython:mainfrom
Conversation
…builds When using --with-dtrace the resulting object file could be missing specific CFLAGS exported by the build system due to the systemtap script using specific defaults. Exporting the CC and CFLAGS variables before the dtrace invocation allows us to properly apply CFLAGS exported by the build system even when cross-compiling. The fix does not affect the dtrace invocation on Solaris/Oracle/MacOS
|
Unfortunately there are no buildbots testing --with-dtrace and dtrace itself is in a sort of half broken state as far as its functionality is concerned. However it is still an issue whenever someone uses --with-dtrace. I have verified through the Fedora build infrastructure that the fix works. Also this should not affect the dtrace builds when the actual dtrace tool is used in Solaris/Oracle/MacOS. A news entry is not required here I believe. |
There was a problem hiding this comment.
LGTM. The change works as expected.
Without this PR, make Include/pydtrace_probes.h SHELL="bash -x" prints:
+ /usr/bin/mkdir -p Include
+ /usr/bin/dtrace -o Include/pydtrace_probes.h -h -s Include/pydtrace.d
With this PR, it prints:
+ /usr/bin/mkdir -p Include
+ CC=gcc
+ CFLAGS=
+ /usr/bin/dtrace -o Include/pydtrace_probes.h -h -s Include/pydtrace.d
CFLAGS is passed as expected. Example:
$ CFLAGS="-O2" make Include/pydtrace_probes.h SHELL="bash -x"
(...)
/usr/bin/mkdir -p Include
CC="gcc" CFLAGS="-O2" /usr/bin/dtrace -o Include/pydtrace_probes.h -h -s Include/pydtrace.d
(...)
+ /usr/bin/mkdir -p Include
+ CC=gcc
+ CFLAGS=-O2
+ /usr/bin/dtrace -o Include/pydtrace_probes.h -h -s Include/pydtrace.d
Note: tests done with ./configure --with-pydebug --with-dtrace.
It might be interesting to add a NEWS entry. |
For example, add a NEWS entry in the "Build" category: "DTrace build now pass properly CC and CFLAGS variables to the dtrace command." You can use the blurb tool for that. |
|
Added a NEWS entry |
Misc/NEWS.d/next/Build/2025-03-31-19-22-41.gh-issue-131865.PIJy7X.rst
Outdated
Show resolved
Hide resolved
|
Thanks @stratakis for the PR, and @vstinner for merging it 🌮🎉.. I'm working now to backport this PR to: 3.13. |
…builds (pythonGH-131866) When using --with-dtrace the resulting object file could be missing specific CFLAGS exported by the build system due to the systemtap script using specific defaults. Exporting the CC and CFLAGS variables before the dtrace invocation allows us to properly apply CFLAGS exported by the build system even when cross-compiling. The fix does not affect the dtrace invocation on Solaris/macOS. (cherry picked from commit 0cd4bef) Co-authored-by: stratakis <cstratak@redhat.com>
|
GH-131950 is a backport of this pull request to the 3.13 branch. |
|
Would it be possible to backport it on 3.12 as well? |
… builds (GH-131866) (#131950) gh-131865: Properly apply exported CFLAGS for dtrace/systemtap builds (GH-131866) When using --with-dtrace the resulting object file could be missing specific CFLAGS exported by the build system due to the systemtap script using specific defaults. Exporting the CC and CFLAGS variables before the dtrace invocation allows us to properly apply CFLAGS exported by the build system even when cross-compiling. The fix does not affect the dtrace invocation on Solaris/macOS. (cherry picked from commit 0cd4bef) Co-authored-by: stratakis <cstratak@redhat.com>
|
Thanks @stratakis for the PR, and @vstinner for merging it 🌮🎉.. I'm working now to backport this PR to: 3.12. |
…builds (pythonGH-131866) When using --with-dtrace the resulting object file could be missing specific CFLAGS exported by the build system due to the systemtap script using specific defaults. Exporting the CC and CFLAGS variables before the dtrace invocation allows us to properly apply CFLAGS exported by the build system even when cross-compiling. The fix does not affect the dtrace invocation on Solaris/macOS. (cherry picked from commit 0cd4bef) Co-authored-by: stratakis <cstratak@redhat.com>
|
GH-131951 is a backport of this pull request to the 3.12 branch. |
|
Merged, thank you for your fix.
Done. I was awaiting to see if the 3.13 backport goes well first. |
… builds (GH-131866) (#131951) gh-131865: Properly apply exported CFLAGS for dtrace/systemtap builds (GH-131866) When using --with-dtrace the resulting object file could be missing specific CFLAGS exported by the build system due to the systemtap script using specific defaults. Exporting the CC and CFLAGS variables before the dtrace invocation allows us to properly apply CFLAGS exported by the build system even when cross-compiling. The fix does not affect the dtrace invocation on Solaris/macOS. (cherry picked from commit 0cd4bef) Co-authored-by: stratakis <cstratak@redhat.com>
|
Thanks for merging! |
When using --with-dtrace the resulting object file could be missing specific CFLAGS exported by the build system due to the systemtap script using specific defaults.
Exporting the CC and CFLAGS variables before the dtrace invocation allows us to properly apply CFLAGS exported by the build system even when cross-compiling.
The fix does not affect dtrace invocation on Solaris/Oracle/MacOS