I had installed the SailfishSDK (EA for 4.1.0.24) including QtCreator, Emulator etc. a week ago, and have been working with it without problems since.
Now I wanted to deploy my app to my phone, so in order to build an rpm package, I followed those pages:
https://sailfishos.org/wiki/Building_packages
https://sailfishos.org/wiki/Platform_SDK_Installation
https://sailfishos.org/wiki/Platform_SDK_Target_Installation
I have set up the PlatformSDK and afterwards several tagets:
sdk-assistant create SailfishOS-4.1.0.24 http://releases.sailfishos.org/sdk/targets/Sailfish_OS-4.1.0.24-Sailfish_SDK_Tooling-i486.tar.7z
sdk-assistant create SailfishOS-4.1.0.24-aarch64 http://releases.sailfishos.org/sdk/targets/Sailfish_OS-4.1.0.24-Sailfish_SDK_Target-aarch64.tar.7z
Now when I try to build the app with mb2 -t SailfishOS-4.1.0.24-aarch64 build
, I’ll get a crapload of errors:
+ export LD_AS_NEEDED
+ export QT_SELECT=5
+ QT_SELECT=5
+ qmake -qt=5 -makefile 'QMAKE_CFLAGS_RELEASE=-O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -Wformat -Wformat-security -march=armv8-a' 'QMAKE_CFLAGS_DEBUG=-O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -Wformat -Wformat-security -march=armv8-a' 'QMAKE_CXXFLAGS_RELEASE=-O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -Wformat -Wformat-security -march=armv8-a' 'QMAKE_CXXFLAGS_DEBUG=-O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -Wformat -Wformat-security -march=armv8-a' QMAKE_STRIP=: PREFIX=/usr LIBDIR=/usr/lib64
+ make -j16
g++ -c -pipe -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -Wformat -Wformat-security -march=armv8-a -fPIC -fvisibility=hidden -fvisibility-inlines-hidden -Wall -W -D_REENTRANT -fPIC -DQT_NO_DEBUG -DQT_QUICK_LIB -DQT_GUI_LIB -DQT_QML_LIB -DQT_NETWORK_LIB -DQT_CORE_LIB -I. -isystem /usr/include/sailfishapp -isystem /usr/include/mdeclarativecache5 -isystem /usr/include/qt5 -isystem /usr/include/qt5/QtQuick -isystem /usr/include/qt5/QtGui -isystem /usr/include/qt5/QtQml -isystem /usr/include/qt5/QtNetwork -isystem /usr/include/qt5/QtCore -I. -I/usr/share/qt5/mkspecs/linux-g++ -o myapp.o src/myapp.cpp
src/myapp.cpp: In function 'int main(int, char**)':
src/myapp.cpp:12:4: error: 'qmlRegisterType' was not declared in this scope
qmlRegisterType<MyModel>("MyApp", 1, 0, "MyModel");
^~~~~~~~~~~~~~~
src/myapp.cpp:12:4: note: suggested alternative: 'qRegisterMetaType'
qmlRegisterType<MyModel>("MyApp", 1, 0, "MyModel");
^~~~~~~~~~~~~~~
qRegisterMetaType
src/myapp.cpp:12:30: error: expected primary-expression before '>' token
qmlRegisterType<MyModel>("MyApp", 1, 0, "MyModel");
^
src/myapp.cpp:12:42: warning: left operand of comma operator has no effect [-Wunused-value]
qmlRegisterType<MyModel>("MyApp", 1, 0, "MyModel");
^
src/myapp.cpp:12:45: warning: right operand of comma operator has no effect [-Wunused-value]
qmlRegisterType<MyModel>("MyApp", 1, 0, "MyModel");
^
src/myapp.cpp:12:48: warning: right operand of comma operator has no effect [-Wunused-value]
qmlRegisterType<MyModel>("MyApp", 1, 0, "MyModel");
^~~~~~~~~~~~
src/myapp.cpp:18:8: error: invalid use of incomplete type 'class QQuickView'
view->setSource(SailfishApp::pathTo(QString("qml/myapp.qml")));
^~
In file included from src/myapp.cpp:5:
/usr/include/sailfishapp/sailfishapp.h:38:7: note: forward declaration of 'class QQuickView'
class QQuickView;
^~~~~~~~~~
src/myapp.cpp:19:8: error: invalid use of incomplete type 'class QQuickView'
view->show();
^~
In file included from src/myapp.cpp:5:
/usr/include/sailfishapp/sailfishapp.h:38:7: note: forward declaration of 'class QQuickView'
class QQuickView;
^~~~~~~~~~
src/myapp.cpp:21:14: error: invalid use of incomplete type 'class QGuiApplication'
return app->exec();
^~
In file included from src/myapp.cpp:5:
/usr/include/sailfishapp/sailfishapp.h:37:7: note: forward declaration of 'class QGuiApplication'
class QGuiApplication;
^~~~~~~~~~~~~~~
In file included from /usr/include/qt5/QtCore/qobject.h:47,
from /usr/include/qt5/QtCore/qvariant.h:45,
from /usr/include/qt5/QtCore/qabstractitemmodel.h:37,
from /usr/include/qt5/QtCore/QAbstractListModel:1,
from src/mymodel.h:4,
from src/myapp.cpp:7:
/usr/include/qt5/QtCore/qscopedpointer.h: In instantiation of 'static void QScopedPointerDeleter<T>::cleanup(T*) [with T = QGuiApplication]':
/usr/include/qt5/QtCore/qscopedpointer.h:101:25: required from 'QScopedPointer<T, Cleanup>::~QScopedPointer() [with T = QGuiApplication; Cleanup = QScopedPointerDeleter<QGuiApplication>]'
src/myapp.cpp:15:76: required from here
/usr/include/qt5/QtCore/qscopedpointer.h:51:40: error: invalid application of 'sizeof' to incomplete type 'QGuiApplication'
typedef char IsIncompleteType[ sizeof(T) ? 1 : -1 ];
^~~~~~~~~
/usr/include/qt5/QtCore/qscopedpointer.h: In instantiation of 'static void QScopedPointerDeleter<T>::cleanup(T*) [with T = QQuickView]':
/usr/include/qt5/QtCore/qscopedpointer.h:101:25: required from 'QScopedPointer<T, Cleanup>::~QScopedPointer() [with T = QQuickView; Cleanup = QScopedPointerDeleter<QQuickView>]'
src/myapp.cpp:16:61: required from here
/usr/include/qt5/QtCore/qscopedpointer.h:51:40: error: invalid application of 'sizeof' to incomplete type 'QQuickView'
make: *** [Makefile:454: myapp.o] Error 1
error: Bad exit status from /var/tmp/rpm-tmp.VRf2xo (%build)
RPM build errors:
Bad exit status from /var/tmp/rpm-tmp.VRf2xo (%build)
No journal files were found.
Failed to seek to cursor: Invalid argument
The corresponding source looks like this:
#ifdef QT_QML_DEBUG
#include <QtQuick>
#endif
#include <sailfishapp.h>
#include "mymodel.h"
Q_DECL_EXPORT int main(int argc, char *argv[])
{
qmlRegisterType<MyModel>("MyApp", 1, 0, "MyModel");
QScopedPointer<QGuiApplication> app(SailfishApp::application(argc, argv));
QScopedPointer<QQuickView> view(SailfishApp::createView());
view->setSource(SailfishApp::pathTo(QString("qml/myapp.qml")));
view->show();
return app->exec();
}
I’m not entirely sure whats going on, but I get the feeling that there is a QT version mismatch.
How can I fix this?