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

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.
  • S Offline
    S Offline
    shav
    wrote on 22 Nov 2016, 22:38 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?

    S J 2 Replies Last reply 22 Nov 2016, 22:39
    0
    • S shav
      22 Nov 2016, 22:38

      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?

      S Offline
      S Offline
      shav
      wrote on 22 Nov 2016, 22:39 last edited by
      #2
      This post is deleted!
      1 Reply Last reply
      0
      • S shav
        22 Nov 2016, 22:38

        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?

        J Offline
        J Offline
        jsulm
        Lifetime Qt Champion
        wrote on 23 Nov 2016, 05:44 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
        • S Offline
          S Offline
          shav
          wrote on 23 Nov 2016, 17:19 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.

          J 1 Reply Last reply 24 Nov 2016, 05:58
          0
          • S shav
            23 Nov 2016, 17:19

            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.

            J Offline
            J Offline
            jsulm
            Lifetime Qt Champion
            wrote on 24 Nov 2016, 05:58 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
            • S Offline
              S Offline
              shav
              wrote on 24 Nov 2016, 18:04 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!

              M 1 Reply Last reply 24 Nov 2016, 18:10
              1
              • S shav
                24 Nov 2016, 18:04

                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!

                M Offline
                M Offline
                mrjj
                Lifetime Qt Champion
                wrote on 24 Nov 2016, 18:10 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
                • S Offline
                  S Offline
                  shav
                  wrote on 27 Nov 2016, 13:27 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

                  8/8

                  27 Nov 2016, 13:27

                  • Login

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