Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. How to build Qt6 from source for arm and intel on macOS
Forum Updated to NodeBB v4.3 + New Features

How to build Qt6 from source for arm and intel on macOS

Scheduled Pinned Locked Moved Unsolved General and Desktop
7 Posts 2 Posters 2.2k 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.
  • M Offline
    M Offline
    mjsmithers
    wrote on last edited by
    #1

    Hi,

    I've just moved to an Apple M2 and I'm trying to build Qt from source for both Intel and ARM. (I've previously built Qt successfully for Intel on my Intel mac.)

    Qt's documentation on
    https://doc.qt.io/qt-6/macos-building.html
    says to use

    ./configure -- -DCMAKE_OSX_ARCHITECTURES="x86_64h;arm64"
    

    and I add the prefix option, giving

    ./configure -- -DCMAKE_OSX_ARCHITECTURES="x86_64h;arm64" -prefix /Users/<myname>/Qt/6.4.3_fixed
    

    This doesn't work. The build process complains about an extra path - presumably due to the '--'.

    However, if I use

    ./configure -DCMAKE_OSX_ARCHITECTURES="x86_64h;arm64" -prefix /Users/<myname>/Qt/6.4.3_fixed
    

    (and
    cmake –build . –parallel
    cmake –install .
    )

    the build works but the installed directory is about half the size of the precompiled macOS download from the Qt Maintenance app. This suggests to me that the precompiled binaries support both ARM and Intel, but that my build does not.

    Any help would be most appreciated. (I'm trying to move to universal binaries and there are a few things I regularly need to patch in Qt, hence building myself.)

    Michael

    SGaistS 1 Reply Last reply
    0
    • M mjsmithers

      Hi,

      I've just moved to an Apple M2 and I'm trying to build Qt from source for both Intel and ARM. (I've previously built Qt successfully for Intel on my Intel mac.)

      Qt's documentation on
      https://doc.qt.io/qt-6/macos-building.html
      says to use

      ./configure -- -DCMAKE_OSX_ARCHITECTURES="x86_64h;arm64"
      

      and I add the prefix option, giving

      ./configure -- -DCMAKE_OSX_ARCHITECTURES="x86_64h;arm64" -prefix /Users/<myname>/Qt/6.4.3_fixed
      

      This doesn't work. The build process complains about an extra path - presumably due to the '--'.

      However, if I use

      ./configure -DCMAKE_OSX_ARCHITECTURES="x86_64h;arm64" -prefix /Users/<myname>/Qt/6.4.3_fixed
      

      (and
      cmake –build . –parallel
      cmake –install .
      )

      the build works but the installed directory is about half the size of the precompiled macOS download from the Qt Maintenance app. This suggests to me that the precompiled binaries support both ARM and Intel, but that my build does not.

      Any help would be most appreciated. (I'm trying to move to universal binaries and there are a few things I regularly need to patch in Qt, hence building myself.)

      Michael

      SGaistS Offline
      SGaistS Offline
      SGaist
      Lifetime Qt Champion
      wrote on last edited by
      #2

      Hi,

      Run ˋlipo -info` on one of the library to check which architectures you have. The size might not play a role depending on the options you used with the installer such as installing the debug symbols.

      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
      • M Offline
        M Offline
        mjsmithers
        wrote on last edited by
        #3

        Thanks. I've since found that my successful build - above - is defaulting to intel and is ignoring arm64. if I reorder the configure command to:

        ./configure -prefix /Users/<myname>/Qt/6.4.3_fixed -- -DCMAKE_OSX_ARCHITECTURES="x86_64h;arm64"
        

        the configure command completes successfully. However the build

        cmake –build . –parallel
        

        fails to link qtbase/lib/QtGui.framework/Versions/A/QtGui and gives a bunch of "Undefined symbols for architecture arm64" errors relating to support for Neon.

        SGaistS 1 Reply Last reply
        0
        • M mjsmithers

          Thanks. I've since found that my successful build - above - is defaulting to intel and is ignoring arm64. if I reorder the configure command to:

          ./configure -prefix /Users/<myname>/Qt/6.4.3_fixed -- -DCMAKE_OSX_ARCHITECTURES="x86_64h;arm64"
          

          the configure command completes successfully. However the build

          cmake –build . –parallel
          

          fails to link qtbase/lib/QtGui.framework/Versions/A/QtGui and gives a bunch of "Undefined symbols for architecture arm64" errors relating to support for Neon.

          SGaistS Offline
          SGaistS Offline
          SGaist
          Lifetime Qt Champion
          wrote on last edited by
          #4

          Which errors are you getting exactly ?

          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
          • M Offline
            M Offline
            mjsmithers
            wrote on last edited by mjsmithers
            #5

            I raised this as a bug report with Qt. They have reproduced the problem when using "x86_64h;arm64" and they are still looking into it.

            Dropping the 'h', and therefore using "x86_64;arm64", works fine.

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

              Good to know, thanks !

              Can you share the link of your report ?

              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
              • M Offline
                M Offline
                mjsmithers
                wrote on last edited by
                #7

                https://bugreports.qt.io/browse/QTBUG-113694

                1 Reply Last reply
                1

                • Login

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