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 specify target architecture (x86_64 or arm/native) when building qmake project on M1?
Forum Updated to NodeBB v4.3 + New Features

How to specify target architecture (x86_64 or arm/native) when building qmake project on M1?

Scheduled Pinned Locked Moved Solved General and Desktop
13 Posts 5 Posters 5.1k Views 4 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.
  • V Violet Giraffe

    @jsulm, I already do, this is Qt 5.15.2 clang_64 (and 5.15.2 only exists for x86_64 on Mac, I believe).

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

    @Violet-Giraffe hi,

    Your other project likely uses libraries that are universal, meaning that they embed both x86_64 and arm64 symbols.

    From memory, Qt 5.15.2 is single arch so you would need to build it yourself for the M1.

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

    V 1 Reply Last reply
    0
    • SGaistS SGaist

      @Violet-Giraffe hi,

      Your other project likely uses libraries that are universal, meaning that they embed both x86_64 and arm64 symbols.

      From memory, Qt 5.15.2 is single arch so you would need to build it yourself for the M1.

      V Offline
      V Offline
      Violet Giraffe
      wrote on last edited by Violet Giraffe
      #5

      @SGaist, hi, thanks for chiming in! Let me clarify and expand on the question.

      1. I do not want to build for M1/ARM, I only want a pure x86_64 build. So it's no problem that Qt 5.15.2 doesn't support M1.
      2. Some of my own libraries, built by this project, were compiled for M1, and some others for x86_64. It's not even that my M1 binaries cannot be linked with x64 Qt - no, parts of my own project and my own code are being built inconsistently.
      3. The other project is also a C++ qmake subdirs project that uses Qt 5.15.2 and it builds fine, but that didn't help me to figure out why or what the problem is.

      So in short - I don't want to target M1, I want to stop it from targeting M1 and force x86_64 instead.

      V 1 Reply Last reply
      0
      • V Violet Giraffe

        @SGaist, hi, thanks for chiming in! Let me clarify and expand on the question.

        1. I do not want to build for M1/ARM, I only want a pure x86_64 build. So it's no problem that Qt 5.15.2 doesn't support M1.
        2. Some of my own libraries, built by this project, were compiled for M1, and some others for x86_64. It's not even that my M1 binaries cannot be linked with x64 Qt - no, parts of my own project and my own code are being built inconsistently.
        3. The other project is also a C++ qmake subdirs project that uses Qt 5.15.2 and it builds fine, but that didn't help me to figure out why or what the problem is.

        So in short - I don't want to target M1, I want to stop it from targeting M1 and force x86_64 instead.

        V Offline
        V Offline
        Violet Giraffe
        wrote on last edited by Violet Giraffe
        #6

        Found it! The required compiler flag is -arch x86_64

        1 Reply Last reply
        1
        • V Violet Giraffe has marked this topic as solved on
        • MehrshadM Offline
          MehrshadM Offline
          Mehrshad
          wrote on last edited by
          #7

          Excuse me, but I'm still having a similar problem. I did as you said, and ran ./qmake -set arch x86_64, but nothing changed in action. Could you state more specifically what you did to get it fixed?

          More details:
          I'm on an Intel Mac running macOS 12.6.8 and Xcode 14.2. The thing is, I had been using Qt 6.4.2 and Qt Creator 10.0.2, but after a series of Qt-related upgrades, I eventually ended up with Qt 6.5.2 and Qt Creator 11.0.0. Right now, Qt Creator cannot identify any Qt-related classes or identifiers, and I'm getting the same error as you did under Preferences, Kits, Qt Versions. However, projects are being built using the play button.

          jsulmJ 1 Reply Last reply
          0
          • MehrshadM Mehrshad

            Excuse me, but I'm still having a similar problem. I did as you said, and ran ./qmake -set arch x86_64, but nothing changed in action. Could you state more specifically what you did to get it fixed?

            More details:
            I'm on an Intel Mac running macOS 12.6.8 and Xcode 14.2. The thing is, I had been using Qt 6.4.2 and Qt Creator 10.0.2, but after a series of Qt-related upgrades, I eventually ended up with Qt 6.5.2 and Qt Creator 11.0.0. Right now, Qt Creator cannot identify any Qt-related classes or identifiers, and I'm getting the same error as you did under Preferences, Kits, Qt Versions. However, projects are being built using the play button.

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

            @Mehrshad said in How to specify target architecture (x86_64 or arm/native) when building qmake project on M1?:

            and I'm getting the same error as you did under Preferences, Kits, Qt Versions

            What error is that?
            What exact Qt version did you install?

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

            MehrshadM 1 Reply Last reply
            0
            • jsulmJ jsulm

              @Mehrshad said in How to specify target architecture (x86_64 or arm/native) when building qmake project on M1?:

              and I'm getting the same error as you did under Preferences, Kits, Qt Versions

              What error is that?
              What exact Qt version did you install?

              MehrshadM Offline
              MehrshadM Offline
              Mehrshad
              wrote on last edited by
              #9

              @jsulm I'm sorry. I realize I had replied on the wrong topic. I posted an all-new topic here. I would be more than glad if you could check it out and tell me what you think.

              1 Reply Last reply
              0
              • V Offline
                V Offline
                Violet Giraffe
                wrote on last edited by Violet Giraffe
                #10

                For Qt 6.5.3:

                QMAKE_APPLE_DEVICE_ARCHS = x86_64

                or QMAKE_APPLE_DEVICE_ARCHS = x86_64 arm64 to create a universal binary, but I have not tested that.

                1 Reply Last reply
                0
                • A Offline
                  A Offline
                  Austin K
                  wrote on last edited by
                  #11

                  After creating a 64 bit arm64 binary for m1 on OSX Im getting an error with macdeployqt:

                  mach-o file, but is an incompatible architecture (have 'x86_64', need 'arm64e' or 'arm64')

                  (mach-o file, but is an incompatible architecture (have 'x86_64', need 'arm64e' or 'arm64')), '~/build/arm64/myapp/Contents/MacOS/QtQuickControls2.framework/Versions/5/QtQuickControls2' (no such file), '~build/arm64/myapp/Contents/Frameworks/QtQuickControls2.framework/Versions/5/QtQuickControls

                  When I look at the actual app it is a 64 bit arm app.

                  Using Qt 5.15.17 - latest and greatest.

                  When running the application in Qt Creator it runs fine. macdeployqt is not creating a correct binary for arm64. However it works fine for x86_64.

                  SGaistS 1 Reply Last reply
                  0
                  • A Austin K

                    After creating a 64 bit arm64 binary for m1 on OSX Im getting an error with macdeployqt:

                    mach-o file, but is an incompatible architecture (have 'x86_64', need 'arm64e' or 'arm64')

                    (mach-o file, but is an incompatible architecture (have 'x86_64', need 'arm64e' or 'arm64')), '~/build/arm64/myapp/Contents/MacOS/QtQuickControls2.framework/Versions/5/QtQuickControls2' (no such file), '~build/arm64/myapp/Contents/Frameworks/QtQuickControls2.framework/Versions/5/QtQuickControls

                    When I look at the actual app it is a 64 bit arm app.

                    Using Qt 5.15.17 - latest and greatest.

                    When running the application in Qt Creator it runs fine. macdeployqt is not creating a correct binary for arm64. However it works fine for x86_64.

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

                    @Austin-K hi and welcome to devnet,

                    AFAIK 5.15.17 is currently a commercial only release so you should check with the Qt Company what is happening with macdeployqt.

                    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
                    • A Offline
                      A Offline
                      Austin K
                      wrote on last edited by Austin K
                      #13

                      @SGaist to I actually was able to fix this.

                      I had to ensure I was using the arm 64-bit version of macdeployqt contained in /macos/

                      ~/Qt5.15.17/5.15.17/clang_64/bin/macdeployqt
                      ~/Qt5.15.17/5.15.17/macos/bin/macdeployqt

                      Its important to use the correct one for the architecture you are building for.

                      Thank you.

                      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