diff mbox series

[1/1] package/qt5: remove optimize by default on debug builds made with qmake

Message ID 20200107123209.6608-2-mehmetsamitok@gmail.com
State Rejected
Headers show
Series remove optimize by default while using qmake | expand

Commit Message

Mehmet Sami Tok Jan. 7, 2020, 12:32 p.m. UTC
Signed-off-by: Mehmet Sami Tok <mehmetsamitok@gmail.com>
---
 package/qt5/qt5base/qt5base.mk | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

Comments

Thomas Petazzoni Aug. 5, 2021, 8:03 p.m. UTC | #1
Hello Mehmet,

On Tue,  7 Jan 2020 15:32:09 +0300
Mehmet Sami Tok <mehmetsamitok@gmail.com> wrote:

> diff --git a/package/qt5/qt5base/qt5base.mk b/package/qt5/qt5base/qt5base.mk
> index 774c771bc9..3415172fcb 100644
> --- a/package/qt5/qt5base/qt5base.mk
> +++ b/package/qt5/qt5base/qt5base.mk
> @@ -34,8 +34,12 @@ ifeq ($(BR2_PACKAGE_QT5_VERSION_LATEST),y)
>  QT5BASE_CONFIGURE_OPTS += -no-optimize-debug
>  endif
>  
> -QT5BASE_CFLAGS = $(TARGET_CFLAGS)
> -QT5BASE_CXXFLAGS = $(TARGET_CXXFLAGS)
> +# Passing optimization flags directly to CFLAGS or CXXFLAGS makes qmake
> +# builds optimized by default. Decision of optimization while developing
> +# with qmake should be leaved to configuration of the project.
> +FILTERED_ITEMS = -O%
> +QT5BASE_CFLAGS = $(filter-out $(FILTERED_ITEMS),$(TARGET_CFLAGS))
> +QT5BASE_CXXFLAGS = $(filter-out $(FILTERED_ITEMS),$(TARGET_CXXFLAGS))

Thanks for your patch, and sorry for the long delay in providing
feedback to you and your patch. However, what the code currently does
it what we want: we want the optimization level defined at the
Buildroot configuration level to apply to all packages. We certainly do
not want individual packages to pick and chose their own optimization
level. So basically, your proposal unfortunately goes against the
very principle of Buildroot. For this reason, I'm afraid we have to
reject your patch.

Best regards,

Thomas Petazzoni
Mehmet Sami Tok Aug. 6, 2021, 11:39 a.m. UTC | #2
Hi Thomas,
Thanks for the response. This is an old patch and I don't know if the
problem is still there. But the main point of this patch was not changing
flags of Qt package build.
When you want to use gcc toolchain and qmake generated by buildroot, It was
affecting your application builds. These flags directly passed to qt
toolchain and even if you want to build a debug build of any application,
it is built with -o2. So the problem is not occuring when root file system
is created, it appears when you want to build something else with toolchain
generated by buildroot.

Best Regards,
Mehmet Sami Tok

Thomas Petazzoni <thomas.petazzoni@bootlin.com>, 5 Ağu 2021 Per, 23:03
tarihinde şunu yazdı:

> Hello Mehmet,
>
> On Tue,  7 Jan 2020 15:32:09 +0300
> Mehmet Sami Tok <mehmetsamitok@gmail.com> wrote:
>
> > diff --git a/package/qt5/qt5base/qt5base.mk b/package/qt5/qt5base/
> qt5base.mk
> > index 774c771bc9..3415172fcb 100644
> > --- a/package/qt5/qt5base/qt5base.mk
> > +++ b/package/qt5/qt5base/qt5base.mk
> > @@ -34,8 +34,12 @@ ifeq ($(BR2_PACKAGE_QT5_VERSION_LATEST),y)
> >  QT5BASE_CONFIGURE_OPTS += -no-optimize-debug
> >  endif
> >
> > -QT5BASE_CFLAGS = $(TARGET_CFLAGS)
> > -QT5BASE_CXXFLAGS = $(TARGET_CXXFLAGS)
> > +# Passing optimization flags directly to CFLAGS or CXXFLAGS makes qmake
> > +# builds optimized by default. Decision of optimization while developing
> > +# with qmake should be leaved to configuration of the project.
> > +FILTERED_ITEMS = -O%
> > +QT5BASE_CFLAGS = $(filter-out $(FILTERED_ITEMS),$(TARGET_CFLAGS))
> > +QT5BASE_CXXFLAGS = $(filter-out $(FILTERED_ITEMS),$(TARGET_CXXFLAGS))
>
> Thanks for your patch, and sorry for the long delay in providing
> feedback to you and your patch. However, what the code currently does
> it what we want: we want the optimization level defined at the
> Buildroot configuration level to apply to all packages. We certainly do
> not want individual packages to pick and chose their own optimization
> level. So basically, your proposal unfortunately goes against the
> very principle of Buildroot. For this reason, I'm afraid we have to
> reject your patch.
>
> Best regards,
>
> Thomas Petazzoni
> --
> Thomas Petazzoni, co-owner and CEO, Bootlin
> Embedded Linux and Kernel engineering
> https://bootlin.com
>
Thomas Petazzoni Aug. 6, 2021, 12:47 p.m. UTC | #3
Hello Mehmet,

On Fri, 6 Aug 2021 14:39:07 +0300
Mehmet Sami Tok <mehmetsamitok@gmail.com> wrote:

> Thanks for the response. This is an old patch and I don't know if the
> problem is still there. But the main point of this patch was not changing
> flags of Qt package build.
> When you want to use gcc toolchain and qmake generated by buildroot, It was
> affecting your application builds. These flags directly passed to qt
> toolchain and even if you want to build a debug build of any application,
> it is built with -o2. So the problem is not occuring when root file system
> is created, it appears when you want to build something else with toolchain
> generated by buildroot.

I see. Indeed in this case we might consider that we should obey to the
particular flags you specify rather than the ones from the Buildroot
configuration.

However, unless I misread your patch, it removed optimization flags
even for qmake packages built within Buildroot, which is not what we
want.

Best regards,

Thomas
diff mbox series

Patch

diff --git a/package/qt5/qt5base/qt5base.mk b/package/qt5/qt5base/qt5base.mk
index 774c771bc9..3415172fcb 100644
--- a/package/qt5/qt5base/qt5base.mk
+++ b/package/qt5/qt5base/qt5base.mk
@@ -34,8 +34,12 @@  ifeq ($(BR2_PACKAGE_QT5_VERSION_LATEST),y)
 QT5BASE_CONFIGURE_OPTS += -no-optimize-debug
 endif
 
-QT5BASE_CFLAGS = $(TARGET_CFLAGS)
-QT5BASE_CXXFLAGS = $(TARGET_CXXFLAGS)
+# Passing optimization flags directly to CFLAGS or CXXFLAGS makes qmake
+# builds optimized by default. Decision of optimization while developing
+# with qmake should be leaved to configuration of the project.
+FILTERED_ITEMS = -O%
+QT5BASE_CFLAGS = $(filter-out $(FILTERED_ITEMS),$(TARGET_CFLAGS))
+QT5BASE_CXXFLAGS = $(filter-out $(FILTERED_ITEMS),$(TARGET_CXXFLAGS))
 
 ifeq ($(BR2_TOOLCHAIN_HAS_GCC_BUG_90620),y)
 QT5BASE_CFLAGS += -O0