Details
-
Bug
-
Resolution: Won't Do
-
P4: Low
-
None
-
5.15.1
-
None
Description
If you add any overridden function to the header file to any component, and its implementation, i am getting build error on MacOS platform. There are no build errors on other platforms.
Steps to reproduce
- git clone git://code.qt.io/qt/qtquickcontrols2.git and git checkout 5.15.1
- Add any overloaded function to any component, for example i added hoverLeaveEvent into QQuickSplitView (patch in attachment)
- Try to compile and you will get linker error when trying to link qtquicktemplates2plugin.o.
Undefined symbols for architecture x86_64: "QQuickSplitView::hoverLeaveEvent(QHoverEvent*)", referenced from: vtable for QQmlPrivate::QQmlElement<QQuickSplitView> in qtquicktemplates2plugin.o
4. This happened because src/imports/templates/Makefile has the following order of paths to libraries:
LIBS = $(SUBLIBS) -F/Volumes/Disk/Qt/5.15.1/clang_64/lib -F/Users/dev/projects/QtDev/tmp/qtquickcontrols2/lib -framework QtQuick -framework QtGui -framework AppKit -framework Metal -framework QtQmlModels -framework QtQml -framework QtNetwork -framework QtCore -framework DiskArbitration -framework IOKit -framework OpenGL -framework AGL -framework QtQuickTemplates2 -F/Volumes/Disk/Qt/5.15.1/clang_64/lib -framework QtQuick -framework QtGui -framework AppKit -framework Metal -framework QtQmlModels -framework QtQml -framework QtNetwork -framework QtCore -framework DiskArbitration -framework IOKit
Why is the path to Qt libs included twice? Because of this, we have a bug that priority of the original library QtQuickControls2 have first path -F/Volumes/Disk/Qt/5.15.1/clang_64/lib without my implementation of my function overloaded function.
Workaround how to fix that is modify src/imports/templates/templates.pro file, just and following lines to the end of the file.
macx { QT -= core gui qml quick }
This will change the order of the paths in Makefile, my implementation will be included before Qt, and compilation will be successful.
LIBS = $(SUBLIBS) -F/Users/dev/projects/QtDev/tmp/qtquickcontrols2/lib -F/Volumes/Disk/Qt/5.15.1/clang_64/lib -framework OpenGL -framework AGL -framework QtQuickTemplates2 -F/Volumes/Disk/Qt/5.15.1/clang_64/lib -framework QtQuick -framework QtGui -framework AppKit -framework Metal -framework QtQmlModels -framework QtQml -framework QtNetwork -framework QtCore -framework DiskArbitration -framework IOKit
Also tested on earlier versions of Qt.