Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Special Interest Groups
  3. QtonPi
  4. Has anyone successfully built Qt from source recently on a Pi?

Has anyone successfully built Qt from source recently on a Pi?

Scheduled Pinned Locked Moved Unsolved QtonPi
25 Posts 9 Posters 13.7k Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • msluserM msluser

    @ambershark
    Thanks for the help!

    I got past the xinerama.h error, but now I get

    /home/pi/build-qt/qtserialbus/lib/libQt5SerialBus.so: undefined reference to `QTcpServer::newConnection()@Qt_5'
    /home/pi/build-qt/qtserialbus/lib/libQt5SerialBus.so: undefined reference to `QTcpServer::QTcpServer(QObject*)@Qt_5'
    //usr/lib/arm-linux-gnueabihf/libQt5Network.so.5: undefined reference to `qt_safe_select(int, fd_set*, fd_set*, fd_set*, timespec const*)'
    /home/pi/build-qt/qtserialbus/lib/libQt5SerialBus.so: undefined reference to `QTcpServer::acceptError(QAbstractSocket::SocketError)@Qt_5'
    /home/pi/build-qt/qtserialbus/lib/libQt5SerialBus.so: undefined reference to `QTcpServer::close()@Qt_5'
    /home/pi/build-qt/qtserialbus/lib/libQt5SerialBus.so: undefined reference to `QHostAddress::~QHostAddress()@Qt_5'
    //usr/lib/arm-linux-gnueabihf/libQt5Network.so.5: undefined reference to `qIsEffectiveTLD(QString const&)'
    //usr/lib/arm-linux-gnueabihf/libQt5Network.so.5: undefined reference to `QNonContiguousByteDevice::disableReset()'
    /home/pi/build-qt/qtserialbus/lib/libQt5SerialBus.so: undefined reference to `QAbstractSocket::connected()@Qt_5'
    /home/pi/build-qt/qtserialbus/lib/libQt5SerialBus.so: undefined reference to `QAbstractSocket::peerName() const@Qt_5'
    /home/pi/build-qt/qtserialbus/lib/libQt5SerialBus.so: undefined reference to `QAbstractSocket::state() const@Qt_5'
    /home/pi/build-qt/qtserialbus/lib/libQt5SerialBus.so: undefined reference to `QAbstractSocket::staticMetaObject@Qt_5'
    /home/pi/build-qt/qtserialbus/lib/libQt5SerialBus.so: undefined reference to `QAbstractSocket::error(QAbstractSocket::SocketError)@Qt_5'
    /home/pi/build-qt/qtserialbus/lib/libQt5SerialBus.so: undefined reference to `QTcpServer::isListening() const@Qt_5'
    /home/pi/build-qt/qtserialbus/lib/libQt5SerialBus.so: undefined reference to `QAbstractSocket::peerAddress() const@Qt_5'
    /home/pi/build-qt/qtserialbus/lib/libQt5SerialBus.so: undefined reference to `QAbstractSocket::disconnected()@Qt_5'
    /home/pi/build-qt/qtserialbus/lib/libQt5SerialBus.so: undefined reference to `QTcpServer::errorString() const@Qt_5'
    /home/pi/build-qt/qtserialbus/lib/libQt5SerialBus.so: undefined reference to `QTcpSocket::QTcpSocket(QObject*)@Qt_5'
    /home/pi/build-qt/qtserialbus/lib/libQt5SerialBus.so: undefined reference to `QHostAddress::QHostAddress(QString const&)@Qt_5'
    /home/pi/build-qt/qtserialbus/lib/libQt5SerialBus.so: undefined reference to `QAbstractSocket::peerPort() const@Qt_5'
    /home/pi/build-qt/qtserialbus/lib/libQt5SerialBus.so: undefined reference to `QTcpServer::staticMetaObject@Qt_5'
    /home/pi/build-qt/qtserialbus/lib/libQt5SerialBus.so: undefined reference to `QTcpServer::listen(QHostAddress const&, unsigned short)@Qt_5'
    /home/pi/build-qt/qtserialbus/lib/libQt5SerialBus.so: undefined reference to `operator<<(QDebug, QHostAddress const&)@Qt_5'
    collect2: error: ld returned 1 exit status
    Makefile:80: recipe for target '../../../bin/canbusutil' failed
    make[4]: *** [../../../bin/canbusutil] Error 1
    make[4]: Leaving directory '/home/pi/build-qt/qtserialbus/src/tools/canbusutil'
    Makefile:42: recipe for target 'sub-canbusutil-make_first' failed
    make[3]: *** [sub-canbusutil-make_first] Error 2
    make[3]: Leaving directory '/home/pi/build-qt/qtserialbus/src/tools'
    Makefile:95: recipe for target 'sub-tools-make_first' failed
    make[2]: *** [sub-tools-make_first] Error 2
    make[2]: Leaving directory '/home/pi/build-qt/qtserialbus/src'
    Makefile:44: recipe for target 'sub-src-make_first' failed
    make[1]: *** [sub-src-make_first] Error 2
    make[1]: Leaving directory '/home/pi/build-qt/qtserialbus'
    Makefile:229: recipe for target 'module-qtserialbus-make_first' failed
    make: *** [module-qtserialbus-make_first] Error 2
    make: *** Waiting for unfinished jobs....
    

    Any ideas how to troubleshoot this one ?

    -Mark

    A Offline
    A Offline
    ambershark
    wrote on last edited by ambershark
    #15

    @msluser Lol scroll up... that problem was addressed in this thread already. ;)

    My L-GPL'd C++ Logger github.com/ambershark-mike/sharklog

    1 Reply Last reply
    0
    • msluserM Offline
      msluserM Offline
      msluser
      wrote on last edited by
      #16

      @ambershark

      Thank you for all of your help this far. As per your last recommendation, I executed

      sudo apt-get uninstall libqt5*
      

      I was able to get the "make" to run however the last thing it output was

      /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 --sysroot=/ -Wl,-O1 -Wl,--enable-new-dtags -Wl,-z,origin -Wl,-rpath,\$ORIGIN/../../../../lib -shared -o libqtlabsplatformplugin.so .obj/qtlabsplatformplugin.o .obj/qquickplatformcolordialog.o .obj/qquickplatformdialog.o .obj/qquickplatformfiledialog.o .obj/qquickplatformfolderdialog.o .obj/qquickplatformfontdialog.o .obj/qquickplatformiconloader.o .obj/qquickplatformmenu.o .obj/qquickplatformmenubar.o .obj/qquickplatformmenuitem.o .obj/qquickplatformmenuitemgroup.o .obj/qquickplatformmenuseparator.o .obj/qquickplatformmessagedialog.o .obj/qquickplatformstandardpaths.o .obj/qquickplatformsystemtrayicon.o .obj/qwidgetplatformcolordialog.o .obj/qwidgetplatformdialog.o .obj/qwidgetplatformfiledialog.o .obj/qwidgetplatformfontdialog.o .obj/qwidgetplatformmenu.o .obj/qwidgetplatformmenuitem.o .obj/qwidgetplatformmessagedialog.o .obj/qwidgetplatformsystemtrayicon.o .obj/moc_qquickplatformcolordialog_p.o .obj/moc_qquickplatformdialog_p.o .obj/moc_qquickplatformfiledialog_p.o .obj/moc_qquickplatformfolderdialog_p.o .obj/moc_qquickplatformfontdialog_p.o .obj/moc_qquickplatformmenu_p.o .obj/moc_qquickplatformmenubar_p.o .obj/moc_qquickplatformmenuitem_p.o .obj/moc_qquickplatformmenuitemgroup_p.o .obj/moc_qquickplatformmenuseparator_p.o .obj/moc_qquickplatformmessagedialog_p.o .obj/moc_qquickplatformstandardpaths_p.o .obj/moc_qquickplatformsystemtrayicon_p.o .obj/moc_qwidgetplatformcolordialog_p.o .obj/moc_qwidgetplatformfiledialog_p.o .obj/moc_qwidgetplatformfontdialog_p.o .obj/moc_qwidgetplatformmenu_p.o .obj/moc_qwidgetplatformmenuitem_p.o .obj/moc_qwidgetplatformmessagedialog_p.o .obj/moc_qwidgetplatformsystemtrayicon_p.o  -L=/opt/vc/lib -L/home/pi/build-qt/qtdeclarative/lib -lQt5Quick -L/home/pi/build-qt/qtbase/lib -lQt5Widgets -lQt5Gui -lQt5Qml -lQt5Network -lQt5Core -Wl,-rpath-link,//opt/vc/lib -lGLESv2 -lpthread -lQt5Quick -L=/opt/vc/lib -L/home/pi/build-qt/qtbase/lib -L/home/pi/build-qt/qtdeclarative/lib -lQt5Gui -lQt5Qml -lQt5Network -lQt5Core -lpthread 
      mv -f libqtlabsplatformplugin.so ../../../qml/Qt/labs/platform/ 
      make[4]: Leaving directory '/home/pi/build-qt/qtquickcontrols2/src/imports/platform'
      make[3]: Leaving directory '/home/pi/build-qt/qtquickcontrols2/src/imports'
      make[2]: Leaving directory '/home/pi/build-qt/qtquickcontrols2/src'
      make[1]: Leaving directory '/home/pi/build-qt/qtquickcontrols2'
      

      I am not sure that "make" was successful. What do you think?

      When I try and run

      make install
      

      This is the last part of the output

      make[3]: Entering directory '/home/pi/build-qt/qt3d/src/render'
      /usr/bin/g++ -c -include .pch/Qt53DRender -march=armv8-a -mtune=cortex-a53 -mfpu=crypto-neon-fp-armv8 -mfloat-abi=hard --sysroot=/ -O2 -std=c++1y -fvisibility=hidden -fvisibility-inlines-hidden -fno-exceptions -Wall -W -Wvla -D_REENTRANT -fPIC -DQT_NO_FOREACH -DQT_BUILD_3DRENDER_LIB -DQT_BUILDING_QT -DQT_NO_CAST_TO_ASCII -DQT_ASCII_CAST_WARNINGS -DQT_MOC_COMPAT -DQT_USE_QSTRINGBUILDER -DQT_DEPRECATED_WARNINGS -DQT_DISABLE_DEPRECATED_BEFORE=0x050000 -DQT_NO_EXCEPTIONS -D_LARGEFILE64_SOURCE -D_LARGEFILE_SOURCE -DQT_NO_DEBUG -DQT_3DCORE_LIB -DQT_GUI_LIB -DQT_NETWORK_LIB -DQT_CORE_LIB -DQT_OPENGLEXTENSIONS_LIB -DQT_GUI_LIB -DQT_CONCURRENT_LIB -DQT_CORE_LIB -I/home/pi/qt-everywhere-opensource-src-5.8.0/qt3d/src/render -I. -I/home/pi/qt-everywhere-opensource-src-5.8.0/qt3d/src/render/backend -I/home/pi/qt-everywhere-opensource-src-5.8.0/qt3d/src/render/geometry -I/home/pi/qt-everywhere-opensource-src-5.8.0/qt3d/src/render/graphicshelpers -I/home/pi/qt-everywhere-opensource-src-5.8.0/qt3d/src/render/framegraph -I/home/pi/qt-everywhere-opensource-src-5.8.0/qt3d/src/render/frontend -I/home/pi/qt-everywhere-opensource-src-5.8.0/qt3d/src/render/jobs -I/home/pi/qt-everywhere-opensource-src-5.8.0/qt3d/src/render/lights -I/home/pi/qt-everywhere-opensource-src-5.8.0/qt3d/src/render/materialsystem -I/home/pi/qt-everywhere-opensource-src-5.8.0/qt3d/src/render/renderstates -I/home/pi/qt-everywhere-opensource-src-5.8.0/qt3d/src/render/io -I/home/pi/qt-everywhere-opensource-src-5.8.0/qt3d/src/render/picking -I/home/pi/qt-everywhere-opensource-src-5.8.0/qt3d/src/render/raycasting -I/home/pi/qt-everywhere-opensource-src-5.8.0/qt3d/src/render/services -I/home/pi/qt-everywhere-opensource-src-5.8.0/qt3d/src/render/texture -I/home/pi/qt-everywhere-opensource-src-5.8.0/qt3d/include -I/home/pi/qt-everywhere-opensource-src-5.8.0/qt3d/include/Qt3DRender -I../../include -I../../include/Qt3DRender -I/home/pi/qt-everywhere-opensource-src-5.8.0/qt3d/include/Qt3DRender/5.8.0 -I/home/pi/qt-everywhere-opensource-src-5.8.0/qt3d/include/Qt3DRender/5.8.0/Qt3DRender -I/home/pi/qt-everywhere-opensource-src-5.8.0/qt3d/include/Qt3DCore/5.8.0 -I/home/pi/qt-everywhere-opensource-src-5.8.0/qt3d/include/Qt3DCore/5.8.0/Qt3DCore -I../../include/Qt3DCore/5.8.0 -I../../include/Qt3DCore/5.8.0/Qt3DCore -I/home/pi/qt-everywhere-opensource-src-5.8.0/qtbase/include/QtGui/5.8.0 -I/home/pi/qt-everywhere-opensource-src-5.8.0/qtbase/include/QtGui/5.8.0/QtGui -I/home/pi/build-qt/qtbase/include/QtGui/5.8.0 -I/home/pi/build-qt/qtbase/include/QtGui/5.8.0/QtGui -I/home/pi/qt-everywhere-opensource-src-5.8.0/qtbase/include/QtCore/5.8.0 -I/home/pi/qt-everywhere-opensource-src-5.8.0/qtbase/include/QtCore/5.8.0/QtCore -I/home/pi/build-qt/qtbase/include/QtCore/5.8.0 -I/home/pi/build-qt/qtbase/include/QtCore/5.8.0/QtCore -I/home/pi/qt-everywhere-opensource-src-5.8.0/qt3d/include/Qt3DCore -I../../include/Qt3DCore -I/home/pi/qt-everywhere-opensource-src-5.8.0/qtbase/include -I/home/pi/qt-everywhere-opensource-src-5.8.0/qtbase/include/QtGui -I/home/pi/build-qt/qtbase/include -I/home/pi/build-qt/qtbase/include/QtGui -I/home/pi/qt-everywhere-opensource-src-5.8.0/qtbase/include/QtNetwork -I/home/pi/build-qt/qtbase/include/QtNetwork -I/home/pi/qt-everywhere-opensource-src-5.8.0/qtbase/include/QtCore -I/home/pi/build-qt/qtbase/include/QtCore -I/home/pi/qt-everywhere-opensource-src-5.8.0/qtbase/include/QtOpenGLExtensions -I/home/pi/build-qt/qtbase/include/QtOpenGLExtensions -I/home/pi/qt-everywhere-opensource-src-5.8.0/qtbase/include/QtConcurrent -I/home/pi/build-qt/qtbase/include/QtConcurrent -I.moc -I=/opt/vc/include -I=/opt/vc/include/interface/vcos/pthreads -I=/opt/vc/include/interface/vmcs_host/linux -I/home/pi/qt-everywhere-opensource-src-5.8.0/qtbase/mkspecs/devices/linux-rpi3-g++ -o .obj/renderthread.o /home/pi/qt-everywhere-opensource-src-5.8.0/qt3d/src/render/backend/renderthread.cpp
      In file included from <command-line>:0:0:
      /usr/include/stdc-predef.h:59:1: error: one or more PCH files were found, but they were invalid
       #endif
       ^
      /usr/include/stdc-predef.h:59:1: error: use -Winvalid-pch for more information
      /usr/include/stdc-predef.h:59:1: fatal error: .pch/Qt53DRender: No such file or directory
      compilation terminated.
      Makefile:16610: recipe for target '.obj/renderthread.o' failed
      make[3]: *** [.obj/renderthread.o] Error 1
      make[3]: Leaving directory '/home/pi/build-qt/qt3d/src/render'
      Makefile:95: recipe for target 'sub-render-install_subtargets' failed
      make[2]: *** [sub-render-install_subtargets] Error 2
      make[2]: Leaving directory '/home/pi/build-qt/qt3d/src'
      Makefile:57: recipe for target 'sub-src-install_subtargets' failed
      make[1]: *** [sub-src-install_subtargets] Error 2
      make[1]: Leaving directory '/home/pi/build-qt/qt3d'
      Makefile:448: recipe for target 'module-qt3d-install_subtargets' failed
      make: *** [module-qt3d-install_subtargets] Error 2
      

      Obviously it didn't install correctly and there is an error. Is it because of my file /usr/include/stdc-predef.h or something else ?

      I appreciate your help @ambershark , thank you very much.

      -Mark

      A 1 Reply Last reply
      0
      • msluserM msluser

        @ambershark

        Thank you for all of your help this far. As per your last recommendation, I executed

        sudo apt-get uninstall libqt5*
        

        I was able to get the "make" to run however the last thing it output was

        /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 --sysroot=/ -Wl,-O1 -Wl,--enable-new-dtags -Wl,-z,origin -Wl,-rpath,\$ORIGIN/../../../../lib -shared -o libqtlabsplatformplugin.so .obj/qtlabsplatformplugin.o .obj/qquickplatformcolordialog.o .obj/qquickplatformdialog.o .obj/qquickplatformfiledialog.o .obj/qquickplatformfolderdialog.o .obj/qquickplatformfontdialog.o .obj/qquickplatformiconloader.o .obj/qquickplatformmenu.o .obj/qquickplatformmenubar.o .obj/qquickplatformmenuitem.o .obj/qquickplatformmenuitemgroup.o .obj/qquickplatformmenuseparator.o .obj/qquickplatformmessagedialog.o .obj/qquickplatformstandardpaths.o .obj/qquickplatformsystemtrayicon.o .obj/qwidgetplatformcolordialog.o .obj/qwidgetplatformdialog.o .obj/qwidgetplatformfiledialog.o .obj/qwidgetplatformfontdialog.o .obj/qwidgetplatformmenu.o .obj/qwidgetplatformmenuitem.o .obj/qwidgetplatformmessagedialog.o .obj/qwidgetplatformsystemtrayicon.o .obj/moc_qquickplatformcolordialog_p.o .obj/moc_qquickplatformdialog_p.o .obj/moc_qquickplatformfiledialog_p.o .obj/moc_qquickplatformfolderdialog_p.o .obj/moc_qquickplatformfontdialog_p.o .obj/moc_qquickplatformmenu_p.o .obj/moc_qquickplatformmenubar_p.o .obj/moc_qquickplatformmenuitem_p.o .obj/moc_qquickplatformmenuitemgroup_p.o .obj/moc_qquickplatformmenuseparator_p.o .obj/moc_qquickplatformmessagedialog_p.o .obj/moc_qquickplatformstandardpaths_p.o .obj/moc_qquickplatformsystemtrayicon_p.o .obj/moc_qwidgetplatformcolordialog_p.o .obj/moc_qwidgetplatformfiledialog_p.o .obj/moc_qwidgetplatformfontdialog_p.o .obj/moc_qwidgetplatformmenu_p.o .obj/moc_qwidgetplatformmenuitem_p.o .obj/moc_qwidgetplatformmessagedialog_p.o .obj/moc_qwidgetplatformsystemtrayicon_p.o  -L=/opt/vc/lib -L/home/pi/build-qt/qtdeclarative/lib -lQt5Quick -L/home/pi/build-qt/qtbase/lib -lQt5Widgets -lQt5Gui -lQt5Qml -lQt5Network -lQt5Core -Wl,-rpath-link,//opt/vc/lib -lGLESv2 -lpthread -lQt5Quick -L=/opt/vc/lib -L/home/pi/build-qt/qtbase/lib -L/home/pi/build-qt/qtdeclarative/lib -lQt5Gui -lQt5Qml -lQt5Network -lQt5Core -lpthread 
        mv -f libqtlabsplatformplugin.so ../../../qml/Qt/labs/platform/ 
        make[4]: Leaving directory '/home/pi/build-qt/qtquickcontrols2/src/imports/platform'
        make[3]: Leaving directory '/home/pi/build-qt/qtquickcontrols2/src/imports'
        make[2]: Leaving directory '/home/pi/build-qt/qtquickcontrols2/src'
        make[1]: Leaving directory '/home/pi/build-qt/qtquickcontrols2'
        

        I am not sure that "make" was successful. What do you think?

        When I try and run

        make install
        

        This is the last part of the output

        make[3]: Entering directory '/home/pi/build-qt/qt3d/src/render'
        /usr/bin/g++ -c -include .pch/Qt53DRender -march=armv8-a -mtune=cortex-a53 -mfpu=crypto-neon-fp-armv8 -mfloat-abi=hard --sysroot=/ -O2 -std=c++1y -fvisibility=hidden -fvisibility-inlines-hidden -fno-exceptions -Wall -W -Wvla -D_REENTRANT -fPIC -DQT_NO_FOREACH -DQT_BUILD_3DRENDER_LIB -DQT_BUILDING_QT -DQT_NO_CAST_TO_ASCII -DQT_ASCII_CAST_WARNINGS -DQT_MOC_COMPAT -DQT_USE_QSTRINGBUILDER -DQT_DEPRECATED_WARNINGS -DQT_DISABLE_DEPRECATED_BEFORE=0x050000 -DQT_NO_EXCEPTIONS -D_LARGEFILE64_SOURCE -D_LARGEFILE_SOURCE -DQT_NO_DEBUG -DQT_3DCORE_LIB -DQT_GUI_LIB -DQT_NETWORK_LIB -DQT_CORE_LIB -DQT_OPENGLEXTENSIONS_LIB -DQT_GUI_LIB -DQT_CONCURRENT_LIB -DQT_CORE_LIB -I/home/pi/qt-everywhere-opensource-src-5.8.0/qt3d/src/render -I. -I/home/pi/qt-everywhere-opensource-src-5.8.0/qt3d/src/render/backend -I/home/pi/qt-everywhere-opensource-src-5.8.0/qt3d/src/render/geometry -I/home/pi/qt-everywhere-opensource-src-5.8.0/qt3d/src/render/graphicshelpers -I/home/pi/qt-everywhere-opensource-src-5.8.0/qt3d/src/render/framegraph -I/home/pi/qt-everywhere-opensource-src-5.8.0/qt3d/src/render/frontend -I/home/pi/qt-everywhere-opensource-src-5.8.0/qt3d/src/render/jobs -I/home/pi/qt-everywhere-opensource-src-5.8.0/qt3d/src/render/lights -I/home/pi/qt-everywhere-opensource-src-5.8.0/qt3d/src/render/materialsystem -I/home/pi/qt-everywhere-opensource-src-5.8.0/qt3d/src/render/renderstates -I/home/pi/qt-everywhere-opensource-src-5.8.0/qt3d/src/render/io -I/home/pi/qt-everywhere-opensource-src-5.8.0/qt3d/src/render/picking -I/home/pi/qt-everywhere-opensource-src-5.8.0/qt3d/src/render/raycasting -I/home/pi/qt-everywhere-opensource-src-5.8.0/qt3d/src/render/services -I/home/pi/qt-everywhere-opensource-src-5.8.0/qt3d/src/render/texture -I/home/pi/qt-everywhere-opensource-src-5.8.0/qt3d/include -I/home/pi/qt-everywhere-opensource-src-5.8.0/qt3d/include/Qt3DRender -I../../include -I../../include/Qt3DRender -I/home/pi/qt-everywhere-opensource-src-5.8.0/qt3d/include/Qt3DRender/5.8.0 -I/home/pi/qt-everywhere-opensource-src-5.8.0/qt3d/include/Qt3DRender/5.8.0/Qt3DRender -I/home/pi/qt-everywhere-opensource-src-5.8.0/qt3d/include/Qt3DCore/5.8.0 -I/home/pi/qt-everywhere-opensource-src-5.8.0/qt3d/include/Qt3DCore/5.8.0/Qt3DCore -I../../include/Qt3DCore/5.8.0 -I../../include/Qt3DCore/5.8.0/Qt3DCore -I/home/pi/qt-everywhere-opensource-src-5.8.0/qtbase/include/QtGui/5.8.0 -I/home/pi/qt-everywhere-opensource-src-5.8.0/qtbase/include/QtGui/5.8.0/QtGui -I/home/pi/build-qt/qtbase/include/QtGui/5.8.0 -I/home/pi/build-qt/qtbase/include/QtGui/5.8.0/QtGui -I/home/pi/qt-everywhere-opensource-src-5.8.0/qtbase/include/QtCore/5.8.0 -I/home/pi/qt-everywhere-opensource-src-5.8.0/qtbase/include/QtCore/5.8.0/QtCore -I/home/pi/build-qt/qtbase/include/QtCore/5.8.0 -I/home/pi/build-qt/qtbase/include/QtCore/5.8.0/QtCore -I/home/pi/qt-everywhere-opensource-src-5.8.0/qt3d/include/Qt3DCore -I../../include/Qt3DCore -I/home/pi/qt-everywhere-opensource-src-5.8.0/qtbase/include -I/home/pi/qt-everywhere-opensource-src-5.8.0/qtbase/include/QtGui -I/home/pi/build-qt/qtbase/include -I/home/pi/build-qt/qtbase/include/QtGui -I/home/pi/qt-everywhere-opensource-src-5.8.0/qtbase/include/QtNetwork -I/home/pi/build-qt/qtbase/include/QtNetwork -I/home/pi/qt-everywhere-opensource-src-5.8.0/qtbase/include/QtCore -I/home/pi/build-qt/qtbase/include/QtCore -I/home/pi/qt-everywhere-opensource-src-5.8.0/qtbase/include/QtOpenGLExtensions -I/home/pi/build-qt/qtbase/include/QtOpenGLExtensions -I/home/pi/qt-everywhere-opensource-src-5.8.0/qtbase/include/QtConcurrent -I/home/pi/build-qt/qtbase/include/QtConcurrent -I.moc -I=/opt/vc/include -I=/opt/vc/include/interface/vcos/pthreads -I=/opt/vc/include/interface/vmcs_host/linux -I/home/pi/qt-everywhere-opensource-src-5.8.0/qtbase/mkspecs/devices/linux-rpi3-g++ -o .obj/renderthread.o /home/pi/qt-everywhere-opensource-src-5.8.0/qt3d/src/render/backend/renderthread.cpp
        In file included from <command-line>:0:0:
        /usr/include/stdc-predef.h:59:1: error: one or more PCH files were found, but they were invalid
         #endif
         ^
        /usr/include/stdc-predef.h:59:1: error: use -Winvalid-pch for more information
        /usr/include/stdc-predef.h:59:1: fatal error: .pch/Qt53DRender: No such file or directory
        compilation terminated.
        Makefile:16610: recipe for target '.obj/renderthread.o' failed
        make[3]: *** [.obj/renderthread.o] Error 1
        make[3]: Leaving directory '/home/pi/build-qt/qt3d/src/render'
        Makefile:95: recipe for target 'sub-render-install_subtargets' failed
        make[2]: *** [sub-render-install_subtargets] Error 2
        make[2]: Leaving directory '/home/pi/build-qt/qt3d/src'
        Makefile:57: recipe for target 'sub-src-install_subtargets' failed
        make[1]: *** [sub-src-install_subtargets] Error 2
        make[1]: Leaving directory '/home/pi/build-qt/qt3d'
        Makefile:448: recipe for target 'module-qt3d-install_subtargets' failed
        make: *** [module-qt3d-install_subtargets] Error 2
        

        Obviously it didn't install correctly and there is an error. Is it because of my file /usr/include/stdc-predef.h or something else ?

        I appreciate your help @ambershark , thank you very much.

        -Mark

        A Offline
        A Offline
        ambershark
        wrote on last edited by ambershark
        #17

        @msluser That error comes from using a dirty build from mixed Qt's. Since you cleaned up your Qt conflict (you didn't have to uninstall, but that works) you should now rebuild the entire Qt project.

        I would start with a completely fresh extract of the qt tar so you know it's 100% clean. Sometimes make distclean doesn't get everything.

        If you rebuild everything it should fix that pch on install. As for whether or not the build succeed that make output is definitely a success, the make install however failed.

        And you're welcome. :)

        My L-GPL'd C++ Logger github.com/ambershark-mike/sharklog

        vikramgV 1 Reply Last reply
        0
        • J Offline
          J Offline
          JHBR
          wrote on last edited by JHBR
          #18

          I've also struggled a lot with compiling Qt natively on the RPi3. I've tried to compile the new Qt 5.8 in hopes that the fact that it now uses Gstreamer1.0 instead of 0.10 would fix issues I have with an application that uses QSound and QMediaPlayer, both part of the QtMultimedia library.
          After a lot of trial and error and trailing forums, I have managed to successfully build Qt 5.8 from source.

          My environment:

          • Qt 5.8.1 from git://code.qt.io/qt/qt5.git
          • Raspberry Pi 3
          • Raspian version 8.0 Jessie
          • Kernel: 4.4.50-v7+ #970 SMP Mon Feb 20 19:18:29 GMT 2017

          I wrote a script that automates the process. If you run all its commands, it will install dependencies, clone the source of your choice, init the repo, build the source, install and then create a script that exports the necessarily globals, which is appended to startup scripts.
          I've pasted the whole script below, where you can see the options used for configure and what dependencies I made sure to install:

          #!/usr/bin/env bash
          set -exu
          
          ### SETTINGS
          MAIN_VER="5"
          VER="5.8"
          REPO="git://code.qt.io/qt/qt5.git"
          INST_DIR="/usr/local/qt$VER"
          CORES="4"
          B=$(pwd)
          SETUP="setup_qt"
          
          ### REPO INIT OPTIONS
          INIT_OPT=""
          INIT_OPT+="--module-subset=default,-qtwebkit,-qtwebkit-examples,-qtwebengine"
          
          ### CONFIGURATION OPTIONS
          CONF_OPT=""
          CONF_OPT+=" -v"
          CONF_OPT+=" -opensource"
          CONF_OPT+=" -confirm-license"
          CONF_OPT+=" -opengl es2"
          CONF_OPT+=" -device linux-rpi3-g++"
          CONF_OPT+=" -device-option CROSS_COMPILE=/usr/bin/"
          CONF_OPT+=" -sysroot /"
          CONF_OPT+=" -optimized-qmake"
          CONF_OPT+=" -reduce-exports"
          CONF_OPT+=" -release"
          CONF_OPT+=" -qpa xcb"		# Use xcb as default QPA backend
          CONF_OPT+=" -qt-pcre"		# Use the PCRE library bundled with Qt.
          CONF_OPT+=" -qt-libpng"	# Use the libpng bundled with Qt.
          CONF_OPT+=" -qt-xcb"		# Use xcb- libraries bundled with Qt.
          CONF_OPT+=" -make libs"	# Only make libraries (no tests, examples etc)
          CONF_OPT+=" -skip qtserialbus"	# Get error when compiling this package
          CONF_OPT+=" -skip qtwayland"	# Get error when compiling this package
          CONF_OPT+=" -skip qtscript"		# Get error when compiling this package
          CONF_OPT+=" -no-pch" # Some users have reported issues with using precomiled headers
          CONF_OPT+=" -no-use-gold-linker" # Seems to have issues with ARMv8
          
          
          ### DEPENDENCIES
          DEPS=""
          # Build tools
          DEPS+=" build-essential"
          DEPS+=" perl"
          DEPS+=" python"
          DEPS+=" git"
          DEPS+=" flex"
          DEPS+=" ruby"
          DEPS+=" gperf"
          DEPS+=" bison"
          # XCB/X11 support
          DEPS+=" ^libxcb.*"
          DEPS+=" libglu1-mesa-dev"
          DEPS+=" libx11-xcb-dev"
          DEPS+=" libxrender-dev"
          DEPS+=" libfontconfig1-dev"
          DEPS+=" libfreetype6-dev"
          DEPS+=" libx11-dev"
          DEPS+=" libxext-dev"
          DEPS+=" libxfixes-dev"
          DEPS+=" libxi-dev"
          DEPS+=" libxcb1-dev"
          DEPS+=" libxcb-glx0-dev"
          DEPS+=" libxcb-keysyms1-dev"
          DEPS+=" libxcb-image0-dev"
          DEPS+=" libxcb-shm0-dev"
          DEPS+=" libxcb-icccm4-dev"
          DEPS+=" libxcb-sync0-dev"
          DEPS+=" libxcb-xfixes0-dev"
          DEPS+=" libxcb-shape0-dev"
          DEPS+=" libxcb-randr0-dev"
          DEPS+=" libxcb-render-util0-dev"
          DEPS+=" libx11-xcb1"
          DEPS+=" libxcb-sync1"
          DEPS+=" libxcb-sync-dev"
          DEPS+=" libxcb-xinerama0"
          DEPS+=" libxcb-xinerama0-dev"
          DEPS+=" libx11-xcb1"
          DEPS+=" libxcb-sync1"
          DEPS+=" libxcb-sync-dev"
          # Sound support
          DEPS+=" libasound2-dev"
          DEPS+=" libpulse-dev"
          # Media support
          DEPS+=" libavcodec-dev"
          DEPS+=" libavformat-dev"
          DEPS+=" libswscale-dev"
          DEPS+=" gstreamer-tools"
          DEPS+=" libgstreamer1.0-dev"
          DEPS+=" libgstreamer-plugins-base1.0-dev"
          DEPS+=" gstreamer1.0-plugins-good"
          DEPS+=" gstreamer1.0-plugins-bad"
          DEPS+=" gstreamer1.0-plugins-ugly"
          DEPS+=" gstreamer1.0-libav"
          DEPS+=" gstreamer1.0-clutter"
          DEPS+=" gstreamer1.0-fluendo-mp3"
          DEPS+=" gstreamer1.0-pulseaudio"
          #DEPS+=" libgstreamer0.10-dev" # Not needed for Qt 5.8 and later
          #DEPS+=" libgstreamer-plugins-base0.10-dev"
          #DEPS+=" gstreamer0.10-plugins-good"
          #DEPS+=" gstreamer0.10-plugins-bad"
          #DEPS+=" gstreamer0.10-plugins-ugly"
          # XKB fixes for Qt5.4x
          DEPS+=" libxkbfile1"
          DEPS+=" x11-xkb-utils"
          DEPS+=" xkb-data"
          DEPS+=" libxkbfile-dev"
          # SQLite 3 support
          DEPS+=" libsqlite0-dev"
          DEPS+=" libsqlite3-dev"
          # SSL/TLS Support
          DEPS+=" libssl-dev"
          DEPS+=" gnutls-dev"
          DEPS+=" libgnutls28-dev"
          #	DEPS+=" libgnutls-openssl-dev" # Not available on debian
          DEPS+=" libsslcommon2-dev"
          # OpenCV support (for bottle rig)
          DEPS+=" libopencv-calib3d-dev"
          DEPS+=" libopencv-contrib-dev"
          DEPS+=" libopencv-core-dev"
          DEPS+=" libopencv-dev"
          DEPS+=" libopencv-features2d-dev"
          DEPS+=" libopencv-flann-dev"
          DEPS+=" libopencv-gpu-dev"
          DEPS+=" libopencv-highgui-dev"
          DEPS+=" libopencv-imgproc-dev"
          DEPS+=" libopencv-legacy-dev"
          DEPS+=" libopencv-ml-dev"
          DEPS+=" libopencv-objdetect-dev"
          DEPS+=" libopencv-video-dev"
          # Other
          DEPS+=" libdrm-dev" # Kernel DRM services
          DEPS+=" libgst-dev" # Smalltalk virtual machine
          DEPS+=" libjpeg62-turbo-dev" # JPEG
          DEPS+=" libpng12-dev" # PNG
          DEPS+=" firebird-dev" # Firebird
          DEPS+=" libmysqlclient-dev" # MySQL
          DEPS+=" libiodbc2-dev" # iODBC
          DEPS+=" libpq-dev" # PostgreSQL
          DEPS+=" freetds-dev" # Tabular DataStream
          DEPS+=" libcups2-dev" # Common UNIX Printing System
          DEPS+=" libglib2.0-dev" # GLib
          DEPS+=" libraspberrypi-dev" # EGL/GLES/OpenVG/etc. libraries for the Raspberry Pi's VideoCore IV
          DEPS+=" libxslt1-dev" # XML
          DEPS+=" libicu-dev" # Unicode
          DEPS+=" libudev-dev" # udev
          DEPS+=" libdbus-1-dev" # D-Bus
          
          do_prep(){
          	# Install depedencies
          	echo "-------------------- Installing depedencies"
          	sudo apt-get update
          	sudo apt-get install -y $DEPS 2>&1 | tee deps.out
          }
          
          do_clone(){
          	# Clone repo
          	echo "-------------------- Cloning repo: qt$VER"
          	git clone $REPO
          	cd "$B/qt$MAIN_VER"
          	git checkout $VER
          }
          
          do_init(){
          	# Initialize repo
          	cd "$B/qt$MAIN_VER"
          	echo "-------------------- Initializing repository"
          	./init-repository $INIT_OPT 2>&1 | tee init.out
          }
          
          do_conf(){
          	# Configure build
          	cd "$B/qt$MAIN_VER"
          	echo "-------------------- Configuring build"
          	MAKEFLAGS=-j$CORES ./configure $CONF_OPT -prefix $INST_DIR 2>&1 | tee config.out
          }
          
          do_build(){
          	# Build
          	cd "$B/qt$MAIN_VER"
          	echo "-------------------- Building qt$VER"
          	make -j$CORES 2>&1 | tee make.out
          }
          
          do_install(){
          	# Install
          	cd "$B/qt$MAIN_VER"
          	echo "-------------------- Installing in $INST_DIR"
          	sudo make install -j$CORES 2>&1 | tee install.out
          }
          
          do_exports(){
          	# Make startup script so export symbols
          	cd $B
          	> $SETUP.sh
          	echo "export LD_LIBRARY_PATH=$INST_DIR/lib" >> $SETUP.sh
          	echo "export PATH=$INST_DIR/bin:\$PATH" >> $SETUP.sh
          	echo "export QT_QPA_EGLFS_PHYSICAL_WIDTH=510" >> $SETUP.sh
          	echo "export QT_QPA_EGLFS_PHYSICAL_HEIGHT=290" >> $SETUP.sh
          
          	# Make the script executable and run it
          	chmod +x $SETUP.sh
          	./$SETUP.sh
          
          	# Append source to setup script in startup scripts
          	echo "source $B/$SETUP.sh" >> ~/.profile
          	echo "source $B/$SETUP.sh" >> ~/.bashrc
          }
          
          while [ "${1+defined}" ];
          do
          	case $1 in
          		prep* )    do_prep    ;;
          		clone* )   do_clone   ;;
          		init* )    do_init    ;;
          		conf* )    do_conf    ;;
          		build* )   do_build   ;;
          		install* ) do_install ;;
          		exports* ) do_exports ;;
          		*) echo "UNKNOWN COMMAND: '$1', SKIPPING..."	;;
          	esac
          	shift
          done
          
          
          echo "DONE"
          
          

          Note that I omit initializing QtWebkit in the repo to save time compiling as I didn't need it. I also skip compiling three libraries which would cause errors and prevent the remaining libraries from being compiled:

          • QtSerialbus
          • QtWayland
          • QtScript

          The source is downloaded and placed in a subdirectory where the script is run from (it can be run from anywhere you like).
          The script also writes the output of each process to a set of "<name>.out" files, most of which are placed in the source directory.
          To run the commands in the script, simply call it followed by the commands you want. E.g. if you name the script "qtFromGit.sh":

          $ <pathToScript>/qtFromGit.sh clone init conf build install exports
          

          Edit:
          Running the whole process on my Pi took right above 5 hours, using all 4 cores:

          real    303m23.636s
          user    1087m58.200s
          sys     47m28.890s
          

          Edit2: Grammar

          Of course, I'm still having issues with sound in my application, but that's another story fit for a separate thread...

          1 Reply Last reply
          1
          • A ambershark

            @msluser That error comes from using a dirty build from mixed Qt's. Since you cleaned up your Qt conflict (you didn't have to uninstall, but that works) you should now rebuild the entire Qt project.

            I would start with a completely fresh extract of the qt tar so you know it's 100% clean. Sometimes make distclean doesn't get everything.

            If you rebuild everything it should fix that pch on install. As for whether or not the build succeed that make output is definitely a success, the make install however failed.

            And you're welcome. :)

            vikramgV Offline
            vikramgV Offline
            vikramg
            wrote on last edited by
            #19

            @ambershark The "undefined reference" link error was root-caused to the conflict with existing Qt 5.3.2 on the build machine. That has been resolved by folks in this thread by removing the older version, but you suggested that that need not be done. Would you elaborate on that? How might one avoid the conflict without removing the older conflicting version? Thanks.

            A 1 Reply Last reply
            0
            • vikramgV vikramg

              @ambershark The "undefined reference" link error was root-caused to the conflict with existing Qt 5.3.2 on the build machine. That has been resolved by folks in this thread by removing the older version, but you suggested that that need not be done. Would you elaborate on that? How might one avoid the conflict without removing the older conflicting version? Thanks.

              A Offline
              A Offline
              ambershark
              wrote on last edited by
              #20

              @vikramg There are a few ways to do it easily. I'm only covering posix OSes though. I don't use windows enough to comment on how to do it there. I would imagine just making sure it isn't in your path would work in windows though.

              1. Make sure you shell points to the Qt you want only. To accomplish this you will need something like:
              $ export PATH="/path/to/Qt/bin:$PATH"
              $ export QTDIR="/path/to/Qt"
              

              I tend to add these to my .bashrc so they are always active in every shell I run. I have aliases for switching Qt versions.

              To verify that your Qt is the one you want, run qmake --version. Then run qmake -query and verify the paths are pointing correctly. This should be handled by the QTDIR varaible. If not you will need a qt.conf file to force paths.

              1. Another way is to disable the system Qt version. This of course will have undesired effects on any application that uses them on your system. The way I usually accomplish this is just setting permissions to 000 on the Qt include directory and libs/binaries individually if necessary. This way is a pain in the butt though. I recommend trying the above first and if you still have issues try this.

              2. Finally, you could set up a vagrant/virtualbox build vm that doesn't include Qt as part of the distro. You could use a docker instance as well. This doesn't really hold true to my comment though but it is an option.

              Hope that helps.

              My L-GPL'd C++ Logger github.com/ambershark-mike/sharklog

              vikramgV 1 Reply Last reply
              0
              • joaopagottoJ Offline
                joaopagottoJ Offline
                joaopagotto
                wrote on last edited by joaopagotto
                #21

                This work for me.

                apt-get install \
                bison \
                build-essential \
                flex \
                gperf \
                libasound2-dev \
                libatkmm-1.6-dev \
                libbz2-dev \
                libcap-dev \
                libcups2-dev \
                libdrm-dev \
                libegl1-mesa-dev \
                libfontconfig1-dev \
                libfreetype6-dev \
                libgcrypt11-dev \
                libglu1-mesa-dev \
                libgstreamer-plugins-base0.10-dev \
                libgstreamer0.10-dev \
                libicu-dev \
                libnss3-dev \
                libpci-dev \
                libpulse-dev \
                libssl-dev \
                libudev-dev \
                libx11-dev \
                libx11-xcb-dev \
                libxcb-composite0 \
                libxcb-composite0-dev \
                libxcb-cursor-dev \
                libxcb-cursor0 \
                libxcb-damage0 \
                libxcb-damage0-dev \
                libxcb-dpms0 \
                libxcb-dpms0-dev \
                libxcb-dri2-0 \
                libxcb-dri2-0-dev \
                libxcb-dri3-0 \
                libxcb-dri3-dev \
                libxcb-ewmh-dev \
                libxcb-ewmh2 \
                libxcb-glx0 \
                libxcb-glx0-dev \
                libxcb-icccm4 \
                libxcb-icccm4-dev \
                libxcb-image0 \
                libxcb-image0-dev \
                libxcb-keysyms1 \
                libxcb-keysyms1-dev \
                libxcb-present-dev \
                libxcb-present0 \
                libxcb-randr0 \
                libxcb-randr0-dev \
                libxcb-record0 \
                libxcb-record0-dev \
                libxcb-render-util0 \
                libxcb-render-util0-dev \
                libxcb-render0 \
                libxcb-render0-dev \
                libxcb-res0 \
                libxcb-res0-dev \
                libxcb-screensaver0 \
                libxcb-screensaver0-dev \
                libxcb-shape0 \
                libxcb-shape0-dev \
                libxcb-shm0 \
                libxcb-shm0-dev \
                libxcb-sync-dev \
                libxcb-sync-dev \
                libxcb-sync1 \
                libxcb-util1 \
                libxcb-util-dev \
                libxcb-xevie0 \
                libxcb-xevie0-dev \
                libxcb-xf86dri0 \
                libxcb-xf86dri0-dev \
                libxcb-xfixes0 \
                libxcb-xfixes0-dev \
                libxcb-xinerama0 \
                libxcb-xinerama0-dev \
                libxcb-xkb-dev \
                libxcb-xkb1 \
                libxcb-xprint0 \
                libxcb-xprint0-dev \
                libxcb-xtest0 \
                libxcb-xtest0-dev \
                libxcb-xv0 \
                libxcb-xv0-dev \
                libxcb-xvmc0 \
                libxcb-xvmc0-dev \
                libxcb1 \
                libxcb1-dev \
                libxcomposite-dev \
                libxcursor-dev \
                libxdamage-dev \
                libxext-dev \
                libxfixes-dev \
                libxi-dev \
                libxkbcommon-dev \
                libxrandr-dev \
                libxrender-dev \
                libxslt1-dev \
                libxss-dev \
                libxtst-dev \
                perl \
                python \
                ruby
                
                apt-get install \
                libpq-dev \
                libmysqlclient-dev \
                libsqlite3-dev
                
                cd /usr/local/src
                
                wget https://download.qt.io/official_releases/qt/5.8/5.8.0/single/qt-everywhere-opensource-src-5.8.0.tar.gz
                
                tar -xvzf qt-everywhere-opensource-src-5.8.0.tar.gz
                
                cd qt-everywhere-opensource-src-5.8.0
                
                ./configure \
                -opensource -confirm-license \
                -opengl es2 \
                -nomake tools \
                -nomake examples \
                -nomake tests \
                -skip qtwebkit \
                -skip qtwebkit-examples
                
                # -j{4} number of CPU cores
                
                make -j4
                make install
                
                cd /usr/local
                
                
                1 Reply Last reply
                0
                • A ambershark

                  @vikramg There are a few ways to do it easily. I'm only covering posix OSes though. I don't use windows enough to comment on how to do it there. I would imagine just making sure it isn't in your path would work in windows though.

                  1. Make sure you shell points to the Qt you want only. To accomplish this you will need something like:
                  $ export PATH="/path/to/Qt/bin:$PATH"
                  $ export QTDIR="/path/to/Qt"
                  

                  I tend to add these to my .bashrc so they are always active in every shell I run. I have aliases for switching Qt versions.

                  To verify that your Qt is the one you want, run qmake --version. Then run qmake -query and verify the paths are pointing correctly. This should be handled by the QTDIR varaible. If not you will need a qt.conf file to force paths.

                  1. Another way is to disable the system Qt version. This of course will have undesired effects on any application that uses them on your system. The way I usually accomplish this is just setting permissions to 000 on the Qt include directory and libs/binaries individually if necessary. This way is a pain in the butt though. I recommend trying the above first and if you still have issues try this.

                  2. Finally, you could set up a vagrant/virtualbox build vm that doesn't include Qt as part of the distro. You could use a docker instance as well. This doesn't really hold true to my comment though but it is an option.

                  Hope that helps.

                  vikramgV Offline
                  vikramgV Offline
                  vikramg
                  wrote on last edited by
                  #22

                  Thanks @ambershark
                  I should have specified that my question was for the case of cross-compiling Qt for an RPi-class embedded device. In particular, I am building on an x86-64 PC running Ubuntu 16.04.2, for an aarch64 Odroid C2 also running Ubuntu 16.04.2. After a lot of rooting around, I have discovered that the problem is the following:

                  One of the places where the "undefined reference" error hits, is for a surprisingly mundane function like QString::resize(), in a link target like libQt5Xml.so:

                  ~/Projects/ARM/gcc-linaro-6.3.1-2017.02-x86_64_aarch64-linux-gnu/bin/aarch64-linux-gnu-g++ -shared
                  -o libQt5Xml.so.5.8.0
                  -L~/Projects/Odroid/C2/sysroot/usr/lib -L~/Projects/Odroid/C2/sysroot/lib/aarch64-linux-gnu -L~/Projects/Odroid/C2/sysroot/usr/lib/aarch64-linux-gnu -lrt -ldl -L~/Projects/Odroid/C2/Qt/qt5-build/lib 
                  -lQt5Core -lpthread
                  

                  Objects like qstring.o were bundled like so into libQt5Core.so, preceding the above step:

                  aarch64-linux-gnu-g++ -shared -o libQt5Core.so.5.8.0 ... .obj/qstring.o ...<many other .o objects here>... -L~/Projects/Odroid/C2/sysroot/usr/lib -L~/Projects/Odroid/C2/sysroot/lib/aarch64-linux-gnu -L~/Projects/Odroid/C2/sysroot/usr/lib/aarch64-linux-gnu -lrt -ldl -lpthread -licui18n -licuuc -licudata -lm -ldl -lrt -lz -lpcre16 -lgthread-2.0 -lglib-2.0
                  

                  So the make process is building a libQt5Core.so, pulling in required libs (e.g. libicudata.so, libdl.so, librt.so etc) from the target machine from the *lib* directories under sysroot. The newly created libQt5Core.so is located in the qt5-build/lib directory on the host machine.

                  The problem arises when the linker tries to create a target that requires libQt5Core.so. Repeating part of the libQt5Xml.so build command above, the directories searched for dependencies are:

                  -L~/Projects/Odroid/C2/sysroot/usr/lib 
                  -L~/Projects/Odroid/C2/sysroot/lib/aarch64-linux-gnu 
                  -L~/Projects/Odroid/C2/sysroot/usr/lib/aarch64-linux-gnu -lrt -ldl 
                  -L~/Projects/Odroid/C2/Qt/qt5-build/lib -lQt5Core -lpthread
                  

                  Of these, the ones under sysroot are on the target device and the last one is on the host. The problem is that the target also has (an older) Qt5 installation (5.5.1) on it. /usr/lib/aarch64-linux-gnu on the target has all the libQt5*.so files, including libQt5Core.so. It seems like the linker picks up the first libQt5Core.so it finds, which is the one on the target, not the one that was just built on the host (under qt5-build/lib). That does not have the functions required by the new Qt version, and the link fails.

                  Removing the older Qt5 on the target

                  odroid@odroid64:~$ sudo apt-get remove libqt5*
                  

                  works and the 'make' completes without errors. If only the order of directories in the link step could be reversed (such that the local dir is searched first) then the correct libQt5Core.so could be used.

                  So ultimately, after this long-winded explanation, the question is, is there a way to force the linker to look in the local directories first? I tried the -R option on 'configure', setting it to the qt5-build/lib directory on the host, but that didn't make a difference.

                  A 1 Reply Last reply
                  0
                  • vikramgV vikramg

                    Thanks @ambershark
                    I should have specified that my question was for the case of cross-compiling Qt for an RPi-class embedded device. In particular, I am building on an x86-64 PC running Ubuntu 16.04.2, for an aarch64 Odroid C2 also running Ubuntu 16.04.2. After a lot of rooting around, I have discovered that the problem is the following:

                    One of the places where the "undefined reference" error hits, is for a surprisingly mundane function like QString::resize(), in a link target like libQt5Xml.so:

                    ~/Projects/ARM/gcc-linaro-6.3.1-2017.02-x86_64_aarch64-linux-gnu/bin/aarch64-linux-gnu-g++ -shared
                    -o libQt5Xml.so.5.8.0
                    -L~/Projects/Odroid/C2/sysroot/usr/lib -L~/Projects/Odroid/C2/sysroot/lib/aarch64-linux-gnu -L~/Projects/Odroid/C2/sysroot/usr/lib/aarch64-linux-gnu -lrt -ldl -L~/Projects/Odroid/C2/Qt/qt5-build/lib 
                    -lQt5Core -lpthread
                    

                    Objects like qstring.o were bundled like so into libQt5Core.so, preceding the above step:

                    aarch64-linux-gnu-g++ -shared -o libQt5Core.so.5.8.0 ... .obj/qstring.o ...<many other .o objects here>... -L~/Projects/Odroid/C2/sysroot/usr/lib -L~/Projects/Odroid/C2/sysroot/lib/aarch64-linux-gnu -L~/Projects/Odroid/C2/sysroot/usr/lib/aarch64-linux-gnu -lrt -ldl -lpthread -licui18n -licuuc -licudata -lm -ldl -lrt -lz -lpcre16 -lgthread-2.0 -lglib-2.0
                    

                    So the make process is building a libQt5Core.so, pulling in required libs (e.g. libicudata.so, libdl.so, librt.so etc) from the target machine from the *lib* directories under sysroot. The newly created libQt5Core.so is located in the qt5-build/lib directory on the host machine.

                    The problem arises when the linker tries to create a target that requires libQt5Core.so. Repeating part of the libQt5Xml.so build command above, the directories searched for dependencies are:

                    -L~/Projects/Odroid/C2/sysroot/usr/lib 
                    -L~/Projects/Odroid/C2/sysroot/lib/aarch64-linux-gnu 
                    -L~/Projects/Odroid/C2/sysroot/usr/lib/aarch64-linux-gnu -lrt -ldl 
                    -L~/Projects/Odroid/C2/Qt/qt5-build/lib -lQt5Core -lpthread
                    

                    Of these, the ones under sysroot are on the target device and the last one is on the host. The problem is that the target also has (an older) Qt5 installation (5.5.1) on it. /usr/lib/aarch64-linux-gnu on the target has all the libQt5*.so files, including libQt5Core.so. It seems like the linker picks up the first libQt5Core.so it finds, which is the one on the target, not the one that was just built on the host (under qt5-build/lib). That does not have the functions required by the new Qt version, and the link fails.

                    Removing the older Qt5 on the target

                    odroid@odroid64:~$ sudo apt-get remove libqt5*
                    

                    works and the 'make' completes without errors. If only the order of directories in the link step could be reversed (such that the local dir is searched first) then the correct libQt5Core.so could be used.

                    So ultimately, after this long-winded explanation, the question is, is there a way to force the linker to look in the local directories first? I tried the -R option on 'configure', setting it to the qt5-build/lib directory on the host, but that didn't make a difference.

                    A Offline
                    A Offline
                    ambershark
                    wrote on last edited by
                    #23

                    @vikramg Hmm that's a good question. It really shouldn't be behaving like that.

                    I wonder if you try passing LDFLAGS="-L/qt/lib/dir/you/want/to/use" to your configure and subsequent build. I'm not sure if that would work but it may. You could try that in CFLAGS as well or CXXFLAGS.

                    It shouldn't use the system libs over your libs specified with -L paths though. I'm not sure why it's doing that.

                    My L-GPL'd C++ Logger github.com/ambershark-mike/sharklog

                    vikramgV 1 Reply Last reply
                    0
                    • A ambershark

                      @vikramg Hmm that's a good question. It really shouldn't be behaving like that.

                      I wonder if you try passing LDFLAGS="-L/qt/lib/dir/you/want/to/use" to your configure and subsequent build. I'm not sure if that would work but it may. You could try that in CFLAGS as well or CXXFLAGS.

                      It shouldn't use the system libs over your libs specified with -L paths though. I'm not sure why it's doing that.

                      vikramgV Offline
                      vikramgV Offline
                      vikramg
                      wrote on last edited by
                      #24

                      @ambershark Some options suggested here seem promising:

                      1. export LIBRARY_PATH=/local/qt/lib/dir. Then run configure/make.

                      2. Save the following as a shell script called aarch64-linux-gnu-g++:

                          #!/bin/sh
                          exec /real/path/to/aarch64-linux-gnu-g++ -L/local/qt/lib/dir "$@"
                      

                      Then 'chmod +x' the script and put it first in your PATH.

                      I will try these as well as the LDFLAGS/CXXFLAGS options the next time I try a build, and update this thread if one of them works.

                      1 Reply Last reply
                      0
                      • P Offline
                        P Offline
                        perf
                        wrote on last edited by
                        #25

                        I believe I have..

                        I followed https://wiki.qt.io/Native_Build_of_Qt5_on_a_Raspberry_Pi and downloaded the last version, version 5.9.2. But I did not edit ~/opt/qt5/qtbase/configure script - because there were no QT_CFLAGS_DBUS statments in the downloaded version.

                        I started with a Raspberry Pi 3 flashed with Jessie Light 2017-07-05.
                        Then, after a raspian-setup I continued without rebooting with:
                        sudo apt-get install --no-install-recommends xserver-xorg
                        sudo apt-get install --no-install-recommends xinit
                        sudo apt-get install raspberrypi-ui-mods
                        and the packages needed for compiling according to the article.
                        I had to install git in addition.

                        Every step ran to completion without any errors and I ran the qube test at the end of the article. It worked in console mode, and after a reboot - also under X11.

                        But, I did not get the result I wanted. The cube application took the whole screen. It is not a "good" display environment citizen. I want my app to coexist with other applications.

                        My question is:
                        What can I do for creating an applicaton that run in the display environment?
                        Do I have to run the configure script with other parameters or is there another way of achieving my goal?

                        This is the line I have used:

                        Command line: -v -opengl es2 -device linux-rasp-pi-g+ -device-option CROSS_COMPILE=/usr/bin/ -opensource -confirm-license -optimized-qmake -reduce-exports -release -qt-pcre -make libs -prefix /usr/local/qt5

                        1 Reply Last reply
                        0

                        • Login

                        • Login or register to search.
                        • First post
                          Last post
                        0
                        • Categories
                        • Recent
                        • Tags
                        • Popular
                        • Users
                        • Groups
                        • Search
                        • Get Qt Extensions
                        • Unsolved