Qt Forum

    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Unsolved

    Solved Yocto/Qt5.6: Unable to build a sample Qt Application

    Installation and Deployment
    4
    6
    2677
    Loading More Posts
    • 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.
    • chaithubk
      chaithubk last edited by

      I have a working Nitrogen6x board that runs on Yocto Krogoth-next build with core-image-sato. I have installed Qt Creator 3.5.1 (based on Qt 5.5.1) and I have added my kit for nitrogen6x board as per [Build & Install Qt5 toolchain] document. I have added a sample Qt Quick Application with component set chosen as Qt Quick 2.1 and tried to compile the source, I am noticing this below error.

      19:04:25: Running steps for project untitled6...
      19:04:25: Starting: "/opt/poky/2.1.1/sysroots/i686-pokysdk-linux/usr/bin/qt5/qmake" /home/test/untitled6/untitled6.pro -r -spec linux-g++
      19:04:25: The process "/opt/poky/2.1.1/sysroots/i686-pokysdk-linux/usr/bin/qt5/qmake" exited normally.
      19:04:25: Starting: "/usr/bin/make" 
      g++ -c -pipe -O2 -std=gnu++0x -Wall -W -D_REENTRANT -fPIC -DQT_NO_DEBUG -DQT_QUICK_LIB -DQT_GUI_LIB -DQT_QML_LIB -DQT_NETWORK_LIB -DQT_CORE_LIB -I../untitled6 -I. -isystem /opt/poky/2.1.1/sysroots/cortexa9hf-neon-poky-linux-gnueabi/usr/include/qt5 -isystem /opt/poky/2.1.1/sysroots/cortexa9hf-neon-poky-linux-gnueabi/usr/include/qt5/QtQuick -isystem /opt/poky/2.1.1/sysroots/cortexa9hf-neon-poky-linux-gnueabi/usr/include/qt5/QtGui -isystem /opt/poky/2.1.1/sysroots/cortexa9hf-neon-poky-linux-gnueabi/usr/include/qt5/QtQml -isystem /opt/poky/2.1.1/sysroots/cortexa9hf-neon-poky-linux-gnueabi/usr/include/qt5/QtNetwork -isystem /opt/poky/2.1.1/sysroots/cortexa9hf-neon-poky-linux-gnueabi/usr/include/qt5/QtCore -I. -I/opt/poky/2.1.1/sysroots/cortexa9hf-neon-poky-linux-gnueabi/usr/lib/qt5/mkspecs/linux-g++ -o main.o ../untitled6/main.cpp
      /opt/poky/2.1.1/sysroots/i686-pokysdk-linux/usr/bin/qt5/rcc -name qml ../untitled6/qml.qrc -o qrc_qml.cpp
      g++ -c -pipe -O2 -std=gnu++0x -Wall -W -D_REENTRANT -fPIC -DQT_NO_DEBUG -DQT_QUICK_LIB -DQT_GUI_LIB -DQT_QML_LIB -DQT_NETWORK_LIB -DQT_CORE_LIB -I../untitled6 -I. -isystem /opt/poky/2.1.1/sysroots/cortexa9hf-neon-poky-linux-gnueabi/usr/include/qt5 -isystem /opt/poky/2.1.1/sysroots/cortexa9hf-neon-poky-linux-gnueabi/usr/include/qt5/QtQuick -isystem /opt/poky/2.1.1/sysroots/cortexa9hf-neon-poky-linux-gnueabi/usr/include/qt5/QtGui -isystem /opt/poky/2.1.1/sysroots/cortexa9hf-neon-poky-linux-gnueabi/usr/include/qt5/QtQml -isystem /opt/poky/2.1.1/sysroots/cortexa9hf-neon-poky-linux-gnueabi/usr/include/qt5/QtNetwork -isystem /opt/poky/2.1.1/sysroots/cortexa9hf-neon-poky-linux-gnueabi/usr/include/qt5/QtCore -I. -I/opt/poky/2.1.1/sysroots/cortexa9hf-neon-poky-linux-gnueabi/usr/lib/qt5/mkspecs/linux-g++ -o qrc_qml.o qrc_qml.cpp
      g++ -Wl,-O1 -o untitled6 main.o qrc_qml.o   -lQt5Quick -lQt5Gui -lQt5Qml -lQt5Network -lQt5Core -lGLESv2 -lpthread 
      /usr/bin/ld: cannot find -lQt5Quick
      /usr/bin/ld: cannot find -lQt5Gui
      /usr/bin/ld: cannot find -lQt5Qml
      /usr/bin/ld: cannot find -lQt5Network
      /usr/bin/ld: cannot find -lQt5Core
      /usr/bin/ld: cannot find -lGLESv2
      collect2: ld returned 1 exit status
      make: *** [untitled6] Error 1
      19:04:26: The process "/usr/bin/make" exited with code 2.
      Error while building/deploying project untitled6 (kit: Nitrogen)
      When executing step 'Make'
      19:04:26: Elapsed time: 00:01.
      

      All the Qt libraries are present under /sysroots/cortexa9hf-neon-poky-linux-gnueabi/usr/include/qt5/ and I have set the sysroot path correctly under my kit, but I am unable to figure out why is that my application is failing to reference those libraries. Any help on this is deeply appreciated. Thanks in advance.

      1 Reply Last reply Reply Quote 0
      • tomasz3dk
        tomasz3dk last edited by

        Look here

        1 Reply Last reply Reply Quote 2
        • chaithubk
          chaithubk last edited by

          Yes. I tried adding Qt mkspec as linux-oe-g++ to my kit. I noticed the error make: c: Command not found. Then I tried adding source /opt/poky/2.1.1/environment-setup-cortexa9hf-neon-poky-linux‌​-gnueabi to my ~/Qt/Tools/QtCreator/bin/qtcreator.sh script before #!/bin/sh and then launched the sudo sh qtcreator.sh and tried to build and it worked. Thank you.

          M 1 Reply Last reply Reply Quote 0
          • M
            mostefa @chaithubk last edited by

            @chaithubk said in Yocto/Qt5.6: Unable to build a sample Qt Application:

            Yes. I tried adding Qt mkspec as linux-oe-g++ to my kit. I noticed the error make: c: Command not found. Then I tried adding source /opt/poky/2.1.1/environment-setup-cortexa9hf-neon-poky-linux‌​-gnueabi to my ~/Qt/Tools/QtCreator/bin/qtcreator.sh script before #!/bin/sh and then launched the sudo sh qtcreator.sh and tried to build and it worked. Thank you.

            Do you really need to run qtcreator.sh with sudo?

            This means that all file of a new created project with this qtcreator.sh will be only accessible from your super user,

            I don't know but it seems a bit odd,

            1 Reply Last reply Reply Quote 0
            • chaithubk
              chaithubk last edited by chaithubk

              When I launched qtcreator.sh without sudo I noticed some errors of sort below:
              Warning dialog with text

              Cannot overwrite file ~/.config/QtProject/qtcreator/qtversion.xml: Permission denied.
              

              and OK button. After I click OK I get one more dialog with text:

              Cannot overwrite file ~/.config/QtProject/qtcreator/devices.xml: Permission denied. 
              

              and OK button so on.

              Running with sudo resolved those errors. As you said that could be a quick hack but not right way of doing it.

              1 Reply Last reply Reply Quote 0
              • H
                Hung Tran last edited by

                I'm sure about this case because I have met. When you run example, it is located on /opt folder and your linux user can not permission to execute. So to solve, please take example to other folder. and try build again.

                1 Reply Last reply Reply Quote 0
                • First post
                  Last post