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. Qtcreator with cross compiles
Forum Update on Monday, May 27th 2025

Qtcreator with cross compiles

Scheduled Pinned Locked Moved Qt Creator and other tools
qtcreatorcross compilesqt 5.8macoswindows
8 Posts 3 Posters 4.4k 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.
  • shavS Online
    shavS Online
    shav
    wrote on last edited by
    #1

    Hi everyone!

    I have Mackbook with Qt 5.8 beta 1. I want to compile my project to macOS, Linux and Windows. I installed Window gcc compiler to my macOS usin this script. What I need to do in QtCreator to configure my project for build from macOS to Windows without virtual machine?

    shavS jsulmJ 2 Replies Last reply
    0
    • shavS shav

      Hi everyone!

      I have Mackbook with Qt 5.8 beta 1. I want to compile my project to macOS, Linux and Windows. I installed Window gcc compiler to my macOS usin this script. What I need to do in QtCreator to configure my project for build from macOS to Windows without virtual machine?

      shavS Online
      shavS Online
      shav
      wrote on last edited by
      #2
      This post is deleted!
      1 Reply Last reply
      0
      • shavS shav

        Hi everyone!

        I have Mackbook with Qt 5.8 beta 1. I want to compile my project to macOS, Linux and Windows. I installed Window gcc compiler to my macOS usin this script. What I need to do in QtCreator to configure my project for build from macOS to Windows without virtual machine?

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

        @shav You need a Qt build created using MinGW compiler you installed. So, first you need to build Qt with that compiler.

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

        1 Reply Last reply
        0
        • shavS Online
          shavS Online
          shav
          wrote on last edited by
          #4

          Thanks for the replay!

          Can you post the link to the documentation where I can find a samples for build Qt with custom compiletor?

          In my case I have installed the compiletor to folder /usr/local/Cellar/mingw-w64/4.0.4

          I've using this command to configure the build:

          ./configure -prefix /Volumes/HPDD/Applications/Qt/Qt5.x/5.8/mingw_32 -xplatform win32-g++ -device-option CROSS_COMPILE=/usr/local/Cellar/mingw-w64/4.0.4/bin/i686-w64-mingw32-g++
          

          But this command generate error message:

          Checking for valid makespec...
          executing config test verifyspec
          + cd /Volumes/HPDD/Applications/Qt/qt-everywhere-opensource-src-5.8.0-beta/qtbase/config.tests/common/verifyspec && /Volumes/HPDD/Applications/Qt/qt-everywhere-opensource-src-5.8.0-beta/qtbase/bin/qmake -qtconf /Volumes/HPDD/Applications/Qt/qt-everywhere-opensource-src-5.8.0-beta/qtbase/bin/qt.conf "CONFIG -= qt deb$
          + cd /Volumes/HPDD/Applications/Qt/qt-everywhere-opensource-src-5.8.0-beta/qtbase/config.tests/common/verifyspec && MAKEFLAGS= /usr/bin/make clean && MAKEFLAGS= /usr/bin/make
          rm -f verifyspec.o
          /usr/local/Cellar/mingw-w64/4.0.4/bin/i686-w64-mingw32-g++ -c -pipe -fno-keep-inline-dllexport -O2 -Wall -Wextra -fno-rtti -fexceptions -mthreads -DUNICODE -DQT_NO_DYNAMIC_CAST -I. -I/Volumes/HPDD/Applications/Qt/qt-everywhere-opensource-src-5.8.0-beta/qtbase/mkspecs/win32-g++  -o verifyspec.o verifyspec.cpp
          /usr/local/Cellar/mingw-w64/4.0.4/bin/i686-w64-mingw32-g++ -Wl,-s -Wl,-subsystem,console -mthreads -o verifyspec.exe verifyspec.o
          /usr/local/Cellar/mingw-w64/4.0.4/lib/gcc/i686-w64-mingw32/5.2.0/../../../../i686-w64-mingw32/bin/ld: cannot find -lstdc++
          /usr/local/Cellar/mingw-w64/4.0.4/lib/gcc/i686-w64-mingw32/5.2.0/../../../../i686-w64-mingw32/bin/ld: cannot find -lgcc
          /usr/local/Cellar/mingw-w64/4.0.4/lib/gcc/i686-w64-mingw32/5.2.0/../../../../i686-w64-mingw32/bin/ld: cannot find -lgcc
          collect2: error: ld returned 1 exit status
          make: *** [verifyspec.exe] Error 1
          

          As I understand I need to set path to library. How I can set this path?

          Thanks for the any help.

          jsulmJ 1 Reply Last reply
          0
          • shavS shav

            Thanks for the replay!

            Can you post the link to the documentation where I can find a samples for build Qt with custom compiletor?

            In my case I have installed the compiletor to folder /usr/local/Cellar/mingw-w64/4.0.4

            I've using this command to configure the build:

            ./configure -prefix /Volumes/HPDD/Applications/Qt/Qt5.x/5.8/mingw_32 -xplatform win32-g++ -device-option CROSS_COMPILE=/usr/local/Cellar/mingw-w64/4.0.4/bin/i686-w64-mingw32-g++
            

            But this command generate error message:

            Checking for valid makespec...
            executing config test verifyspec
            + cd /Volumes/HPDD/Applications/Qt/qt-everywhere-opensource-src-5.8.0-beta/qtbase/config.tests/common/verifyspec && /Volumes/HPDD/Applications/Qt/qt-everywhere-opensource-src-5.8.0-beta/qtbase/bin/qmake -qtconf /Volumes/HPDD/Applications/Qt/qt-everywhere-opensource-src-5.8.0-beta/qtbase/bin/qt.conf "CONFIG -= qt deb$
            + cd /Volumes/HPDD/Applications/Qt/qt-everywhere-opensource-src-5.8.0-beta/qtbase/config.tests/common/verifyspec && MAKEFLAGS= /usr/bin/make clean && MAKEFLAGS= /usr/bin/make
            rm -f verifyspec.o
            /usr/local/Cellar/mingw-w64/4.0.4/bin/i686-w64-mingw32-g++ -c -pipe -fno-keep-inline-dllexport -O2 -Wall -Wextra -fno-rtti -fexceptions -mthreads -DUNICODE -DQT_NO_DYNAMIC_CAST -I. -I/Volumes/HPDD/Applications/Qt/qt-everywhere-opensource-src-5.8.0-beta/qtbase/mkspecs/win32-g++  -o verifyspec.o verifyspec.cpp
            /usr/local/Cellar/mingw-w64/4.0.4/bin/i686-w64-mingw32-g++ -Wl,-s -Wl,-subsystem,console -mthreads -o verifyspec.exe verifyspec.o
            /usr/local/Cellar/mingw-w64/4.0.4/lib/gcc/i686-w64-mingw32/5.2.0/../../../../i686-w64-mingw32/bin/ld: cannot find -lstdc++
            /usr/local/Cellar/mingw-w64/4.0.4/lib/gcc/i686-w64-mingw32/5.2.0/../../../../i686-w64-mingw32/bin/ld: cannot find -lgcc
            /usr/local/Cellar/mingw-w64/4.0.4/lib/gcc/i686-w64-mingw32/5.2.0/../../../../i686-w64-mingw32/bin/ld: cannot find -lgcc
            collect2: error: ld returned 1 exit status
            make: *** [verifyspec.exe] Error 1
            

            As I understand I need to set path to library. How I can set this path?

            Thanks for the any help.

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

            @shav To be honest: it would be MUCH easier to build on Windows instead of doing cross compilation on MacOS! Especially if your application becomes more complex and starts to use other libraries. Is there a reason why you cannot use a Windows machine (can be a virtual machine) to build for Windows?
            I never tried to cross compile for Windows.

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

            1 Reply Last reply
            0
            • shavS Online
              shavS Online
              shav
              wrote on last edited by
              #6

              Thanks for the reply!

              Yes, I have a virtual machine with Windows and I've installed Qt from package to virtual machine. It's works fine! But I want to learn how to use cross compilation with Qt. I think this is need for me as a new skill :)

              Any way I'll continue research for solve my problem with this. Thanks for the help!

              mrjjM 1 Reply Last reply
              1
              • shavS shav

                Thanks for the reply!

                Yes, I have a virtual machine with Windows and I've installed Qt from package to virtual machine. It's works fine! But I want to learn how to use cross compilation with Qt. I think this is need for me as a new skill :)

                Any way I'll continue research for solve my problem with this. Thanks for the help!

                mrjjM Offline
                mrjjM Offline
                mrjj
                Lifetime Qt Champion
                wrote on last edited by
                #7

                @shav
                Hi
                While it's a great idea to learn how to cross compile it's also very complex.
                You often end up with complete build of the framework for each platform.
                And once you get it up and running, it breaks kinda easy if you update the OS or the toolchain.

                For that reason, using virtual machines is just more effective and if I hire someone new, I can just
                give him a copy and it takes minutes to get up and running and not days.
                If I damage it, it can fast be restored.

                As a real skill though. Being able to setup cross compiling for Arm is a very good thing.

                Good luck :)

                1 Reply Last reply
                1
                • shavS Online
                  shavS Online
                  shav
                  wrote on last edited by shav
                  #8

                  Hi everyone!

                  I'm found the solution of my problem with cross compilation on OS X. The solution is MXE.

                  Here is script to install:

                  #install all need tools using home brew.
                  brew install autoconf automake coreutils gdk-pixbuf gettext gnu-sed gnu-tar intltool libtool p7zip wget xz
                  
                  #install scons tool
                  ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)" < /dev/null 2> /dev/null
                  brew install scons
                  
                  mkdir mxe && cd mxe
                  
                  #install mxe
                  git clone https://github.com/mxe/mxe.git .
                  
                  export PATH=$PATH:/usr/local/opt/gettext/bin
                  
                  #install qt 5 for windows 32 bit by default.
                  make EXCLUDE_PKGS='gsoap' qt5
                  

                  After install you will need to add compiler to QtCreator. Also add path to MXE bin folder:

                  <path_to_mxe_foler>/usr/x86_64-apple-darwin16.1.0/bin
                  <path_to_mxe_foler>/usr/bin
                  

                  Thats it!

                  Now I test it on my project and let you now about results.

                  1 Reply Last reply
                  2

                  • Login

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