Bug 1330761

Summary: cmake macros for Qt5 don't handle rcc correctly
Product: [Fedora] Fedora Reporter: dertobi
Component: qt5-qtbaseAssignee: Rex Dieter <rdieter>
Status: CLOSED CURRENTRELEASE QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 24CC: jgrulich, jreznik, ovasik, rdieter, than
Target Milestone: ---Keywords: Reopened
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2017-07-18 13:02:21 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:

Description dertobi 2016-04-26 21:41:13 UTC
Description of problem:
The cmake macros for Qt5 don't find the Qt5 tool rcc correctly and therefore the build process fails at the very end. An application that you can test it with is: https://github.com/tobimensch/aqemu
The problem is to let Qt4 and Qt5 coexist rcc is /usr/bin/rcc for Qt4 and /usr/bin/rcc-qt5 for Qt5. And on a system with Qt4 devel packages you may never run into the bug because the Qt4 rcc is used without problems. But on a Qt5 only system you don't get that lucky. On other distributions like OpenSuSe this is reported as working, so it must be a Fedora 23/24/rawhide bug.

Version-Release number of selected component (if applicable):
latest Fedora 24 (beta/alpha)

How reproducible:
Try to build a project like this one with only Qt5 (not Qt4!) installed on a freshly installed Fedora 24 VM. https://github.com/tobimensch/aqemu

Comment 1 Rex Dieter 2016-04-26 22:40:44 UTC
There are no qt5-specific macros, what I would recommend though...

1. prior to running cmake, (or %cmake), best practice is to do something like:

export PATH="%{_qt5_bindir}:$PATH"

and that should help it find things properly

or

2.  you can use qtchooser

or

3.  teach aqemu cmake setup to search-for/prefer rcc-qt5 if present

Comment 2 Rex Dieter 2016-04-26 23:50:51 UTC
*** Bug 1330760 has been marked as a duplicate of this bug. ***

Comment 3 dertobi 2016-04-27 06:36:46 UTC
> There are no qt5-specific macros, what I would recommend though...

That's not true at all. 

in /usr
bash-4.3$ find . | grep "Qt5" | grep "cmake"
find: ā€˜./share/polkit-1/rules.d’: Permission denied
./lib64/cmake/Qt5Concurrent
./lib64/cmake/Qt5Concurrent/Qt5ConcurrentConfig.cmake
./lib64/cmake/Qt5Concurrent/Qt5ConcurrentConfigVersion.cmake
./lib64/cmake/Qt5PrintSupport
./lib64/cmake/Qt5PrintSupport/Qt5PrintSupportConfigVersion.cmake
./lib64/cmake/Qt5PrintSupport/Qt5PrintSupport_QCupsPrinterSupportPlugin.cmake
./lib64/cmake/Qt5PrintSupport/Qt5PrintSupportConfig.cmake
./lib64/cmake/Qt5Location
./lib64/cmake/Qt5Location/Qt5Location_QGeoServiceProviderFactoryOsm.cmake
./lib64/cmake/Qt5Location/Qt5Location_QGeoServiceProviderFactoryNokia.cmake
./lib64/cmake/Qt5Location/Qt5Location_QGeoServiceProviderFactoryMapbox.cmake
./lib64/cmake/Qt5QuickWidgets
./lib64/cmake/Qt5QuickWidgets/Qt5QuickWidgetsConfigVersion.cmake
./lib64/cmake/Qt5QuickWidgets/Qt5QuickWidgetsConfig.cmake
./lib64/cmake/Qt5Qml
./lib64/cmake/Qt5Qml/Qt5Qml_QQmlNativeDebugConnectorFactory.cmake
./lib64/cmake/Qt5Qml/Qt5QmlConfig.cmake
./lib64/cmake/Qt5Qml/Qt5Qml_QTcpServerConnection.cmake
./lib64/cmake/Qt5Qml/Qt5Qml_QQmlDebugServerFactory.cmake
./lib64/cmake/Qt5Qml/Qt5Qml_QTcpServerConnectionFactory.cmake
./lib64/cmake/Qt5Qml/Qt5Qml_QQmlInspectorServiceFactory.cmake
./lib64/cmake/Qt5Qml/Qt5QmlConfigVersion.cmake
./lib64/cmake/Qt5Qml/Qt5Qml_QtQuick2Plugin.cmake
./lib64/cmake/Qt5Qml/Qt5QmlConfigExtras.cmake
./lib64/cmake/Qt5Qml/Qt5Qml_QQmlProfilerServiceFactory.cmake
./lib64/cmake/Qt5Qml/Qt5Qml_QLocalClientConnectionFactory.cmake
./lib64/cmake/Qt5Qml/Qt5Qml_QQmlDebuggerServiceFactory.cmake
./lib64/cmake/Qt5Xml
./lib64/cmake/Qt5Xml/Qt5XmlConfigVersion.cmake
./lib64/cmake/Qt5Xml/Qt5XmlConfig.cmake
./lib64/cmake/Qt5Gui
./lib64/cmake/Qt5Gui/Qt5Gui_QEglFSKmsIntegrationPlugin.cmake
./lib64/cmake/Qt5Gui/Qt5Gui_QICOPlugin.cmake
./lib64/cmake/Qt5Gui/Qt5Gui_QXcbGlxIntegrationPlugin.cmake
./lib64/cmake/Qt5Gui/Qt5Gui_QGifPlugin.cmake
./lib64/cmake/Qt5Gui/Qt5Gui_QXcbIntegrationPlugin.cmake
./lib64/cmake/Qt5Gui/Qt5Gui_QComposePlatformInputContextPlugin.cmake
./lib64/cmake/Qt5Gui/Qt5Gui_QLibInputPlugin.cmake
./lib64/cmake/Qt5Gui/Qt5Gui_QOffscreenIntegrationPlugin.cmake
./lib64/cmake/Qt5Gui/Qt5Gui_QEglFSX11IntegrationPlugin.cmake
./lib64/cmake/Qt5Gui/Qt5Gui_QEvdevTabletPlugin.cmake
./lib64/cmake/Qt5Gui/Qt5Gui_QTuioTouchPlugin.cmake
./lib64/cmake/Qt5Gui/Qt5Gui_QLinuxFbIntegrationPlugin.cmake
./lib64/cmake/Qt5Gui/Qt5Gui_QIbusPlatformInputContextPlugin.cmake
./lib64/cmake/Qt5Gui/Qt5Gui_QGtk2ThemePlugin.cmake
./lib64/cmake/Qt5Gui/Qt5GuiConfigVersion.cmake
./lib64/cmake/Qt5Gui/Qt5Gui_QMinimalEglIntegrationPlugin.cmake
./lib64/cmake/Qt5Gui/Qt5Gui_QEglFSIntegrationPlugin.cmake
./lib64/cmake/Qt5Gui/Qt5GuiConfig.cmake
./lib64/cmake/Qt5Gui/Qt5Gui_QJpegPlugin.cmake
./lib64/cmake/Qt5Gui/Qt5Gui_QXcbEglIntegrationPlugin.cmake
./lib64/cmake/Qt5Gui/Qt5Gui_QEvdevTouchScreenPlugin.cmake
./lib64/cmake/Qt5Gui/Qt5Gui_QEvdevKeyboardPlugin.cmake
./lib64/cmake/Qt5Gui/Qt5Gui_QEvdevMousePlugin.cmake
./lib64/cmake/Qt5Gui/Qt5Gui_QMinimalIntegrationPlugin.cmake
./lib64/cmake/Qt5Gui/Qt5GuiConfigExtras.cmake
./lib64/cmake/Qt5LinguistTools
./lib64/cmake/Qt5LinguistTools/Qt5LinguistToolsConfig.cmake
./lib64/cmake/Qt5LinguistTools/Qt5LinguistToolsConfigVersion.cmake
./lib64/cmake/Qt5LinguistTools/Qt5LinguistToolsMacros.cmake
./lib64/cmake/Qt5Widgets
./lib64/cmake/Qt5Widgets/Qt5WidgetsMacros.cmake
./lib64/cmake/Qt5Widgets/Qt5WidgetsConfigExtras.cmake
./lib64/cmake/Qt5Widgets/Qt5WidgetsConfig.cmake
./lib64/cmake/Qt5Widgets/Qt5WidgetsConfigVersion.cmake
./lib64/cmake/Qt5Declarative
./lib64/cmake/Qt5Declarative/Qt5Declarative_QTcpServerConnection.cmake
./lib64/cmake/Qt5Declarative/Qt5DeclarativeConfigVersion.cmake
./lib64/cmake/Qt5Declarative/Qt5Declarative_QtQuick1Plugin.cmake
./lib64/cmake/Qt5Declarative/Qt5DeclarativeConfig.cmake
./lib64/cmake/Qt5DBus
./lib64/cmake/Qt5DBus/Qt5DBusConfigExtras.cmake
./lib64/cmake/Qt5DBus/Qt5DBusConfig.cmake
./lib64/cmake/Qt5DBus/Qt5DBusMacros.cmake
./lib64/cmake/Qt5DBus/Qt5DBusConfigVersion.cmake
./lib64/cmake/Qt5Sql
./lib64/cmake/Qt5Sql/Qt5SqlConfigVersion.cmake
./lib64/cmake/Qt5Sql/Qt5Sql_QSQLiteDriverPlugin.cmake
./lib64/cmake/Qt5Sql/Qt5SqlConfig.cmake
./lib64/cmake/Qt5Designer
./lib64/cmake/Qt5Designer/Qt5Designer_QDeclarativeViewPlugin.cmake
./lib64/cmake/Qt5Designer/Qt5Designer_WorldTimeClockPlugin.cmake
./lib64/cmake/Qt5Designer/Qt5Designer_QWebViewPlugin.cmake
./lib64/cmake/Qt5Designer/Qt5Designer_TicTacToePlugin.cmake
./lib64/cmake/Qt5Designer/Qt5Designer_AnalogClockPlugin.cmake
./lib64/cmake/Qt5Designer/Qt5Designer_MultiPageWidgetPlugin.cmake
./lib64/cmake/Qt5Designer/Qt5Designer_QQuickWidgetPlugin.cmake
./lib64/cmake/Qt5
./lib64/cmake/Qt5/Qt5ConfigVersion.cmake
./lib64/cmake/Qt5/Qt5Config.cmake
./lib64/cmake/Qt5Multimedia
./lib64/cmake/Qt5Multimedia/Qt5Multimedia_QGstreamerCaptureServicePlugin.cmake
./lib64/cmake/Qt5Multimedia/Qt5Multimedia_QGstreamerPlayerServicePlugin.cmake
./lib64/cmake/Qt5Multimedia/Qt5Multimedia_QGstreamerAudioDecoderServicePlugin.cmake
./lib64/cmake/Qt5Multimedia/Qt5Multimedia_QM3uPlaylistPlugin.cmake
./lib64/cmake/Qt5Multimedia/Qt5Multimedia_QAlsaPlugin.cmake
./lib64/cmake/Qt5Multimedia/Qt5Multimedia_CameraBinServicePlugin.cmake
./lib64/cmake/Qt5Multimedia/Qt5Multimedia_QPulseAudioPlugin.cmake
./lib64/cmake/Qt5Svg
./lib64/cmake/Qt5Svg/Qt5Svg_QSvgPlugin.cmake
./lib64/cmake/Qt5Svg/Qt5Svg_QSvgIconPlugin.cmake
./lib64/cmake/Qt5Test
./lib64/cmake/Qt5Test/Qt5TestConfig.cmake
./lib64/cmake/Qt5Test/Qt5TestConfigVersion.cmake
./lib64/cmake/Qt5ScriptTools
./lib64/cmake/Qt5ScriptTools/Qt5ScriptToolsConfig.cmake
./lib64/cmake/Qt5ScriptTools/Qt5ScriptToolsConfigVersion.cmake
./lib64/cmake/Qt5Core
./lib64/cmake/Qt5Core/Qt5CoreConfig.cmake
./lib64/cmake/Qt5Core/Qt5CoreConfigExtrasMkspecDir.cmake
./lib64/cmake/Qt5Core/Qt5CTestMacros.cmake
./lib64/cmake/Qt5Core/Qt5CoreConfigVersion.cmake
./lib64/cmake/Qt5Core/Qt5CoreConfigExtras.cmake
./lib64/cmake/Qt5Core/Qt5CoreMacros.cmake
./lib64/cmake/Qt5MultimediaWidgets
./lib64/cmake/Qt5Sensors
./lib64/cmake/Qt5Sensors/Qt5Sensors_QCounterGesturePlugin.cmake
./lib64/cmake/Qt5Sensors/Qt5Sensors_QtSensorGesturePlugin.cmake
./lib64/cmake/Qt5Sensors/Qt5Sensors_LinuxSensorPlugin.cmake
./lib64/cmake/Qt5Sensors/Qt5Sensors_genericSensorPlugin.cmake
./lib64/cmake/Qt5Sensors/Qt5Sensors_QShakeSensorGesturePlugin.cmake
./lib64/cmake/Qt5Network
./lib64/cmake/Qt5Network/Qt5NetworkConfig.cmake
./lib64/cmake/Qt5Network/Qt5Network_QGenericEnginePlugin.cmake
./lib64/cmake/Qt5Network/Qt5NetworkConfigVersion.cmake
./lib64/cmake/Qt5Network/Qt5Network_QConnmanEnginePlugin.cmake
./lib64/cmake/Qt5Network/Qt5Network_QNetworkManagerEnginePlugin.cmake
./lib64/cmake/Qt5Positioning
./lib64/cmake/Qt5Positioning/Qt5Positioning_QGeoPositionInfoSourceFactoryGeoclue.
cmake
./lib64/cmake/Qt5Positioning/Qt5Positioning_QGeoPositionInfoSourceFactoryPoll.cma
ke
./lib64/cmake/Qt5OpenGL
./lib64/cmake/Qt5OpenGL/Qt5OpenGLConfigVersion.cmake
./lib64/cmake/Qt5OpenGL/Qt5OpenGLConfig.cmake
./lib64/cmake/Qt5Quick
./lib64/cmake/Qt5Quick/Qt5QuickConfig.cmake
./lib64/cmake/Qt5Quick/Qt5QuickConfigVersion.cmake
./lib64/cmake/Qt5QuickTest
./lib64/cmake/Qt5QuickTest/Qt5QuickTestConfigVersion.cmake
./lib64/cmake/Qt5QuickTest/Qt5QuickTestConfig.cmake
./lib64/cmake/Qt5Script
./lib64/cmake/Qt5Script/Qt5ScriptConfig.cmake
./lib64/cmake/Qt5Script/Qt5ScriptConfigVersion.cmake
./lib64/qt5/mkspecs/features/data/cmake/Qt5PluginTarget.cmake.in
./lib64/qt5/mkspecs/features/data/cmake/Qt5BasicConfig.cmake.in
./lib64/qt5/mkspecs/features/data/cmake/Qt5ConfigVersion.cmake.in


/usr/lib64/cmake/Qt5Core/Qt5CoreConfigExtras.cmake

contains the line
    set(imported_location "${_qt5Core_install_prefix}/bin/rcc")

I asked a Qt dev about this. cmake with the autorcc settings should find rcc out of the box without any additional settings in the cmake file or using environment variables or any other workaround. It works in other distributions out of the box and it is intended by Qt to work out of the box.

Which means that it is a packaging error by Fedora. I can't accept that the bug was simply closed.

Comment 4 Rex Dieter 2016-04-27 08:37:16 UTC
Those are not macros, but cmake config modules.

Comment 5 Rex Dieter 2016-04-27 08:39:19 UTC
Well, and this is precisely also the kind of problem the qtchooser tool was designed to solve, a tool Qt upstream provides.  I suggest you consider using it.

Comment 6 Rex Dieter 2016-04-27 08:42:08 UTC
And ultimately, this is an upstream Qt bug, fedora's Qt5 packaging is built with 
-bindir %_Libdir/qt5/bin

but as you mentioned,

/usr/lib64/cmake/Qt5Core/Qt5CoreConfigExtras.cmake

contains the line
    set(imported_location "${_qt5Core_install_prefix}/bin/rcc")

does not use it, but assumes prefix/bin/ location

Comment 7 dertobi 2016-04-27 09:01:00 UTC
Whatever its name is macros or modules it should be able to find where the rcc tool is on the system. It works for moc and uic, too, so rcc is the anomaly.

It could also be an upstream bug, of course, but upstream sent me here. Now I've to go back talk with upstream again. This is starting to feel like both sides don't want to be responsible.

The qtchooser tool is probably great if you want to support both Qt4 and Qt5 in the same project. But for projects that are purely Qt5 (or Qt4) it shouldn't be neccessary in my opinion. And when you look at the project I posted everything compiles fine until the very end, which means that 0,1% of Qt5 isn't working out of the box in this situation, which is an annoyance.

I'm going to ask upstream about this again and will report back here. I'm also interested in how OpenSuSe solved this.

Comment 8 Rex Dieter 2016-04-27 09:03:53 UTC
No worries, I can take responsibility for fixing our side of things at least, and probably even do upstream poking, but any help with the latter certainly would be appreciated.

Comment 9 Rex Dieter 2016-04-27 12:12:39 UTC
> The qtchooser tool is probably great if you want to support both Qt4 and Qt5 in the same project.

No, it's a tool to allow developers to easily switch between using qt4 and qt5, which is precisely the use-case here. (Since you have both installed, else your app wouldn't have found and tried to use Qt4's rcc)

That said, we in fedora's kde-sig didn't agree with qtchooser's implementation/design completely and while we support it's use... went one step further, to make parallel-installable (renamed) binaries as well, using a -qt5 postfix where needed.

Comment 10 dertobi 2016-04-27 12:26:15 UTC
> No, it's a tool to allow developers to easily switch between using qt4 and qt5, which > is precisely the use-case here. (Since you have both installed, else your app wouldn't > have found and tried to use Qt4's rcc)

You didn't get me on this. On my main workstation I never ran into this issue precisely because Qt4 and Qt5 devel packages were installed are installed. (it was a Qt4 to Qt5 port after all) So when the project transitioned to Qt5 it still found the rcc in the old /usr/bin/rcc path and therefore I initially didn't hit the bug.

But then I wanted to test if the project could be built on a clean system with only minimal dependencies. So I installed a fresh Fedora 24 VM and added only the devel packages for Qt5. Qt4 devel packages don't exist on that system.

Interestingly everything worked out of the box 100% (as I hoped and expected) including the moc und uic tools, but at the very and just before linking I got "rcc command not found" and the target failed.

Something is different between uic and moc are handled and rcc, and I think uic and moc get it right.

Comment 11 dertobi 2016-04-27 12:29:07 UTC
sorry about the typos :-)

-are installed
s/and/end
s/between/between how

Comment 12 Rex Dieter 2016-04-27 14:10:11 UTC
Yes, it does seem like we're talking past each other a bit.  sorry.

To be clear, I understand your points.  I'm only trying to offer you options and workarounds in the meantime until this is properly fixed.  Seems to me, you're not interested in those (ie, you want this to work out-of-the box without workarounds), which is fine.

Comment 13 dertobi 2016-04-27 15:03:23 UTC
Well, all I wanted is that the issue is fully understood. :-) I'm fine with workarounds as long as I know that I'll not have to use them forever. My workaround thus far was simply cp /usr/bin/rcc-qt5 /usr/bin/rcc , so you see I'm not shy of using workarounds...

Thanks for your patience.

Comment 14 Than Ngo 2017-07-18 13:02:21 UTC
i cannot reproduced this issue on f25/f26 with your testcase (git clone aqemu, make test, cd test && cmake .., make).

the AM_QT_RCC_EXECUTABLE is set correctly to /usr/lib64/qt5/bin/rcc. and qemu built fine without any error.

It seems a bug in cmake which is already fixed in current fedora release. The f24 will reach the EOL so i strong recommend the update to latest fedora release.

Thanks