Bug 231963

Summary: x11-toolkits/qt5-quick: fix build with GCC-based architectures
Product: Ports & Packages Reporter: Piotr Kubaj <pkubaj>
Component: Individual Port(s)Assignee: freebsd-kde (group) <kde>
Status: Closed FIXED    
Severity: Affects Only Me CC: linimon, pkubaj, tcberner
Priority: --- Flags: tcberner: maintainer-feedback+
Version: Latest   
Hardware: Any   
OS: Any   
Bug Depends on: 231542    
Bug Blocks: 231584, 231667, 231676, 231677, 231680, 231681, 231684, 231685, 231818, 231819, 231830, 231860, 231861, 231891, 231892, 231901, 231903, 231904, 231905, 231955, 231956, 231957, 231958, 231960, 231966    
Attachments:
Description Flags
patch
none
build log from powerpc64
none
big patch none

Description Piotr Kubaj freebsd_committer freebsd_triage 2018-10-04 23:21:09 UTC
Created attachment 197800 [details]
patch

compiler:c++17-lang, usual treatment.

Tested on powerpc64 and amd64.

Hardware sponsored by IntegriCloud.
Comment 1 Tobias C. Berner freebsd_committer freebsd_triage 2018-10-05 06:17:48 UTC
Have you ever checked why these need c++17 and not 11?


Mfg Tobias
Comment 2 Piotr Kubaj freebsd_committer freebsd_triage 2018-10-05 10:20:53 UTC
(In reply to Tobias C. Berner from comment #1)
They require it, because Qt's build system adds -std=c++1z to compilation flags. I didn't push it further, if it says it needs c++1z (which is C++17), then so be it.
Comment 3 Tobias C. Berner freebsd_committer freebsd_triage 2018-10-05 18:14:11 UTC
Hm, interesting, I was under the impression that it only requires c++11.

I'll do some investigating, and then commit the bunch...

Mfg Tobias
Comment 4 Tobias C. Berner freebsd_committer freebsd_triage 2018-10-06 19:31:39 UTC
I think this does not address the right issue -- it should not require anything higher than c++11 to build Qt5. So something probably goes wrong in the configure script, which is what we need to fix. 

mfg Tobias
Comment 5 Piotr Kubaj freebsd_committer freebsd_triage 2018-10-06 21:00:23 UTC
Created attachment 197852 [details]
build log from powerpc64

For reference, I'm attaching a build log which clearly shows added -std=c++1z.
Comment 6 Tobias C. Berner freebsd_committer freebsd_triage 2018-10-06 21:16:44 UTC
I'm not doubting it adds it. 

The problem is it adds it, because you build it with a compiler that supports it (I think [tm]). But that should not "force" c++17 on the rest of the builders. 

We need to see how to tell qmake to ignore the spec, and only use c++11, when building the qt5-* ports.


mfg Tobias
Comment 7 Tobias C. Berner freebsd_committer freebsd_triage 2018-10-06 21:18:36 UTC
As the build already pulls in the right gcc, I think it should be save to just set USES=c++11-lang. 

Could you test?
Comment 8 Piotr Kubaj freebsd_committer freebsd_triage 2018-10-06 21:28:47 UTC
(In reply to Tobias C. Berner from comment #7)
Yes, it works. You can just as well put c++11-lang. It works the same in that it forces GCC 7, but in the present state, it's a lie (the port uses C++17).
Comment 9 Tobias C. Berner freebsd_committer freebsd_triage 2018-10-06 22:00:02 UTC
(In reply to Piotr Kubaj from comment #8)
I would prefer if the "forcing" is done explicitely in the change to qt-dist.mk/qt5-qmake by depending on a specific [possibly configurable] version of gcc -- not via USES=compiler.
Comment 10 Piotr Kubaj freebsd_committer freebsd_triage 2018-10-06 22:16:29 UTC
(In reply to Tobias C. Berner from comment #9)
Using USES has the advantage that we get newer GCC when the default version in ports is changed.

Anyway, do you suggest we add our own BUILD_DEPENDS and LIB_DEPENDS entries for newer GCC?
Comment 11 Tobias C. Berner freebsd_committer freebsd_triage 2018-10-06 22:50:38 UTC
The thing is, Qt does not care about the compiler you give it, but will use the compiler from the mkspec generally. 

So we need to make sure that we depend on that one, when USES=qmake is present. This is what I was suggesting in the qt5-qmake PR 231542.
Comment 12 Mark Linimon freebsd_committer freebsd_triage 2018-10-06 22:59:57 UTC
(In reply to Tobias C. Berner from comment #6)

wr/t forcing c++17 onto kde5 on the rest of the builders:

 - kde5 does not build on mips64 due to wayland
 - kde5 does not build on armv6 due to plasma5-kinfocenter
 - kde5 does not build on aarch64 due to grantlee5

some IMHO we're optimizing for what are already nonworking cases.

I haven't done the research to figure out if the dependencies already depend on gcc7 on mips64, but I am going to assume so.

I'm back working on FreeBSD after a few days away.  I'll try to come up with a gerernal patch, but I think we're making extra work for ourselves.
Comment 13 Tobias C. Berner freebsd_committer freebsd_triage 2018-10-06 23:12:30 UTC
(In reply to Mark Linimon from comment #12)
I do _not_ want c++17 added (as that might imply additional dependencies on older clang systems). 

I would prefer just to add USES=c++11-lang/lib to all the qt5 ports if that is enough.
Comment 14 Piotr Kubaj freebsd_committer freebsd_triage 2018-10-06 23:48:33 UTC
(In reply to Mark Linimon from comment #12)
The general patch would be to add USES to qt-dist.mk. I didn't want to do it, since I thought there may be some Qt5 ports that would compile with base GCC. I can see it was rather futile now.

We could add USES=c++11-lang to qt-dist.mk along with EXTRA_PATCHES (or USE_GCC, like you said in https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=231542 ).

(In reply to Tobias C. Berner from comment #13)
Just want to note that the only "older clang system" right now is 10.4-RELEASE which will go EOL in 24 days. Still, I don't mind it myself if you just put compiler:c++11-lang. Regarding Qt not caring about CC and CXX - my patch at https://bz-attachments.freebsd.org/attachment.cgi?id=197515 already takes care of that (seding QMAKE_* values)
Comment 15 Tobias C. Berner freebsd_committer freebsd_triage 2018-10-07 00:00:11 UTC
(In reply to Piotr Kubaj from comment #14)
With that sed you just set what it cares about. But if you decide that you now want GCC_DEFAULT=9 aftwards, you'll still be building qt with the gcc7 you had previously when building qmake.

But the minimal approach with these patches, using c++11-lib and adding USE_GCC seems like the most appropriate fix at the moment -- if it works, that is :)
Comment 16 Piotr Kubaj freebsd_committer freebsd_triage 2018-10-07 00:20:01 UTC
(In reply to Tobias C. Berner from comment #15)
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=231542#c11

You can change GCC version via make.conf.

This approach works, yes. Could you commit it?
Comment 17 Tobias C. Berner freebsd_committer freebsd_triage 2018-10-07 18:20:22 UTC
Piotr, could you send me a single diff, of the changes in the qt5-* ports and qt*mk files?


mfg Tobias
Comment 18 Piotr Kubaj freebsd_committer freebsd_triage 2018-10-08 10:27:51 UTC
Created attachment 197906 [details]
big patch

Here's a complete (as of now) patch. Note that as I fix ports, another ports dependant on the fixed ones try to build, so there will be more fixes.

This patch also contains fixes for some other ports maintained by @kde.

The full list of patched ports:
accessibility/qt5-speech
archivers/quazip
comms/qt5-sensors
comms/qt5-serialport
databases/qt5-sql
devel/qscintilla2-qt5
devel/qt5
devel/qt5-assistant
devel/qt5-buildtools
devel/qt5-concurrent
devel/qt5-core
devel/qt5-dbus
devel/qt5-designer
devel/qt5-help
devel/qt5-linguisttools
devel/qt5-location
devel/qt5-qdbus
devel/qt5-qmake
devel/qt5-script
devel/qt5-scripttools
devel/qt5-testlib
devel/qt5-uitools
graphics/qt5-imageformats
graphics/qt5-opengl
graphics/qt5-svg
lang/qt5-qml
multimedia/phonon
multimedia/qt5-multimedia
net-im/telepathy-qt4
net/qoauth-qt5
net/qt5-network
print/qt5-printsupport
sysutils/qt5-qtpaths
sysutils/signon-plugin-oauth2
sysutils/signon-qt5
textproc/qt5-xml
textproc/qt5-xmlpatterns
www/qt5-webchannel
x11-themes/kf5-breeze-icons
x11-toolkits/qt5-gui
x11-toolkits/qt5-quick
x11-toolkits/qt5-quickcontrols
x11-toolkits/qt5-quickcontrols2
x11-toolkits/qt5-virtualkeyboard
x11-toolkits/qt5-widgets
x11/qt5-x11extras
Comment 19 Piotr Kubaj freebsd_committer freebsd_triage 2018-10-13 21:23:35 UTC
(In reply to Tobias C. Berner from comment #17)
Any info about committing this patch? I already have other ports to fix, but I'd like to get this committed first.
Comment 20 commit-hook freebsd_committer freebsd_triage 2018-10-14 08:02:52 UTC
A commit references this bug:

Author: tcberner
Date: Sun Oct 14 08:01:25 UTC 2018
New revision: 482034
URL: https://svnweb.freebsd.org/changeset/ports/482034

Log:
  qt5: Fix build on GCC based architectures.

  PR:		231584
  PR:		231677
  PR:		231685
  PR:		231830
  PR:		231955
  PR:		231905
  PR:		231892
  PR:		231684
  PR:		231958
  PR:		231960
  PR:		231818
  PR:		231542
  PR:		231860
  PR:		231681
  PR:		231963
  PR:		231891
  PR:		231966
  PR:		231904
  PR:		231676
  PR:		231819
  PR:		231956
  PR:		231680
  PR:		231957
  PR:		231903
  PR:		231901
  PR:		231667
  PR:		231861
  Submitted by:	 Piotr Kubaj <pkubaj@anongoth.pl>

Changes:
  head/Mk/Uses/qt-dist.mk
  head/accessibility/qt5-speech/Makefile
  head/comms/qt5-sensors/Makefile
  head/comms/qt5-serialport/Makefile
  head/databases/qt5-sql/Makefile
  head/devel/qt5/Makefile.sqldrivers
  head/devel/qt5/files/extra-patch-mkspecs_common_g++-base.conf
  head/devel/qt5/files/extra-patch-mkspecs_common_gcc-base.conf
  head/devel/qt5-assistant/Makefile
  head/devel/qt5-buildtools/Makefile
  head/devel/qt5-concurrent/Makefile
  head/devel/qt5-core/Makefile
  head/devel/qt5-dbus/Makefile
  head/devel/qt5-designer/Makefile
  head/devel/qt5-help/Makefile
  head/devel/qt5-linguisttools/Makefile
  head/devel/qt5-location/Makefile
  head/devel/qt5-qdbus/Makefile
  head/devel/qt5-qmake/Makefile
  head/devel/qt5-script/Makefile
  head/devel/qt5-scripttools/Makefile
  head/devel/qt5-testlib/Makefile
  head/devel/qt5-uitools/Makefile
  head/graphics/qt5-imageformats/Makefile
  head/graphics/qt5-opengl/Makefile
  head/graphics/qt5-svg/Makefile
  head/lang/qt5-qml/Makefile
  head/multimedia/qt5-multimedia/Makefile
  head/net/qt5-network/Makefile
  head/print/qt5-printsupport/Makefile
  head/sysutils/qt5-qtpaths/Makefile
  head/textproc/qt5-xml/Makefile
  head/textproc/qt5-xmlpatterns/Makefile
  head/www/qt5-webchannel/Makefile
  head/x11/qt5-x11extras/Makefile
  head/x11-toolkits/qt5-gui/Makefile
  head/x11-toolkits/qt5-quick/Makefile
  head/x11-toolkits/qt5-quickcontrols/Makefile
  head/x11-toolkits/qt5-quickcontrols2/Makefile
  head/x11-toolkits/qt5-virtualkeyboard/Makefile
  head/x11-toolkits/qt5-widgets/Makefile
Comment 21 Tobias C. Berner freebsd_committer freebsd_triage 2018-10-14 08:04:56 UTC
Committed. Thanks