关于qt:本机在树莓派pi上构建qt5.7.1会得到错误:/usr/lib/arm-linux-gnueabihf/libQt5Quick.so.5:未定义引用`QV8Engine :: toVariant

native build qt5.7.1 on raspberry pi get errors: /usr/lib/arm-linux-gnueabihf/libQt5Quick.so.5: undefined reference to `QV8Engine::toVariant

我试图按照以下说明在pi3上构建qt 5.7.1:
https://wiki.qt.io/Native_Build_of_Qt_5.4.1_on_a_Raspberry_Pi

我使用的源码包是:
qt-everywhere-opensource-src-5.7.1.tar

配置为:

./configure -v -opengl es2 -force-pkg-config -device linux-rpi3-g ++ -device-option CROSS_COMPILE = / usr / bin / -opensource -confirm-license -optimized-qmake -reduce-exports -release -qt -pcre -qt-xcb -make libs -no-use-gold-linker -prefix / usr / local / qt5

该指令使用" linux-rasp-pi-g ++",但我认为对于Rpi3应该是linux-rpi3-g ++。

做,我得到像这样的错误:

/usr/bin/g++ -Wl,-rpath-link,/opt/vc/lib
-Wl,-rpath-link,/usr/lib/arm-linux-gnueabihf -Wl,-rpath-link,/lib/arm-linux-gnueabihf -mfloat-abi=hard -Wl,--gc-sections -Wl,-O1 -Wl,--enable-new-dtags -Wl,-z,origin -Wl,-rpath,\$ORIGIN/../lib -Wl,-rpath-link,/home/pi/download/qt-everywhere-opensource-src-5.7.1/qtdeclarative/lib
-Wl,-rpath-link,/home/pi/download/qt-everywhere-opensource-src-5.7.1/qtbase/lib
-o ../../bin/qmltestrunner .obj/main.o -L/home/pi/download/qt-everywhere-opensource-src-5.7.1/qtdeclarative/lib
-lQt5QuickTest -L/home/pi/download/qt-everywhere-opensource-src-5.7.1/qtbase/lib -lQt5Widgets -lQt5Gui -lQt5Qml -lQt5Network -lQt5Test -lQt5Core -lGLESv2 -lpthread /usr/lib/arm-linux-gnueabihf/libQt5Quick.so.5: undefined reference to QV8Engine::toVariant(QV4::ValueRef, int)'
/usr/lib/arm-linux-gnueabihf/libQt5Quick.so.5: undefined reference to
QQmlProfilerService::dataReady(QQmlAbstractProfilerAdapter*)'
/usr/lib/arm-linux-gnueabihf/libQt5Quick.so.5: undefined reference to
QV4::ExecutionContext::throwTypeError()'
/usr/lib/arm-linux-gnueabihf/libQt5Quick.so.5: undefined reference to
QV4::Object::markObjects(QV4::Managed*, QV4::ExecutionEngine*)'
/usr/lib/arm-linux-gnueabihf/libQt5Quick.so.5: undefined reference to
QQmlEngineDebugService::instance()'
/usr/lib/arm-linux-gnueabihf/libQt5Quick.so.5: undefined reference to
QV8Engine::fromVariant(QVariant const&)'
/usr/lib/arm-linux-gnueabihf/libQt5Quick.so.5: undefined reference to
QV4::PersistentValue::operator=(unsigned long long)'
/usr/lib/arm-linux-gnueabihf/libQt5Quick.so.5: undefined reference to
QQmlValueType::qt_metacast(char const*)'
/home/pi/download/qt-everywhere-opensource-src-5.7.1/qtdeclarative/lib/libQt5QuickTest.so: undefined reference to QQuickItem::y() const@Qt_5'
/home/pi/download/qt-everywhere-opensource-src-5.7.1/qtdeclarative/lib/libQt5QuickTest.so: undefined reference to
QQuickView::errors() const@Qt_5'
/usr/lib/arm-linux-gnueabihf/libQt5Quick.so.5: undefined reference to
QV4::Managed::engine() const'
/usr/lib/arm-linux-gnueabihf/libQt5Quick.so.5: undefined reference to
QV4::ExecutionEngine::newErrorObject(QV4::ValueRef)'
/usr/lib/arm-linux-gnueabihf/libQt5Quick.so.5: undefined reference to
QQmlBinding::property() const'
/usr/lib/arm-linux-gnueabihf/libQt5Quick.so.5: undefined reference to
QQmlCustomParser::bindingIdentifier(QV4::CompiledData::Binding
const*)' /usr/lib/arm-linux-gnueabihf/libQt5Quick.so.5: undefined
reference to QV4::ExecutionContext::throwError(QString const&)'
/usr/lib/arm-linux-gnueabihf/libQt5Quick.so.5: undefined reference to
QQmlBinding::Invalid' /usr/lib/arm-linux-gnueabihf/libQt5Quick.so.5:
undefined reference to QQmlAbstractBinding::vTables'
/usr/lib/arm-linux-gnueabihf/libQt5Quick.so.5: undefined reference to
QV4::ExecutionContext::throwError(QV4::ValueRef)'
/usr/lib/arm-linux-gnueabihf/libQt5Quick.so.5: undefined reference to
QV4::Object::call(QV4::Managed*, QV4::CallData*)'
/usr/lib/arm-linux-gnueabihf/libQt5Quick.so.5: undefined reference to
QQmlBinding::createBinding(int, QObject*, QQmlContext*)'
/usr/lib/arm-linux-gnueabihf/libQt5Quick.so.5: undefined reference to
QV4::Managed::operator new(unsigned int, QV4::MemoryManager*)'
/home/pi/download/qt-everywhere-opensource-src-5.7.1/qtdeclarative/lib/libQt5QuickTest.so: undefined reference to
QQuickItem::height() const@Qt_5'
/usr/lib/arm-linux-gnueabihf/libQt5Quick.so.5: undefined reference to
QV4::Object::setLookup(QV4::Managed*, QV4::Lookup*, QV4::ValueRef)'
/usr/lib/arm-linux-gnueabihf/libQt5Quick.so.5: undefined reference to
QV4::PersistentValue::PersistentValue(QV4::ValueRef)'
/usr/lib/arm-linux-gnueabihf/libQt5Quick.so.5: undefined reference to
QQmlValueType::qt_metacall(QMetaObject::Call, int, void**)'
/usr/lib/arm-linux-gnueabihf/libQt5Quick.so.5: undefined reference to
QQmlProfilerService::addGlobalProfiler(QQmlAbstractProfilerAdapter*)'
/home/pi/download/qt-everywhere-opensource-src-5.7.1/qtdeclarative/lib/libQt5QuickTest.so: undefined reference to QQuickView::QQuickView(QWindow*)@Qt_5'
/usr/lib/arm-linux-gnueabihf/libQt5Quick.so.5: undefined reference to
QV4::Object::putIndexed(QV4::Managed*, unsigned int, QV4::ValueRef)'
/usr/lib/arm-linux-gnueabihf/libQt5Quick.so.5: undefined reference to
QV4::Object::put(QV4::Managed*, QV4::StringRef, QV4::ValueRef)'
/usr/lib/arm-linux-gnueabihf/libQt5Quick.so.5: undefined reference to
QV4::Object::Object(QV4::ExecutionEngine*)'
/usr/lib/arm-linux-gnueabihf/libQt5Quick.so.5: undefined reference to
QQmlValueType::staticMetaObject'
/usr/lib/arm-linux-gnueabihf/libQt5Quick.so.5: undefined reference to
QShortcutMap::tryShortcutEvent(QObject*, QKeyEvent*)'
/usr/lib/arm-linux-gnueabihf/libQt5Quick.so.5: undefined reference to
QQmlProfilerService::instance()'
/home/pi/download/qt-everywhere-opensource-src-5.7.1/qtdeclarative/lib/libQt5QuickTest.so: undefined reference to
QQuickView::engine() const@Qt_5'
/usr/lib/arm-linux-gnueabihf/libQt5Quick.so.5: undefined reference to
QV4::Object::getLookup(QV4::Managed*, QV4::Lookup*)'
/home/pi/download/qt-everywhere-opensource-src-5.7.1/qtdeclarative/lib/libQt5QuickTest.so: undefined reference to
QQuickView::setSource(QUrl const&)@Qt_5'
/usr/lib/arm-linux-gnueabihf/libQt5Quick.so.5: undefined reference to
QV4::PersistentValue::operator=(QV4::ValueRef)'
/usr/lib/arm-linux-gnueabihf/libQt5Quick.so.5: undefined reference to
QV4::ArrayData::realloc(QV4::Object*, QV4::ArrayData::Type, unsigned
int, unsigned int, bool)'
/usr/lib/arm-linux-gnueabihf/libQt5Quick.so.5: undefined reference to
QQmlInspectorService::addView(QObject*)'
/usr/lib/arm-linux-gnueabihf/libQt5Quick.so.5: undefined reference to
QQmlPropertyPrivate::setBinding(QQmlProperty const&,
QQmlAbstractBinding*, QFlags)'
/usr/lib/arm-linux-gnueabihf/libQt5Quick.so.5: undefined reference to
QQmlComponentPrivate::initializeObjectWithInitialProperties(QV4::ValueRef,
QV4::ValueRef, QObject*)'
/home/pi/download/qt-everywhere-opensource-src-5.7.1/qtdeclarative/lib/libQt5QuickTest.so: undefined reference to
QQuickItem::staticMetaObject@Qt_5'
/usr/lib/arm-linux-gnueabihf/libQt5Quick.so.5: undefined reference to
QQmlValueType::QQmlValueType(int, QObject*)'
/home/pi/download/qt-everywhere-opensource-src-5.7.1/qtdeclarative/lib/libQt5QuickTest.so: undefined reference to
QQuickItem::x() const@Qt_5'
/usr/lib/arm-linux-gnueabihf/libQt5Quick.so.5: undefined reference to
QQmlDebugStream::QQmlDebugStream(QByteArray*,
QFlags)'
/home/pi/download/qt-everywhere-opensource-src-5.7.1/qtdeclarative/lib/libQt5QuickTest.so: undefined reference to
QQuickItem::window() const@Qt_5'
/usr/lib/arm-linux-gnueabihf/libQt5Quick.so.5: undefined reference to
QV4::Object::~Object()'
/home/pi/download/qt-everywhere-opensource-src-5.7.1/qtdeclarative/lib/libQt5QuickTest.so: undefined reference to
QQuickItem::mapToScene(QPointF const&)
const@Qt_5' /usr/lib/arm-linux-gnueabihf/libQt5Quick.so.5: undefined
reference to QV4::Object::deleteProperty(QV4::Managed*,
QV4::StringRef)'
/home/pi/download/qt-everywhere-opensource-src-5.7.1/qtdeclarative/lib/libQt5QuickTest.so: undefined reference to
QQuickView::rootContext() const@Qt_5'
/usr/lib/arm-linux-gnueabihf/libQt5Quick.so.5: undefined reference to
QV4::Object::getIndexed(QV4::Managed*, unsigned int, bool*)'
/usr/lib/arm-linux-gnueabihf/libQt5Quick.so.5: undefined reference to
QQmlDebugService::isDebuggingEnabled()'
/usr/lib/arm-linux-gnueabihf/libQt5Quick.so.5: undefined reference to
QV4::Object::destroy(QV4::Managed*)'
/home/pi/download/qt-everywhere-opensource-src-5.7.1/qtdeclarative/lib/libQt5QuickTest.so: undefined reference to
QQuickWindow::grabWindow()@Qt_5'
/usr/lib/arm-linux-gnueabihf/libQt5Quick.so.5: undefined reference to
QQmlValueType::metaObject() const'
/usr/lib/arm-linux-gnueabihf/libQt5Quick.so.5: undefined reference to
QQmlAbstractBinding::weakPointer()'
/usr/lib/arm-linux-gnueabihf/libQt5Quick.so.5: undefined reference to
QV4::Object::get(QV4::Managed*, QV4::StringRef, bool*)'
/usr/lib/arm-linux-gnueabihf/libQt5Quick.so.5: undefined reference to
QOpenGLContextPrivate::globalShareContext()'
/usr/lib/arm-linux-gnueabihf/libQt5Quick.so.5: undefined reference to
QV4::Managed::setVTable(QV4::ManagedVTable const*)'
/usr/lib/arm-linux-gnueabihf/libQt5Quick.so.5: undefined reference to
QQmlEngineDebugService::setStatesDelegate(QQmlDebugStatesDelegate*)'
/home/pi/download/qt-everywhere-opensource-src-5.7.1/qtdeclarative/lib/libQt5QuickTest.so: undefined reference to QQuickView::status() const@Qt_5'
/usr/lib/arm-linux-gnueabihf/libQt5Quick.so.5: undefined reference to
QV4::Object::construct(QV4::Managed*, QV4::CallData*)'
/usr/lib/arm-linux-gnueabihf/libQt5Quick.so.5: undefined reference to
QQmlInspectorService::instance()'
/usr/lib/arm-linux-gnueabihf/libQt5Quick.so.5: undefined reference to
QV4::Object::query(QV4::Managed const*, QV4::StringRef)'
/home/pi/download/qt-everywhere-opensource-src-5.7.1/qtdeclarative/lib/libQt5QuickTest.so: undefined reference to QQuickItem::width() const@Qt_5'
/usr/lib/arm-linux-gnueabihf/libQt5Quick.so.5: undefined reference to
QV4::Object::defineAccessorProperty(QV4::StringRef, unsigned long
long ()(QV4::CallContext), unsigned long long
()(QV4::CallContext))'
/usr/lib/arm-linux-gnueabihf/libQt5Quick.so.5: undefined reference to
QV4::Object::advanceIterator(QV4::Managed*, QV4::ObjectIterator*,
QV4::StringRef, unsigned int*, QV4::Property*,
QV4::PropertyAttributes*)'
/usr/lib/arm-linux-gnueabihf/libQt5Quick.so.5: undefined reference to
QV4::String::simplifyString() const'
/usr/lib/arm-linux-gnueabihf/libQt5Quick.so.5: undefined reference to
`QQmlInspectorService::removeView(QObject*)' collect2: error: ld
returned 1 exit status Makefile:108: recipe for target
'../../bin/qmltestrunner' failed make[3]: *
[../../bin/qmltestrunner] Error 1 make[3]: Leaving directory
'/home/pi/download/qt-everywhere-opensource-src-5.7.1/qtdeclarative/tools/qmltestrunner'
Makefile:276: recipe for target 'sub-qmltestrunner-make_first' failed
make[2]: * [sub-qmltestrunner-make_first] Error 2

所以,我该如何解决这个问题?

谢谢。


我已经解决了这个问题,现在有一个新问题。

好。

在pi上原生构建qt之前,我通过以下方式安装了qt:
sudo apt-get install qt5-default和其他qt5软件包。

好。

虽然我有:
sudo apt-get删除那些软件包,它可能仍然有效。

好。

因此我格式化了SD卡并重新刻录了Raspbian映像,然后按照" make"的说明进行操作,问题就消失了。

好。

但是现在我有另一个问题。

好。

当我"进行安装"时,出现此错误:

好。

/ usr / bin / g ++ -Wl,-rpath-link,/ opt / vc / lib -Wl,-rpath-link,/ usr / lib / arm-linux-gnueabihf -Wl,-rpath-link,/ lib / arm -linux-gnueabihf -mfloat-abi = hard -Wl,-O1 -Wl,-启用新的dtags -Wl,-z,原始-Wl,-rpath, $ ORIGIN /../../ lib-共享-o libdeclarative_location.so .obj / location.o .obj / qdeclarativegeomapitemview.o .obj / qdeclarativegeoserviceprovider.o .obj / qdeclarativegeocodemodel.o .obj / qdeclarativegeoroutemodel.o .obj / qdeclarativegeoroute.o .obj / qdeclarativeogeoroutesegment .qq .o .obj。 viewdelegateincubator.o .obj / qdeclarativeplacecontentmodel.o .obj / qdeclarativesupportedcategoriesmodel.o .obj / qdeclarativesearchsuggestionmodel.o .obj / qdeclarativesearchresultmodel.o .obj / qdeclarativereviewmodel.o .obj / qdeclarativeplaceimagemodel.o .obj / qdeclarativecontacted o .obj / qdeclarativecategory.o .obj / qdeclarativeplace.o .obj / qdeclarativeplace属性OBJ / moc_qdeclarativecirclemapitem_p.o .OBJ / moc_qdeclarativerectanglemapitem_p.o .OBJ / moc_qdeclarativepolygonmapitem_p.o .OBJ / moc_qdeclarativepolylinemapitem_p.o .OBJ / moc_qdeclarativeroutemapitem_p.o .OBJ / moc_qdeclarativegeomapcopyrightsnotice_p.o .OBJ / moc_qquickgeocoordinateanimation_p.o .OBJ / moc_qdeclarativeplacecontentmodel.o的obj / moc_qdeclarative支持的类别model_p.o .obj / moc_qdeclarativesearchsuggestionmodel_p.o .obj / moc_qdeclar ativesearchresultmodel_p.o .obj / moc_qdeclarativereviewmodel_p.o .obj / moc_qdeclarativeplaceditorialmodel.o .obj / moc_qdeclarativecontactdetail_p.o .obj / moc_qdeclarativecategory_p.o.obj / moc_qdeclarativecategory_p.o o .obj / moc_qdeclarativeplaceuser_p.o .obj / moc_qdeclarativeratings_p.o .obj / moc_qdeclarativesupplier_p.o .obj / moc_qdeclarativesearchmodelbase.o -L = / opt / vc / lib -L ??/ home / pi / download / qt-everywhere-opensource-src -5.7.1 / qtlocation / lib -lQt5Location -L / home / pi / download / qt-everywhere-opensource-src-5.7.1 / qtbase / lib -L ??/ home / pi / download / qt-everywhere-opensource-src -5.7.1 / qtdeclarative / lib -lQt5Quick -lQt5Gui -lQt5Qml -lQt5Network -lQt5Positioning -lQt5Core -Wl,-rpath-link,/ opt / vc / lib -lGLESv2 -lpthread -lclip2tri -L / home / pi / download / qtt -everywhere-opensource-src-5.7.1 / qtlocation / lib -lpoly2tri -lclipper

好。

/ usr / bin / ld:找不到-lclip2tri

好。

/ usr / bin / ld:找不到-lpoly2tri

好。

/ usr / bin / ld:找不到-lclipper

好。

collect2:错误:ld返回1退出状态

好。

Makefile:273:目标'../../../qml/QtLocation/libdeclarative_location.so'的配方失败

好。

make [4]:*** [../../../qml/QtLocation/libdeclarative_location.so]错误1
make [4]:离开目录'/home/pi/download/qt-everywhere-opensource-src-5.7.1/qtlocation/src/imports/location'

好。

Makefile:80:目标" sub-location-install_subtargets"的配方失败

好。

make [3]:*** [sub-location-install_subtargets]错误2

好。

make [3]:离开目录'/home/pi/download/qt-everywhere-opensource-src-5.7.1/qtlocation/src/imports'

好。

Makefile:135:目标" sub-imports-install_subtargets"的配方失败

好。

make [2]:*** [sub-imports-install_subtargets]错误2

好。

make [2]:离开目录'/home/pi/download/qt-everywhere-opensource-src-5.7.1/qtlocation/src'

好。

Makefile:56:目标" sub-src-install_subtargets"的配方失败

好。

make [1]:*** [sub-src-install_subtargets]错误2

好。

make [1]:离开目录'/home/pi/download/qt-everywhere-opensource-src-5.7.1/qtlocation'

好。

Makefile:844:目标"模块-qtlocation-install_subtargets"的配方失败

好。

制作:*** [module-qtlocation-install_subtargets]错误2

好。

我发现qtlocation / src / 3rdparty中有3个目录

好。

1
2
3
clip2tri
clipper
poly2tri

qtlocation / lib中的3个文件:

好。

1
2
3
libclip2tri.prl
libclipper.prl
libpoly2tri.prl

但没有lib文件。

好。

我检查了构建日志,似乎目录qtlocation / src / 3rdparty中的cpp文件未编译,

好。

cd 3rdparty / &&(test -e Makefile || /home/pi/download/qt-everywhere-opensource-src-5.7.1/qtbase/bin/qmake / home / pi / download / qt-everywhere-opensource-src- 5.7.1 / qtlocation / src / 3rdparty / 3rdparty.pro -qtconf /home/pi/download/qt-everywhere-opensource-src-5.7.1/qtbase/bin/qt.conf -o Makefile)&& make -f Makefile安装
make [3]:输入目录'/home/pi/download/qt-everywhere-opensource-src-5.7.1/qtlocation/src/3rdparty'

好。

cd poly2tri / &&(test -e Makefile || /home/pi/download/qt-everywhere-opensource-src-5.7.1/qtbase/bin/qmake / home / pi / download / qt-everywhere-opensource-src- 5.7.1 / qtlocation / src / 3rdparty / poly2tri / poly2tri.pro -qtconf /home/pi/download/qt-everywhere-opensource-src-5.7.1/qtbase/bin/qt.conf -o Makefile)&&制作- f Makefile安装

好。

make [4]:输入目录'/home/pi/download/qt-everywhere-opensource-src-5.7.1/qtlocation/src/3rdparty/poly2tri'

好。

make [4]:"安装"无需执行任何操作。

好。

make [4]:离开目录'/home/pi/download/qt-everywhere-opensource-src-5.7.1/qtlocation/src/3rdparty/poly2tri'

好。

cd clipper / &&(test -e Makefile || /home/pi/download/qt-everywhere-opensource-src-5.7.1/qtbase/bin/qmake / home / pi / download / qt-everywhere-opensource-src- 5.7.1 / qtlocation / src / 3rdparty / clipper / clipper.pro -qtconf /home/pi/download/qt-everywhere-opensource-src-5.7.1/qtbase/bin/qt.conf -o Makefile)&&制作- f Makefile安装

好。

make [4]:输入目录'/home/pi/download/qt-everywhere-opensource-src-5.7.1/qtlocation/src/3rdparty/clipper'

好。

make [4]:"安装"无需执行任何操作。

好。

make [4]:离开目录'/home/pi/download/qt-everywhere-opensource-src-5.7.1/qtlocation/src/3rdparty/clipper'

好。

cd clip2tri / &&(test -e Makefile || /home/pi/download/qt-everywhere-opensource-src-5.7.1/qtbase/bin/qmake / home / pi / download / qt-everywhere-opensource-src- 5.7.1 / qtlocation / src / 3rdparty / clip2tri / clip2tri.pro -qtconf / home / pi / download / qt-everywhere-opensource-src-5.7.1 / qtbase / bin / qt.conf -o Makefile)&&制作- f Makefile安装

好。

make [4]:输入目录'/home/pi/download/qt-everywhere-opensource-src-5.7.1/qtlocation/src/3rdparty/clip2tri'

好。

make [4]:"安装"无需执行任何操作。

好。

make [4]:离开目录'/home/pi/download/qt-everywhere-opensource-src-5.7.1/qtlocation/src/3rdparty/clip2tri'

好。

make [3]:离开目录'/home/pi/download/qt-everywhere-opensource-src-5.7.1/qtlocation/src/3rdparty'

好。

cd位置/ &&(测试-e Makefile || /home/pi/download/qt-everywhere-opensource-src-5.7.1/qtbase/bin/qmake / home / pi / download / qt-everywhere-opensource-src- 5.7.1 / qtlocation / src / location / location.pro -qtconf /home/pi/download/qt-everywhere-opensource-src-5.7.1/qtbase/bin/qt.conf -o Makefile)&& make -f Makefile安装
make [3]:输入目录'/home/pi/download/qt-everywhere-opensource-src-5.7.1/qtlocation/src/location'

好。

好。