Created attachment 197300 [details] patch Qt5 forcibly sets gcc and g++ as CC and CXX if they exist, which breaks compilation on architectures that don't use LLVM. This patch fixes this issue. Tested on amd64 with clang and on powerpc64.
I'll test this soon. Probably I'll make the following change: .if ${ARCH:Mmips*} || ${ARCH:Mpowerpc*} || ${ARCH} == sparc64 to keep the sorting correct.
Are you saying that there is no gcc and g++ available in base? Or that qmake picks gcc and g++, which are way too old in base and it should be using (ports?) gcc7 instead? This still leaves open the various issues around Qt not respecting CC / CXX .. but that's a far, far more invasive patch (because Qt totally isn't set up for that). So if Mark says "this works", it's got my blessing, though.
(In reply to Adriaan de Groot from comment #2) There are gcc and g++ in base, but it's only version 4.2.1. Qt5 needs C++11-compatible compiler.
Created attachment 197358 [details] v2 While making patches for next Qt5 ports, I noticed the same patches are necessary for each port. Fix it better by patching Mk/Uses/qt-dist.mk. Individual patches will still be needed for each port's Makefile (only USES will be modified).
Moin moin In extra-patch-mkspecs_common_gcc-base.conf you should probably substitute in the value of $LOCALBASE and not assume it's /usr/local mfg Tobias
Created attachment 197494 [details] v3 The $PREFIX issue is fixed in this patch.
Is the build time dependency on lang/gcc providing gcc7 implicit by the USES=compiler ? I.e. shouldn't gcc7/g++7 be subbed via "gcc%%GCC_DEFAULT%%" and "g++%%GCC_DEFAULT%%" or something? [same for the 7 in the linker path]
Created attachment 197513 [details] v4 GCC_DEFAULT is now used instead of hard-coding 7. Test compilation of qt5-qmake works.
Created attachment 197515 [details] v5 Small fixes.
(In reply to Piotr Kubaj from comment #9) This still isn't general enough. What if someone wants to test building with (for example) gcc9? I'm working on an improved patch. Also, now that it affects something in Mk/, it's most likely going to need an exp-run.
(In reply to Mark Linimon from comment #10) I did a quick test. /etc/make.conf: DEFAULT_VERSIONS= gcc=8 $ make -V GCC_DEFAULT 8 I tried to build it, it uses GCC 8. ===> Applying FreeBSD patches for qt5-qmake-5.11.1 /usr/bin/sed -i "" 's|%%LOCALBASE%%|/usr/local|' /tmp/usr/local/poudriere/ports/default/devel/qt5-qmake/work/qtbase-everywhere-src-5.11.1/mkspecs/common/gcc-base.conf /usr/bin/sed -i "" 's|%%GCC_DEFAULT%%|8|' /tmp/usr/local/poudriere/ports/default/devel/qt5-qmake/work/qtbase-everywhere-src-5.11.1/mkspecs/common/gcc-base.conf /tmp/usr/local/poudriere/ports/default/devel/qt5-qmake/work/qtbase-everywhere-src-5.11.1/mkspecs/common/g++-base.conf /usr/bin/sed -i "" -e "/DEFAULT_LIBDIRS=/ s,\\\\\"\\\\n,\\\\n/usr/local/lib&," /tmp/usr/local/poudriere/ports/default/devel/qt5-qmake/work/qtbase-everywhere-src-5.11.1/configure ===> qt5-qmake-5.11.1 depends on executable: gmake - found ===> qt5-qmake-5.11.1 depends on package: pkgconf>=1.3.0_1 - found ===> qt5-qmake-5.11.1 depends on file: /usr/local/bin/python2.7 - found ===> qt5-qmake-5.11.1 depends on executable: gcc8 - not found
(In reply to Mark Linimon from comment #10) Technically you can only have one gcc set to build Qt. The one used in devel/qt5-qmake and written there in the qmake.conf used, which we have two of: freebsd-clang and freebsd-gcc. So if you want it general you need to expose a new configuration variable QT_GCC_VERSION which defaults to GCC_DEFAULT or can be overridden via make.conf (and will take affect in qt5-qmake as the other will use qmake to get the compiler). Then also add explicit build & run depends on lang/gcc${QT_GCC_VERSION} But... That also needs to work well with compiler.mk and not on clang architectures (as I fear many fancy errors). Mfg Tobias
(In reply to Tobias C. Berner from comment #12) There is already a way to add the depends. What about adding, right after +.if ${ARCH:Mmips*} || ${ARCH:Mpowerpc*} || ${ARCH} == sparc64 USE_GCC= yes ? Mk/bsd.gcc.mk is processed after all of USES_*. As for the "work well on compiler.mk", the extra patches are already dependent on that ARCH conditional; and the patchfiles are only for gcc-related files. I'll test a build with this in a bit.
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
Committed. Thanks