Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Mobile and Embedded
  4. QT cross compile for Raspberry - build environment setup
Forum Updated to NodeBB v4.3 + New Features

QT cross compile for Raspberry - build environment setup

Scheduled Pinned Locked Moved Unsolved Mobile and Embedded
6 Posts 4 Posters 495 Views 2 Watching
  • 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.
  • J Offline
    J Offline
    JackS
    wrote on last edited by
    #1

    Hello,

    I'm pretty new in QT (I made a few simple applications some time ago to dive into qt).
    Currently, I'm working on my private projects involving STM32 and Raspberry Pi. I have the STM part already done, and now is the time to start with second part.

    What I'm trying to reach?
    Set up the build environment on Ubuntu to be able to compile my program and than deploy it to Raspberry 3B+ running the newest RaspberryPi OS.

    I really like Eclipse and CMake, therefore I would like to set this up with such tools.
    Due to fact, that I'm newbie, I need some help.

    What steps I need to follow?
    Download the QT sources, than run configure with some flags.
    Than make.
    Setup CMake to build executable (than using target_link_libraries link the libraries I used).
    In CMake I should configure which compiler should be used, to build for Rpi.
    After build, I can move the executable to rpi.
    And here the fun begins, because there are no dynamically linked libraries.
    How to handle it? Maybe there is any tutorial handle my case? I did not found how to make it working. The only I found, where with QTCreator - no CMake, Eclipse.

    jsulmJ 1 Reply Last reply
    0
    • J JackS

      Hello,

      I'm pretty new in QT (I made a few simple applications some time ago to dive into qt).
      Currently, I'm working on my private projects involving STM32 and Raspberry Pi. I have the STM part already done, and now is the time to start with second part.

      What I'm trying to reach?
      Set up the build environment on Ubuntu to be able to compile my program and than deploy it to Raspberry 3B+ running the newest RaspberryPi OS.

      I really like Eclipse and CMake, therefore I would like to set this up with such tools.
      Due to fact, that I'm newbie, I need some help.

      What steps I need to follow?
      Download the QT sources, than run configure with some flags.
      Than make.
      Setup CMake to build executable (than using target_link_libraries link the libraries I used).
      In CMake I should configure which compiler should be used, to build for Rpi.
      After build, I can move the executable to rpi.
      And here the fun begins, because there are no dynamically linked libraries.
      How to handle it? Maybe there is any tutorial handle my case? I did not found how to make it working. The only I found, where with QTCreator - no CMake, Eclipse.

      jsulmJ Offline
      jsulmJ Offline
      jsulm
      Lifetime Qt Champion
      wrote on last edited by
      #2

      @JackS said in QT cross compile for Raspberry - build environment setup:

      And here the fun begins, because there are no dynamically linked libraries.

      What libraries do you mean?
      https://wiki.qt.io/Raspberry_Pi_Beginners_Guide

      https://forum.qt.io/topic/113070/qt-code-of-conduct

      1 Reply Last reply
      0
      • J Offline
        J Offline
        JackS
        wrote on last edited by JackS
        #3

        I was not clear in my first post.

        So, basically I would like to:

        1. Setup CMake to compile my QT application natively on Ubuntu, that will run on Ubuntu. I have built QT 5.12.2 from sources, my app is compiling and running correctly - so this point is OK.
        2. On the same Ubuntu I would like to cross-compile exactly the same application and simple copy the binary directly to Raspberry.

        And I'm getting here into troubles.
        To build application on Ubuntu for Raspberry I need:

        • Compiled QT libraries placed on Raspberry (I can compile those natively on RPi, those libraries will be dynamically linked each time I starting my app);
        • The same libraries as on Raspberry, I need to have on Ubuntu to cross compile my application and CMake should refer somehow to those RPi libraries when building (I can copy libraries from RPi to Ubuntu).
        • The QT-Rpi libraries should not affects the QT-Ubuntu libraries, so should be placed in another place.

        And I'm not sure whether it will work.
        Does anyone has experience with such approach?

        Pablo J. RoginaP 1 Reply Last reply
        0
        • J JackS

          I was not clear in my first post.

          So, basically I would like to:

          1. Setup CMake to compile my QT application natively on Ubuntu, that will run on Ubuntu. I have built QT 5.12.2 from sources, my app is compiling and running correctly - so this point is OK.
          2. On the same Ubuntu I would like to cross-compile exactly the same application and simple copy the binary directly to Raspberry.

          And I'm getting here into troubles.
          To build application on Ubuntu for Raspberry I need:

          • Compiled QT libraries placed on Raspberry (I can compile those natively on RPi, those libraries will be dynamically linked each time I starting my app);
          • The same libraries as on Raspberry, I need to have on Ubuntu to cross compile my application and CMake should refer somehow to those RPi libraries when building (I can copy libraries from RPi to Ubuntu).
          • The QT-Rpi libraries should not affects the QT-Ubuntu libraries, so should be placed in another place.

          And I'm not sure whether it will work.
          Does anyone has experience with such approach?

          Pablo J. RoginaP Offline
          Pablo J. RoginaP Offline
          Pablo J. Rogina
          wrote on last edited by Pablo J. Rogina
          #4

          @JackS said in QT cross compile for Raspberry - build environment setup:

          On the same Ubuntu I would like to cross-compile exactly the same application and simple copy the binary directly to Raspberry.

          Have you checked this useful guide?

          Upvote the answer(s) that helped you solve the issue
          Use "Topic Tools" button to mark your post as Solved
          Add screenshots via postimage.org
          Don't ask support requests via chat/PM. Please use the forum so others can benefit from the solution in the future

          J 1 Reply Last reply
          0
          • Pablo J. RoginaP Pablo J. Rogina

            @JackS said in QT cross compile for Raspberry - build environment setup:

            On the same Ubuntu I would like to cross-compile exactly the same application and simple copy the binary directly to Raspberry.

            Have you checked this useful guide?

            J Offline
            J Offline
            JackS
            wrote on last edited by
            #5

            @Pablo-J-Rogina said in QT cross compile for Raspberry - build environment setup:

            Have you checked this useful guide?

            Not yet.
            At this time seems that it is too complicated for me, and I'm trying to kill mosquito using fridge.
            I choose the way of installing some packages on RPi, that compiling only my application natively on RPi. It is simpler, allows me to compile and run my app separately on Ubuntu and Rpi (over ssh).

            I was able to compile QT for RPi on Ubuntu, but when running CMake there where problems at linking stage with undefined reference to q_source_destroy and some other functions in libQTCore, it complains about missing libgthread, libglib even if CMAKE_SYSROOT was set to sysroot directory prepared during QT compilation (and those two libs were present there).

            I gave up and I'm going to compile my app on RPi directly. It is not a big impact until my app is quite simple. In the future, I probably will have to face this issue again - but I bought some time to learn how it is working...:)

            1 Reply Last reply
            0
            • D Offline
              D Offline
              Dinosrules
              wrote on last edited by
              #6

              I would need assistance as well regarding this topic. I have been struggling for days now to get the cross compile to work so I am giving up. All guides I followed (around 10 different ones) led me back to the starting point. Nothing worked. Is it possible to just develop in Linux or Windows using QtQuick and then just use dependencies on Rpi to make it work? Is it really that complicated? When I run a demo QtQuick app on my Rpi I get that QtQuick is not installed. Before that it was PySide2 but that was easily solved by installing dependencies. Does anyone know what dependencies are required for QtQuick so that an app using QtQuick can run on Rpi?

              Me and my fellow students are under huge pressure with our senior project and we could really use some help. Thank you! We are even considering installing Ubuntu in Rpi to make it run.... :(

              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