-
Notifications
You must be signed in to change notification settings - Fork 344
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
configure does not set optimization flag in CXXFLAGS #406
Comments
|
You can add "--toolchain=hardened" to the configure command to get " -O2 -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2" added to the c++ flags. |
|
I think that this bug report really refers to how the packages are built, as it refers to mythbuntu ppa for fixes/31. I do agree that packages should be built optimized and if that is not done, it should be fixed. However, this proposal changes the compilation behavior for all interactive builds (./configure; make) and not (only) for package builds. |
Every distro has their own set of standards for CFLAGS/CXXFLAGS for building (some set/export the variables, some have config/build macros, some use the -specs option to gcc, whatever). It is up to the packagers for that distro to make sure that those standards are implemented, and if there are mistakes in the distros packaging, there should be tickets opened with that distro against the package. |
OK, the packaging optimization should be a separate bug. Ignore that part.
I disagree. If you build from source, I would expect some level of optimization (at least -O1, probably -O2) just from Klaas, it really sounds like you want to compile with Profile is supposed to be for, well, profiling. Does anyone actually profile the code? For profiling to give useful results, optimization must be enabled. https://gcc.gnu.org/onlinedocs/gcc/Optimize-Options.html |
|
On 14/12/2021 7:50 am, Scott Theisen wrote:
@kmdewaal <https://github.com/kmdewaal>
I think that this bug report really refers to how the packages are
built, as it refers to mythbuntu ppa for fixes/31. I do agree that
packages should be built optimized and if that is not done, it
should be fixed.
OK, the packaging optimization should be a separate bug. Ignore that part.
However, this proposal changes the compilation behavior for all
interactive builds (./configure; make) and not (only) for package
builds.
My expected behavior for interactive builds is that the default
--compile-type=profile has the default optimization -O0. It can be
an omission that this is not set in CXXFLAGS but then it should be
set to -O0 if it is to be set and not to -O2.
I disagree. If you build from source, I would expect some level of
optimization (at least -O1, probably -O2) just from |./configure|.
Klaas, it really sounds like you want to compile with
|--compile-type=debug|.
Profile is supposed to be for, well, profiling
<https://code.mythtv.org/doxygen/group__profiling__mythtv.html>. Does
anyone actually profile the code? For profiling to give useful
results, optimization must be enabled.
https://gcc.gnu.org/onlinedocs/gcc/Optimize-Options.html
Recommends |-Og| for debugging, not |-O0|.
Profiling is so that you can debug with many optimizations. -Og is
advisable. -O2 makes things more difficult. This is what I use for my
master production system as it gives good backtraces when problems occur.
…-O0 is plain old Debug but may not run as well or the same as an
optimized or semi optimized build.
Mark
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
<#406 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAOZ36AIS3QT4ST2TXBG7BLUQZMBNANCNFSM5HDHQVKQ>.
Triage notifications on the go with GitHub Mobile for iOS
<https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675>
or Android
<https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub>.
|
Summing this up, I think that should make the "./configure; make" use compilation flag -Og so that we do have both fast compilation time and good debug capability. |
Profiling is so you don't waste your time optimizing code that doesn't matter.
I disagree. I think On that note, the now trimmed pull request #430 would enable setting the optimization flag with |
According to the available usage statistics, only developers and a few advanced users compile/run from source. The vast majority use packages built by others for production, and every distro packager (to first approximation) uses the distros default compile flags (whatever they are). So, the only remaining issue is what do developers doing development/debugging need/want. The default should most likely be set for developers to do their debugging, as when developers compile for production, they are presumably capable of knowing how to set their compiler flags (or build their own packages for their own production). Those that run development codes in production likely are doing do knowingly for purposes of, well, development/debugging. |
My main concern is that some warning options only work at
That is fair enough. Perhaps the default compile type should be renamed to "development" and use |
|
Unless I misread the clang and Intel compiler documentation, |
|
@kmdewaal Would adding a new compile type named devel with This could be made the new default if the other developers agree. Thoughts, everyone? |
Platform: Xubuntu 21.04
Linux htpc 5.11.0-38-generic #42-Ubuntu SMP Fri Sep 24 14:03:54 UTC 2021 x86_64 x86_64 x86_64 GNU/LinuxMythTV version: master, fixes/31
Package version: mythbuntu ppa for fixes/31
Component: configure
What steps will reproduce the bug?
in mythtv/ run:
or look at config.mak instead of running make
for ppa: look at DWARF debugging info, note no
-Oflagreadelf -wi <binary> | grep DW_AT_producerHow often does it reproduce? Is there a required condition? always
What is the expected behaviour?
Optimization flag is set for c++ compilation.
Without any options,
-O2, maybe-O3, definitely at least-O1.NB:
CFLAGSincludes-O3What do you see instead?
No
-Oflag is set, so gcc uses its default of-O0, no optimizations are performed.Additional information
with
./configure --extra-cxxflags=-O1note-O1now inCXXFLAGSThe text was updated successfully, but these errors were encountered: