c++qtqt-creatorapple-m1rosetta

How to make Qt Creator use Rosetta and x86 compiler on Mac M1?


I am using Qt 5.15.2 on my Mac mini with M1 chip. This works fine (due to Rosetta). Below is the list of compilers Qt Creator found on this computer, and among them is the C++, x86 64bit that I use. No problem.

compilers amiable on the first M1 computer

I would like to use the same settings on a (somewhat newer) Mac Book Pro (also with M1 chip). Below is the list of compilers Qt Creator finds on this computer, the x86 is now missing!

compilers amiable on the new M1 computer

I do not know if I have a x86 compiler on the new M1-computer. I have installed Xcode and the command line tools for XCode 13.2.

  1. Can I somewhere tell Qt Creator that the deployment target is x86?

  2. Does /usr/bin/clang++ only compile for the ARM/M1-chip, or can it also produce and link to x86 code?

  3. if not, how can I find out if there is an x86 compiler on my new M1-computer?

  4. If the compiler is missing, how to install it?

Any help would be most appreciated!


Solution

  • A few tips that can help, I just setup a project using Qt 5.15.2 on a 2021 M1 Mac.

    Note this will likely be different for Qt >= 6.

    1. Can I somewhere tell Qt Creator that the deployment target is x86?

    Yes, you can do this using specific argument in the build settings of your kit.

    ℹ️ Click Manage Kits.. in the projects view to open the preferences editor where you can update your CMake configuration.


    1. Does /usr/bin/clang++ only compile for the ARM/M1-chip, or can it also produce and link to x86 code?

    With rosetta installed (/usr/sbin/softwareupdate –install-rosetta –agree-to-license), and the configuration above, yes you can compile and link x86 binaries.