Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!

Bug 726112

Summary: qmake-utils.eclass: qmake ignores QMAKE_CXX, runs g++ directly
Product: Gentoo Linux Reporter: Sergei Trofimovich (RETIRED) <slyfox>
Component: EclassesAssignee: Qt Bug Alias <qt>
Status: CONFIRMED ---    
Severity: normal CC: alexey+gentoo, gentoo, johannes.geiss, kentnl, sam, tolgaucar44, whissi
Priority: Normal    
Version: unspecified   
Hardware: All   
OS: Linux   
URL: https://bugreports.qt.io/browse/QTBUG-66404
See Also: https://bugs.gentoo.org/show_bug.cgi?id=717680
Whiteboard:
Package list:
Runtime testing required: ---
Bug Depends on:    
Bug Blocks: 243502    

Description Sergei Trofimovich (RETIRED) gentoo-dev 2020-05-29 17:35:47 UTC
On a system with sys-devel/gcc-config[-native-symlinks] I see qmake-based packages fail to configure.

Small example is dev-util/xxdif:

"""
>>> Preparing source in /tmp/portage/dev-util/xxdiff-4.0.1_p20170622-r2/work/xxdiff-4.0.1_p20170622 ...
 * Applying xxdiff-4.0.1-no-throw-in-dtor.patch ...                                                                                                                                      [ ok ]
 * Applying xxdiff-4.0.1_p20170622-cxx11.patch ...                                                                                                                                       [ ok ]
>>> Source prepared.
/tmp/portage/dev-util/xxdiff-4.0.1_p20170622-r2/work/xxdiff-4.0.1_p20170622 /tmp/portage/dev-util/xxdiff-4.0.1_p20170622-r2/work/xxdiff-4.0.1_p20170622
[master baaf6d4] state after src_prepare()
 2 files changed, 1 insertion(+), 2 deletions(-)
/tmp/portage/dev-util/xxdiff-4.0.1_p20170622-r2/work/xxdiff-4.0.1_p20170622
>>> Configuring source in /tmp/portage/dev-util/xxdiff-4.0.1_p20170622-r2/work/xxdiff-4.0.1_p20170622 ...
 * Running qmake ...
Project ERROR: Cannot run compiler 'g++'. Output:
===================
===================
Maybe you forgot to setup the environment?
"""

I don't have g++ and it should not matter. Eclass tries to override it with QMAKE_CXX="$(tc-getCXX)", but qmake somehow ignores it.

AFAIU the error comes from qtcore's mkspecs/features/toolchain.pri. It tries to use $QMAKE_CXX consistently but something goes wrong there. Could be eclass problem?
Comment 1 Sergei Trofimovich (RETIRED) gentoo-dev 2020-05-29 17:41:32 UTC
If I understand qmake correctly minimal reproducer is:

"""
$ touch a.pro
$ qmake -makefile QMAKE_CXX=x86_64-pc-linux-gnu-g++ QMAKE_HOST_CXX=x86_64-pc-linux-gnu-g++
Project ERROR: Cannot run compiler 'g++'. Output:
===================
===================
Maybe you forgot to setup the environment?
"""
Comment 2 Davide Pesavento gentoo-dev 2020-05-29 17:53:13 UTC
(In reply to Sergei Trofimovich from comment #0)
> I don't have g++ and it should not matter. Eclass tries to override it with
> QMAKE_CXX="$(tc-getCXX)", but qmake somehow ignores it.

The override used to work a few Qt versions ago but upstream may have changed something that broke it without us noticing.
Comment 3 Davide Pesavento gentoo-dev 2020-05-29 17:57:22 UTC
(In reply to Sergei Trofimovich from comment #1)
> If I understand qmake correctly minimal reproducer is:
> 
> """
> $ touch a.pro
> $ qmake -makefile QMAKE_CXX=x86_64-pc-linux-gnu-g++
Just to be clear, we will not change qmake's default behavior outside of portage. It will still invoke g++ by default. Ebuilds that use eqmake5 should respect CXX however (and that's what this bug is about).
Comment 4 Sergei Trofimovich (RETIRED) gentoo-dev 2020-05-29 18:07:25 UTC
(In reply to Davide Pesavento from comment #3)
> (In reply to Sergei Trofimovich from comment #1)
> > If I understand qmake correctly minimal reproducer is:
> > 
> > """
> > $ touch a.pro
> > $ qmake -makefile QMAKE_CXX=x86_64-pc-linux-gnu-g++
> Just to be clear, we will not change qmake's default behavior outside of
> portage. It will still invoke g++ by default. Ebuilds that use eqmake5
> should respect CXX however (and that's what this bug is about).

Sounds perfect.
Comment 5 Kent Fredric (IRC: kent\n) (RETIRED) gentoo-dev 2020-06-23 14:31:09 UTC
Maybe backport this?: 

https://codereview.qt-project.org/c/qt/qtbase/+/255135/2/configure
Comment 6 Sergei Trofimovich (RETIRED) gentoo-dev 2020-06-27 22:45:36 UTC
I think the default comes from /usr/lib64/qt5/mkspecs/common/g++-base.conf:
    QMAKE_CXX               = $${CROSS_COMPILE}g++

If I change it manually qmak seems to accept new compiler. But I don't know how to pass CROSS_COMPILE directly. Environment variable or an argument to -makefile  does not seem to work.
Comment 7 Thomas Deutschmann (RETIRED) gentoo-dev 2020-07-08 16:01:00 UTC
*** Bug 731762 has been marked as a duplicate of this bug. ***
Comment 8 Ionen Wolkens gentoo-dev 2021-08-19 23:32:51 UTC
*** Bug 809116 has been marked as a duplicate of this bug. ***