Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Installation and Deployment
  4. Cross compile Qt from Linux to Macos
Forum Updated to NodeBB v4.3 + New Features

Cross compile Qt from Linux to Macos

Scheduled Pinned Locked Moved Solved Installation and Deployment
9 Posts 4 Posters 4.4k 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.
  • I Offline
    I Offline
    IsAnton
    wrote on 14 Jan 2019, 14:20 last edited by
    #1

    Hi everyone!

    In our company we need to compile .app from Linux to Macos. And for now I just searched the internet about actual topics, and found only ones from 5 or more year older. Does anybody know any fresh solution for this?

    Documentation tells me, that while building Qt from source, I have to specify flat -xplatform and tell it for example "macx-clang". But it always says me an error during build that "Failed to process makespec for platform "macx-clang". Project ERROR: Could not resolve SDK Path for "macosx"."

    I already get from the other projects some macos tools, such as otool, af, and others, and set some parameters in the configuration files for ./configure script. But this error comes from this variable "QMAKE_MAC_SDK = macosx", and in the script further it goes to /usr/bin/xcodebuild -sdk $$QMAKE_MAC_SDK. And in Linux no such tool as xcodebuild, does it means that I can't build Qt from Lunux for Macos?

    I also notices, that some old projects tells you to migrate xcode tools from mac to linux, and pack them in specific way, which i failed also, but anyways It doesn't tells you to specify this QMAKE_MAC_SDK.

    Do you have any suggestions, how to fix any of my troubles or do it from scratch?

    J 1 Reply Last reply 14 Jan 2019, 15:00
    0
    • I IsAnton
      14 Jan 2019, 14:20

      Hi everyone!

      In our company we need to compile .app from Linux to Macos. And for now I just searched the internet about actual topics, and found only ones from 5 or more year older. Does anybody know any fresh solution for this?

      Documentation tells me, that while building Qt from source, I have to specify flat -xplatform and tell it for example "macx-clang". But it always says me an error during build that "Failed to process makespec for platform "macx-clang". Project ERROR: Could not resolve SDK Path for "macosx"."

      I already get from the other projects some macos tools, such as otool, af, and others, and set some parameters in the configuration files for ./configure script. But this error comes from this variable "QMAKE_MAC_SDK = macosx", and in the script further it goes to /usr/bin/xcodebuild -sdk $$QMAKE_MAC_SDK. And in Linux no such tool as xcodebuild, does it means that I can't build Qt from Lunux for Macos?

      I also notices, that some old projects tells you to migrate xcode tools from mac to linux, and pack them in specific way, which i failed also, but anyways It doesn't tells you to specify this QMAKE_MAC_SDK.

      Do you have any suggestions, how to fix any of my troubles or do it from scratch?

      J Offline
      J Offline
      J.Hilk
      Moderators
      wrote on 14 Jan 2019, 15:00 last edited by
      #2

      @IsAnton said in Cross compile Qt from Linux to Macos:

      And in Linux no such tool as xcodebuild, does it means that I can't build Qt from Lunux for Macos?

      Yes, Apple is the odd one out. You need a Mac to compile for iOS and/or MacOS. As far as I know, no way around it.


      Be aware of the Qt Code of Conduct, when posting : https://forum.qt.io/topic/113070/qt-code-of-conduct


      Q: What's that?
      A: It's blue light.
      Q: What does it do?
      A: It turns blue.

      I 1 Reply Last reply 14 Jan 2019, 16:02
      2
      • I Offline
        I Offline
        IsAnton
        wrote on 14 Jan 2019, 15:45 last edited by
        #3
        This post is deleted!
        1 Reply Last reply
        0
        • J J.Hilk
          14 Jan 2019, 15:00

          @IsAnton said in Cross compile Qt from Linux to Macos:

          And in Linux no such tool as xcodebuild, does it means that I can't build Qt from Lunux for Macos?

          Yes, Apple is the odd one out. You need a Mac to compile for iOS and/or MacOS. As far as I know, no way around it.

          I Offline
          I Offline
          IsAnton
          wrote on 14 Jan 2019, 16:02 last edited by
          #4

          @J.Hilk But 5 to 7 years ago people told, that they could build Qt at that time with target macos. Did It become impossible after that?

          S 1 Reply Last reply 14 Jan 2019, 16:07
          0
          • I IsAnton
            14 Jan 2019, 16:02

            @J.Hilk But 5 to 7 years ago people told, that they could build Qt at that time with target macos. Did It become impossible after that?

            S Offline
            S Offline
            SGaist
            Lifetime Qt Champion
            wrote on 14 Jan 2019, 16:07 last edited by SGaist
            #5

            Hi,

            @IsAnton said in Cross compile Qt from Linux to Macos:

            @J.Hilk But 5 to 7 years ago people told, that they could build Qt at that time with target macos. Did It become impossible after that?

            Did they talk about cross-compiling Qt form Linux to macOS ?

            It's highly unlikely, Apple never provided any way to cross-compile anything to its platform. To the best of my knowledge, Qt is no exception and never was cross-compiled from Linux to macOS.

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

            I 1 Reply Last reply 14 Jan 2019, 16:24
            1
            • S SGaist
              14 Jan 2019, 16:07

              Hi,

              @IsAnton said in Cross compile Qt from Linux to Macos:

              @J.Hilk But 5 to 7 years ago people told, that they could build Qt at that time with target macos. Did It become impossible after that?

              Did they talk about cross-compiling Qt form Linux to macOS ?

              It's highly unlikely, Apple never provided any way to cross-compile anything to its platform. To the best of my knowledge, Qt is no exception and never was cross-compiled from Linux to macOS.

              I Offline
              I Offline
              IsAnton
              wrote on 14 Jan 2019, 16:24 last edited by
              #6

              @SGaist I believe yes, they did!

              This one for example https://dexp.in/articles/qtcreator-crosscompile/ .

              They built Qt from source for sure :
              ./configure -xplatform macx-x-g++ ...... - from Linux, it was written in 2013. What do you think about this?

              I 1 Reply Last reply 14 Jan 2019, 16:37
              2
              • I IsAnton
                14 Jan 2019, 16:24

                @SGaist I believe yes, they did!

                This one for example https://dexp.in/articles/qtcreator-crosscompile/ .

                They built Qt from source for sure :
                ./configure -xplatform macx-x-g++ ...... - from Linux, it was written in 2013. What do you think about this?

                I Offline
                I Offline
                IsAnton
                wrote on 14 Jan 2019, 16:37 last edited by
                #7

                If we are talking about compiling just some code, not Qt itself, then there are more examples. But it doesn't looks like pretty solid.

                1 Reply Last reply
                0
                • S Offline
                  S Offline
                  SGaist
                  Lifetime Qt Champion
                  wrote on 14 Jan 2019, 16:40 last edited by
                  #8

                  That it's resource I didn't know about, so thank you.

                  On the darker side of things: it's about 7 years old. In between Apple has moved to 100% Clang, macOS is at 10.14 and Xcode 10.

                  You may succeed but you'll have to work you way through it.

                  Also note that it was never officially supported so there may be dragons.

                  One last thing that comes to mind, macOS is now 100% 64bit so don't lose time trying to build a 32bit executable for it.

                  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
                  3
                  • L Offline
                    L Offline
                    litch0
                    wrote on 9 Dec 2020, 20:22 last edited by
                    #9

                    Hello, I know this is a little old but i found out these and test it.
                    using this toolchain
                    combined with this sks
                    and 3 hours of compiling, you have clang build and ready to use. Just pay attention that the Sdks seems to work from 10.9 to 10.13, the other ones throws errors telling that the c++ folder was not found. This limits us to use c++ 17 and not 20. The binaries of Qt can be found on the PyQT Pip page, there you can find binaries windows, linux and macos. But It would be awesome if QT provides just a Tar.gz or zip with these binaries, It was a pain to find. I hope it helped

                    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