Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Qt Creator and other tools
  4. Build Qt on Linux, build Qt application on Windows, for an embedded target
Forum Updated to NodeBB v4.3 + New Features

Build Qt on Linux, build Qt application on Windows, for an embedded target

Scheduled Pinned Locked Moved Qt Creator and other tools
9 Posts 2 Posters 4.1k Views 1 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.
  • X Offline
    X Offline
    Xooch
    wrote on last edited by
    #1

    I've build Qt 5.3.1 for our embedded target on Linux.

    We would like to develop from Qt Creator in Windows.

    However, when setting up the kit in Creator, I'm required to point it at a qmake.exe. However, the qmake that was created is a Linux executable and obviously can't be used in Creator on Windows.

    What is the recommended way to make this work?

    If I rebuild Qt under Windows for my embedded target, will I run into issues using the Windows qmake.exe on my development machine, but then running my application with the libraries on my target that were developed on a Linux machine?

    1 Reply Last reply
    0
    • SGaistS Offline
      SGaistS Offline
      SGaist
      Lifetime Qt Champion
      wrote on last edited by
      #2

      Hi,

      qmake is independent of the target in the sense that it's host tool to help setup things. qmake is built for the host that it will run on, the fact that the target runs e.g. android, iOS or a linux flavor doesn't matter.

      Interested in AI ? www.idiap.ch
      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

      1 Reply Last reply
      0
      • X Offline
        X Offline
        Xooch
        wrote on last edited by
        #3

        I disagree. Let me explain why.

        When setting up the kit in Creator, part of that is selecting the compiler, the debugger, the Qt version, etc. Now, I've created a new kit and pointed it to my GCC based Linaro ARM cross compiler.

        In order to specify the Qt version, I have to point Creator at a qmake.exe file. This is the file I do not have because the Qt libraries were built for my embedded ARM system on Linux, and therefore qmake is a Linux executable.

        If I attempt to instead point Qt at, say, the MinGW qmake.exe, I get an error from Creator saying "The compiler 'Linaro GCC' (arm-linux-generic-elf-32-bit) cannot produce code for the Qt version 'Qt 5.3 MinGW 32bit' (x86-windows-msyspe-32bit)."

        This right here indicates that I need a proper qmake.exe. This could be solved by building the Qt libraries for my target on Windows, but that's a whole new set of issues.

        1 Reply Last reply
        0
        • SGaistS Offline
          SGaistS Offline
          SGaist
          Lifetime Qt Champion
          wrote on last edited by
          #4

          Then we don't disagree at all, I might have given a bit a short explanation but the finality is the same: qmake is built for the host OS. It was implying that a linux cross-compiled Qt's qmake cannot run on windows. You could have some luck trying to also cross-compile qmake from linux to windows but I don't know what amount of work it would require and it it's possible at all.

          Interested in AI ? www.idiap.ch
          Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

          1 Reply Last reply
          0
          • X Offline
            X Offline
            Xooch
            wrote on last edited by
            #5

            Well, in addition to simply compiling qmake, all the information that is built into qmake that describes the Qt version, target architecture, etc., has to be determined and built into it.

            What is really strange to me is that Qt is supposed to be very portable, but the development environment itself doesn't seem to be. I have a toolchain that produces identical code from either Linux or Windows. Building the Qt libraries for a different architecture on Windows is much more difficult that on Linux (and the lack of documentation on the web supports this, unless the lack of documentation is the reason for the difficulty...).

            I would think that Qt would generate some sort of configuration file that holds this information and could be taken to a different system and possibly different OS so application could be developed there.

            But this information is built into a platform dependent executable?

            1 Reply Last reply
            0
            • SGaistS Offline
              SGaistS Offline
              SGaist
              Lifetime Qt Champion
              wrote on last edited by
              #6

              Cross-compiling on Windows for linux has never been something easy (and Windows is not the most developer friendly OS) that's why most developers uses a VM with linux if they have to do embedded linux development and can't change their host OS.

              The mkspecs can be used to tell qmake which platform you are going to use.

              Interested in AI ? www.idiap.ch
              Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

              1 Reply Last reply
              0
              • X Offline
                X Offline
                Xooch
                wrote on last edited by
                #7

                [quote author="SGaist" date="1406756366"]The mkspecs can be used to tell qmake which platform you are going to use.[/quote]

                That still doesn't help me get a kit set up in Creator, unless you can tell me how to tell creator to use a specific mkspec instead of the one built into qmake (like there seems to be):

                !http://i.imgur.com/1APjHjx.png(Creator kit setup screenshot)!

                1 Reply Last reply
                0
                • SGaistS Offline
                  SGaistS Offline
                  SGaist
                  Lifetime Qt Champion
                  wrote on last edited by
                  #8

                  The last linedit is for the mkspec

                  Interested in AI ? www.idiap.ch
                  Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

                  1 Reply Last reply
                  0
                  • X Offline
                    X Offline
                    Xooch
                    wrote on last edited by
                    #9

                    It's not that simple.

                    • qmake.exe has paths, ABI, mkspec, etc., all hard coded in the executable. Run something like "strings qmake" and grep for one of the settings obtained by "qmake -query". They're in there.
                    • Specifying a mkspec in that dialog does not do enough to solve the problem. In fact, even though my kit has my Linaro cross compiler set up, it still calls MinGW's compiler and I end up with a Windows binary.
                    • The qmake settings can be modified (using "qmake -set"). I tried to take the MinGW qmake.exe that is installed with Creator and change its settings to match those from the Linux build, but this does not work.
                    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