[Interest] Mac universal binary
Jeffrey Walton
noloader at gmail.com
Sat Oct 4 07:56:18 CEST 2025
On Fri, Oct 3, 2025 at 9:32 PM Turtle Creek Software
<support at turtlesoft.com> wrote:
>
> Are there instructions somewhere for setting up Qt 6.x to make a universal binary that runs on both Intel and Apple Silicon?
I should probably sit this one out since I am a novice with Qt, but...
Qt has to be multiarch safe. I do not know if it is. If it is, then
you can usually just add the arch flag multiple times to CFLAGS and
CXXFLAGS and build as usual. So you would add "-arch x86_64 -arch
arm64" to CFLAGS and CXXFLAGS, and then run make as usual. Many
libraries are not multiarch safe, so...
The Apple docs for universal binaries is at "Universal Binary
Programming Guidelines",
<https://developer.apple.com/library/archive/documentation/MacOSX/Conceptual/universal_binary/universal_binary_intro/universal_binary_intro.html>.
Apple considers it a legacy document, but does not provide links to
the current document or best practices.
I used the Apple documents to build various libraries as universal
binaries, like Crypto++ and OpenSSL. The libraries are not (or were
not) multiarch safe. So I had to build the different arches
separately, and then combine them later using lipo. The Crypto++
article on the subject is at
<https://www.cryptopp.com/wiki/Universal_Binaries>. The OpenSSL Q&A
is at <https://stackoverflow.com/questions/25530429/build-multiarch-openssl-on-os-x>.
As a first step, you might give it a try adding "-arch x86_64 -arch
arm64" to CFLAGS and CXXFLAGS, and then run make. Report back with
the errors you encounter.
Finally (and obviously), Qt has to build for a single arch (like
Apple's x86_64 or Apple Silicon) before you can do other things. If
the build is already broken, then there's no sense in trying to do the
multiarch build.
Jeff
More information about the Interest
mailing list