简体   繁体   中英

Qt 5.6 Cross Compile for Raspberry Pi with EGLFS

I'm following the tutorial here https://wiki.qt.io/RaspberryPi2EGLFS

I'm on Ubuntu 15.04. On the make step I am hit with a bunch of undefined reference errors, referring mostly to QT methods.

.obj/qaccessible.o:qaccessible.cpp:function QAccessibleEvent::accessibleInterface() const: error: undefined reference to 'QDebug::~QDebug()'
.obj/qaccessible.o:qaccessible.cpp:function QAccessibleEvent::accessibleInterface() const: error: undefined reference to 'QDebug::~QDebug()'
.obj/qaccessible.o:qaccessible.cpp:function QAccessibleEvent::accessibleInterface() const: error: undefined reference to 'QDebug::~QDebug()'
.obj/qaccessible.o:qaccessible.cpp:function QAccessibleEvent::accessibleInterface() const: error: undefined reference to 'QDebug::~QDebug()'
.obj/qaccessible.o:qaccessible.cpp:function operator<<(QDebug, QAccessibleInterface const*): error: undefined reference to 'QDebug::putString(QChar const*, unsigned int)'
.obj/qaccessible.o:qaccessible.cpp:function operator<<(QDebug, QAccessibleInterface const*): error: undefined reference to 'QDebug::putString(QChar const*, unsigned int)'
.obj/qgenericpluginfactory.o:qgenericpluginfactory.cpp:function QGenericPluginFactory::create(QString const&, QString const&): error: undefined reference to 'QString::toLower_helper(QString const&)'
.obj/qwindowsysteminterface.o:qwindowsysteminterface.cpp:function qt_handleShortcutEvent(QObject*, unsigned long, int, QFlags<Qt::KeyboardModifier>, QString const&, bool, unsigned short): error: undefined reference to 'QCoreApplication::notifyInternal2(QObject*, QEvent*)'
.obj/qplatforminputcontextfactory.o:qplatforminputcontextfactory.cpp:function QPlatformInputContextFactory::create(QString const&): error: undefined reference to 'QString::toLower_helper(QString&)'
.obj/qplatformtheme.o:qplatformtheme.cpp:function QPlatformTheme::defaultThemeHint(QPlatformTheme::ThemeHint): error: undefined reference to 'qEnvironmentVariableIntValue(char const*, bool*)'
.obj/qplatformtheme.o:qplatformtheme.cpp:function QPlatformTheme::defaultThemeHint(QPlatformTheme::ThemeHint): error: undefined reference to 'QMetaType::registerNormalizedType(QByteArray const&, void (*)(void*), void* (*)(void*, void const*), int, QFlags<QMetaType::TypeFlag>, QMetaObject const*)'
.obj/qplatformtheme.o:qplatformtheme.cpp:function QPlatformTheme::defaultThemeHint(QPlatformTheme::ThemeHint): error: undefined reference to 'QMetaType::registerNormalizedType(QByteArray const&, void (*)(void*), void* (*)(void*, void const*), int, QFlags<QMetaType::TypeFlag>, QMetaObject const*)'
.obj/qplatformtheme.o:qplatformtheme.cpp:function QMetaTypeId<QtMetaTypePrivate::QSequentialIterableImpl>::qt_metatype_id(): error: undefined reference to 'QMetaType::registerNormalizedType(QByteArray const&, void (*)(void*), void* (*)(void*, void const*), int, QFlags<QMetaType::TypeFlag>, QMetaObject const*)'
.obj/qplatformtheme.o:qplatformtheme.cpp:function QMetaTypeId<QList<int> >::qt_metatype_id(): error: undefined reference to 'QMetaType::registerNormalizedType(QByteArray const&, void (*)(void*), void* (*)(void*, void const*), int, QFlags<QMetaType::TypeFlag>, QMetaObject const*)'
.obj/qplatformthemefactory.o:qplatformthemefactory.cpp:function QPlatformThemeFactory::create(QString const&, QString const&): error: undefined reference to 'QString::toLower_helper(QString&)'
.obj/qplatformwindow.o:qplatformwindow.cpp:function QPlatformWindow::requestUpdate(): error: undefined reference to 'qEnvironmentVariableIntValue(char const*, bool*)'
.obj/qsurfaceformat.o:qsurfaceformat.cpp:function operator<<(QDebug, QSurfaceFormat const&): error: undefined reference to 'QDebug::resetFormat()'
.obj/qguiapplication.o:qguiapplication.cpp:function QGuiApplicationPrivate::processGestureEvent(QWindowSystemInterfacePrivate::GestureEvent*): error: undefined reference to 'QCoreApplication::notifyInternal2(QObject*, QEvent*)'
.obj/qguiapplication.o:qguiapplication.cpp:function QGuiApplicationPrivate::createPlatformIntegration(): error: undefined reference to 'QString::toLower_helper(QString&)'
.obj/qguiapplication.o:qguiapplication.cpp:function updateBlockedStatusRecursion(QWindow*, bool): error: undefined reference to 'QCoreApplication::notifyInternal2(QObject*, QEvent*)'
.obj/qguiapplication.o:qguiapplication.cpp:function QGuiApplicationPrivate::showModalWindow(QWindow*): error: undefined reference to 'QCoreApplication::notifyInternal2(QObject*, QEvent*)'
.obj/qguiapplication.o:qguiapplication.cpp:function QGuiApplicationPrivate::init(): error: undefined reference to 'QDebug::putByteArray(char const*, unsigned int, QDebug::Latin1Content)'
.obj/qguiapplication.o:qguiapplication.cpp:function QGuiApplicationPrivate::init(): error: undefined reference to 'qEnvironmentVariableIntValue(char const*, bool*)'
.obj/qguiapplication.o:qguiapplication.cpp:function QGuiApplicationPrivate::init(): error: undefined reference to 'QByteArray::toLower_helper(QByteArray&)'
.obj/qguiapplication.o:qguiapplication.cpp:function QGuiApplicationPrivate::init(): error: undefined reference to 'QDebug::putString(QChar const*, unsigned int)'
.obj/qguiapplication.o:qguiapplication.cpp:function QGuiApplicationPrivate::init(): error: undefined reference to 'QString::toLower_helper(QString&)'
.obj/qwindow.o:qwindow.cpp:function operator<<(QDebug, QWindow const*): error: undefined reference to 'qt_QMetaEnum_debugOperator(QDebug&, int, QMetaObject const*, char const*)'
.obj/qwindow.o:qwindow.cpp:function operator<<(QDebug, QWindow const*): error: undefined reference to 'qt_QMetaEnum_debugOperator(QDebug&, int, QMetaObject const*, char const*)'
.obj/qwindow.o:qwindow.cpp:function operator<<(QDebug, QWindow const*): error: undefined reference to 'qt_QMetaEnum_flagDebugOperator(QDebug&, unsigned long long, QMetaObject const*, char const*)'
.obj/qwindow.o:qwindow.cpp:function operator<<(QDebug, QWindow const*): error: undefined reference to 'QDebug::putString(QChar const*, unsigned int)'
.obj/qwindow.o:qwindow.cpp:function QWindowPrivate::create(bool): error: undefined reference to 'qt_QMetaEnum_flagDebugOperator(QDebug&, unsigned long long, QMetaObject const*, char const*)'
.obj/qclipboard.o:qclipboard.cpp:function QClipboard::text(QString&, QClipboard::Mode) const: error: undefined reference to 'QString::operator=(QLatin1String)'
.obj/qcursor.o:qcursor.cpp:function operator<<(QDebug, QCursor const&): error: undefined reference to 'qt_QMetaEnum_debugOperator(QDebug&, int, QMetaObject const*, char const*)'
.obj/qdnd.o:qdnd.cpp:function imageReadMimeFormats(): error: undefined reference to 'QByteArray::toLower_helper(QByteArray const&)'
.obj/qdnd.o:qdnd.cpp:function imageWriteMimeFormats(): error: undefined reference to 'QByteArray::toLower_helper(QByteArray const&)'
.obj/qdnd.o:qdnd.cpp:function QInternalMimeData::renderDataHelper(QString const&, QMimeData const*): error: undefined reference to 'QByteArray::toUpper_helper(QByteArray&)'
.obj/qevent.o:qevent.cpp:function operator<<(QDebug, QEvent const*): error: undefined reference to 'QDebug::putByteArray(char const*, unsigned int, QDebug::Latin1Content)'
.obj/qevent.o:qevent.cpp:function operator<<(QDebug, QEvent const*): error: undefined reference to 'QDebug::putByteArray(char const*, unsigned int, QDebug::Latin1Content)'
.obj/qevent.o:qevent.cpp:function operator<<(QDebug, QEvent const*): error: undefined reference to 'QDebug::putByteArray(char const*, unsigned int, QDebug::Latin1Content)'
.obj/qkeysequence.o:qkeysequence.cpp:function QKeySequencePrivate::decodeString(QString const&, QKeySequence::SequenceFormat): error: undefined reference to 'QString::toLower_helper(QString const&)'
.obj/qkeysequence.o:qkeysequence.cpp:function QKeySequencePrivate::decodeString(QString const&, QKeySequence::SequenceFormat): error: undefined reference to 'QString::toLower_helper(QString const&)'
.obj/qscreen.o:qscreen.cpp:function operator<<(QDebug, QScreen const*): error: undefined reference to 'qt_QMetaEnum_debugOperator(QDebug&, int, QMetaObject const*, char const*)'
.obj/qhighdpiscaling.o:qhighdpiscaling.cpp:function QHighDpiScaling::initHighDpiScaling(): error: undefined reference to 'qEnvironmentVariableIntValue(char const*, bool*)'
.obj/qhighdpiscaling.o:qhighdpiscaling.cpp:function QHighDpiScaling::initHighDpiScaling(): error: undefined reference to 'QByteArray::toLower_helper(QByteArray&)'
.obj/qimage.o:qimage.cpp:function operator<<(QDebug, QImage const&): error: undefined reference to 'QDebug::resetFormat()'
.obj/qimage.o:qimage.cpp:function QImage::text(QString const&) const: error: undefined reference to 'QString::simplified_helper(QString const&)'
.obj/qimagereader.o:qimagereader.cpp:function createReadHandlerHelper(QIODevice*, QByteArray const&, bool, bool): error: undefined reference to 'QByteArray::toLower_helper(QByteArray const&)'
.obj/qimagereader.o:qimagereader.cpp:function QImageReaderPrivate::getText() [clone .part.30]: error: undefined reference to 'QString::simplified_helper(QString const&)'
.obj/qimagereader.o:qimagereader.cpp:function QImageReaderPrivate::getText() [clone .part.30]: error: undefined reference to 'QString::simplified_helper(QString&)'
.obj/qimagereader.o:qimagereader.cpp:function QImageReaderPrivate::initHandler(): error: undefined reference to 'QByteArray::toLower_helper(QByteArray const&)'
.obj/qimagewriter.o:qimagewriter.cpp:function QImageWriter::setText(QString const&, QString const&): error: undefined reference to 'QString::simplified_helper(QString const&)'
.obj/qimagewriter.o:qimagewriter.cpp:function QImageWriter::setText(QString const&, QString const&): error: undefined reference to 'QString::simplified_helper(QString const&)'
.obj/qpixmap.o:qpixmap.cpp:function operator<<(QDebug, QPixmap const&): error: undefined reference to 'QDebug::resetFormat()'
.obj/qicon.o:qicon.cpp:function operator<<(QDebug, QIcon const&): error: undefined reference to 'QDebug::resetFormat()'
.obj/qiconloader.o:qiconloader.cpp:function QIconLoader::findIconHelper(QString const&, QString const&, QStringList&) const: error: undefined reference to 'QString::trimmed_helper(QString const&)'
.obj/qppmhandler.o:qppmhandler.cpp:function QPpmHandler::setOption(QImageIOHandler::ImageOption, QVariant const&): error: undefined reference to 'QByteArray::toLower_helper(QByteArray&)'
.obj/qxbmhandler.o:qxbmhandler.cpp:function read_xbm_header(QIODevice*, int&, int&): error: undefined reference to 'QByteArray::trimmed_helper(QByteArray&)'
.obj/qxbmhandler.o:qxbmhandler.cpp:function read_xbm_header(QIODevice*, int&, int&): error: undefined reference to 'QByteArray::trimmed_helper(QByteArray&)'
.obj/qxpmhandler.o:qxpmhandler.cpp:function read_xpm_body(QIODevice*, char const* const*, int&, QByteArray&, int, int, int, int, QImage&): error: undefined reference to 'QByteArray::simplified_helper(QByteArray&)'
.obj/qxpmhandler.o:qxpmhandler.cpp:function read_xpm_body(QIODevice*, char const* const*, int&, QByteArray&, int, int, int, int, QImage&): error: undefined reference to 'QByteArray::trimmed_helper(QByteArray&)'
.obj/qxpmhandler.o:qxpmhandler.cpp:function read_xpm_body(QIODevice*, char const* const*, int&, QByteArray&, int, int, int, int, QImage&): error: undefined reference to 'QByteArray::toLower_helper(QByteArray&)'
.obj/qxpmhandler.o:qxpmhandler.cpp:function QXpmHandler::write(QImage const&): error: undefined reference to 'QString::asprintf(char const*, ...)'
.obj/qxpmhandler.o:qxpmhandler.cpp:function QXpmHandler::write(QImage const&): error: undefined reference to 'QString::asprintf(char const*, ...)'
.obj/qpnghandler.o:qpnghandler.cpp:function QPNGImageWriter::writeImage(QImage const&, int, QString const&, int, int): error: undefined reference to 'QString::simplified_helper(QString&)'
.obj/qfont.o:qfont.cpp:function QFont::substitute(QString const&): error: undefined reference to 'QString::toLower_helper(QString const&)'
.obj/qfontsubset.o:qfontsubset.cpp:function QFontSubset::toTruetype() const: error: undefined reference to 'QString::operator=(QLatin1String)'
.obj/qfontsubset.o:qfontsubset.cpp:function QFontSubset::toTruetype() const: error: undefined reference to 'QString::operator=(QLatin1String)'
.obj/qfontsubset.o:qfontsubset.cpp:function QFontSubset::toTruetype() const: error: undefined reference to 'QString::operator=(QLatin1String)'
.obj/qfontdatabase.o:qfontdatabase.cpp:function QFontDatabase::load(QFontPrivate const*, int): error: undefined reference to 'QString::trimmed_helper(QString const&)'
.obj/qtextdocument.o:qtextdocument.cpp:function findInBlock(QTextBlock const&, QRegularExpression const&, int, QFlags<QTextDocument::FindFlag>, QTextCursor*): error: undefined reference to 'QString::lastIndexOf(QRegularExpression const&, int, QRegularExpressionMatch*) const'
.obj/qtextdocument.o:qtextdocument.cpp:function findInBlock(QTextBlock const&, QRegularExpression const&, int, QFlags<QTextDocument::FindFlag>, QTextCursor*): error: undefined reference to 'QString::indexOf(QRegularExpression const&, int, QRegularExpressionMatch*) const'
.obj/qtexthtmlparser.o:qtexthtmlparser.cpp:function setWidthAttribute(QTextLength*, QString): error: undefined reference to 'QString::trimmed_helper(QString const&)'
.obj/qtexthtmlparser.o:qtexthtmlparser.cpp:function QTextHtmlParser::parseCloseTag(): error: undefined reference to 'QString::trimmed_helper(QString&)'
.obj/qcssparser.o:qcssparser.cpp:function parseColorValue(QCss::Value): error: undefined reference to 'QString::trimmed_helper(QString const&)'
.obj/qtextodfwriter.o:qtextodfwriter.cpp:function QTextOdfWriter::writeBlockFormat(QXmlStreamWriter&, QTextBlockFormat, int) const: error: undefined reference to 'qt_QMetaEnum_flagDebugOperator(QDebug&, unsigned long long, QMetaObject const*, char const*)'
.obj/qcolor.o:qcolor.cpp:function QColor::name(QColor::NameFormat) const: error: undefined reference to 'QString::asprintf(char const*, ...)'
.obj/qcolor.o:qcolor.cpp:function QColor::name(QColor::NameFormat) const: error: undefined reference to 'QString::asprintf(char const*, ...)'
.obj/qvalidator.o:qvalidator.cpp:function QDoubleValidator::validate(QString&, int&) const: error: undefined reference to 'QLocaleData::validateChars(QString const&, QLocaleData::NumberMode, QByteArray*, int, bool) const'
.obj/qvalidator.o:qvalidator.cpp:function QIntValidator::validate(QString&, int&) const: error: undefined reference to 'QLocaleData::validateChars(QString const&, QLocaleData::NumberMode, QByteArray*, int, bool) const'
.obj/qvalidator.o:qvalidator.cpp:function QIntValidator::fixup(QString&) const: error: undefined reference to 'QLocaleData::validateChars(QString const&, QLocaleData::NumberMode, QByteArray*, int, bool) const'
.obj/qvalidator.o:qvalidator.cpp:function QDoubleValidatorPrivate::validateWithLocale(QString&, QLocaleData::NumberMode, QLocale const&) const: error: undefined reference to 'QLocaleData::validateChars(QString const&, QLocaleData::NumberMode, QByteArray*, int, bool) const'
.obj/qopengl.o:qopengl.cpp:function (anonymous namespace)::VersionTerm::matches(QVersionNumber const&) const: error: undefined reference to 'QVersionNumber::compare(QVersionNumber const&, QVersionNumber const&)'
.obj/qopengl.o:qopengl.cpp:function (anonymous namespace)::VersionTerm::matches(QVersionNumber const&) const: error: undefined reference to 'QVersionNumber::compare(QVersionNumber const&, QVersionNumber const&)'
.obj/qopengl.o:qopengl.cpp:function (anonymous namespace)::VersionTerm::matches(QVersionNumber const&) const: error: undefined reference to 'QVersionNumber::compare(QVersionNumber const&, QVersionNumber const&)'
.obj/qopengl.o:qopengl.cpp:function (anonymous namespace)::VersionTerm::matches(QVersionNumber const&) const: error: undefined reference to 'QVersionNumber::compare(QVersionNumber const&, QVersionNumber const&)'
.obj/qopengl.o:qopengl.cpp:function (anonymous namespace)::VersionTerm::fromJson(QJsonValue const&): error: undefined reference to 'QVersionNumber::fromString(QString const&, int*)'
.obj/qopengl.o:qopengl.cpp:function operator<<(QDebug, QOpenGLConfig::Gpu const&): error: undefined reference to 'operator<<(QDebug, QVersionNumber const&)'
.obj/qopengl.o:qopengl.cpp:function QOpenGLConfig::gpuFeatures(QOpenGLConfig::Gpu const&, QJsonDocument const&): error: undefined reference to 'QSysInfo::kernelVersion()'
.obj/qopengl.o:qopengl.cpp:function QOpenGLConfig::gpuFeatures(QOpenGLConfig::Gpu const&, QJsonDocument const&): error: undefined reference to 'QVersionNumber::fromString(QString const&, int*)'
.obj/qopengl.o:qopengl.cpp:function QOpenGLConfig::gpuFeatures(QOpenGLConfig::Gpu const&, QString const&): error: undefined reference to 'QSysInfo::kernelVersion()'
.obj/qopengl.o:qopengl.cpp:function QOpenGLConfig::gpuFeatures(QOpenGLConfig::Gpu const&, QString const&): error: undefined reference to 'QVersionNumber::fromString(QString const&, int*)'
collect2: error: ld returned 1 exit status
Makefile:1205: recipe for target '../../lib/libQt5Gui.so.5.6.0' failed
make[2]: *** [../../lib/libQt5Gui.so.5.6.0] Error 1
make[2]: Leaving directory '/home/james/raspi/qtbase/src/gui'
Makefile:497: recipe for target 'sub-gui-make_first' failed
make[1]: *** [sub-gui-make_first] Error 2
make[1]: Leaving directory '/home/james/raspi/qtbase/src'
Makefile:45: recipe for target 'sub-src-make_first' failed
make: *** [sub-src-make_first] Error 2

I've tried adding a -no-warnings-are-errors flag during ./configure , as well as cross compiling from the 5.5 (release) QT branch. The 5.5 branch breaks on the configure step.

Is there somewhere I can link/specify sources/add headers?

Seems like a qt5-default package on my raspbian image was causing the problem. Coming from a clean slate or doing sudo apt-get remove qt5-default solved the problem.

Seems like a qt5-default package on my raspbian image was causing the problem.

Just in case it helps someone else, removing qt5-default on the PI and re-running the rsync commands isn't sufficient. I had to remove the sysroot directory and re-run the rsync commands to get Qt to compile.

I don't know if it was necessary but I also purged all of the qt5 packages from the Pi.

Just removing qt5-default was not enough.

I had to remove any references to pre-installed qt 5 libraries to make the build succeed.

From a previous attempt to cross-compile, following someone else's recipe, I had a libqt5core5 installed which depended on a bunch of additional qt5 libs.

Once libqt5core5 was removed the linking process succeeded. Of course, this also required to recreate the sysroot folder as the libraries on the Pi had changed.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM