6 ms·
How to create a Qt 5 ARM/Intel universal binary for Mac
- DarrenDev 3y agoVery timely. I'm in the middle of trying to work out how to do this for an Electron app built using Electron.Net and it's a bit of a nightmare. Different steps, but looking for the same outcome. Thanks.
- swyx 3y agoi am currently in Apple code signing and notarizing hell for https://github.com/smol-ai/GodMode https://github.com/smol-ai/GodMode :(
- xrd 3y agomacdeployqt (which comes with Qt) has support for those things. Are you using that utility? There are other options, but macdeployqt has a nice combination of switches like -dmg, -sign-for-notarization, -appstore-compliant, etc. But, yes, it is hell.
- swyx 3y agoi don't because i'm using electron instead of Qt. but honestly at this point i'll do anything to make it just build properly for all devices.
- semireg 3y agoI’m not going to say I’m an expert, but I’ve cataloged every electron error and show-stopper for an app I’ve built and deployed on windows/macOS for 5 years. Feel free to get in touch with me if you’d like help, or maybe just a slack channel where you can scream into the void. Best of luck, this stuff is CHALLENGING.
- mrkpdl 3y agoMy long long time mac user brain read QT 5 as ‘QuickTime 5’ and I got excited. But it seems qt means something else here!
- wtallis 3y agoTo be fair, the headline says Qt, not QT.
- mrkpdl 3y agoYes in all fairness, that is true, it does say that. One is made up of the letters q and t, while the other is made up of the letters q and t.
- yjftsjthsd-h 3y agoHuman language is often case sensitive.
- mrkpdl 3y agoAh humans. As humans does one thing not rouse in us the thought of another? Do we not draw connections between two things? Are these connections Never amusing? Has the smell of a soap reminded us of a summer spent at childhood friend’s house? Or similar? Or are all moments of joyful connection drawn to a halt at the hand of the parser? Forgotten to case sensitivity?
- olliej 3y agoHappily I've seen both QuickTime and "Qt" abbreviated as "qt", "Qt", and "QT" because human languages are often ambiguous (in fact all written human languages can have ambiguity, but not all have capitalization, so arguably the former ambiguity is more prevalent and important than the latter)
- VadimPR 3y agoAnyone have Qt5 universal binary builds working as part of CI/CD?
- Klonoar 3y agoDolphin has actually had this for their macOS builds for over a year now. https://github.com/dolphin-emu/dolphin https://github.com/dolphin-emu/dolphin
- jlarcombe 3y agoYes, for a long time, switched to Qt 6 now though.
- reassembled 3y agoWe do this internally at my company with Qt5.15.2. We built Qt from sources for both Apple Silicon and Intel first and used those outputs in our app builds. The tl;dr is that you have to build your Apple Silicon binary with Qt for Apple Silicon, build the x64 binary with Qt for Intel, and then use the Apple "lipo" tool to stitch the two together. This can all be accomplished on an Apple Silicon Mac. The tricky part for me was figuring out that I had to switch the shell to x86_64 to run the compiler tools for the Intel build, after running the compiler for the Apple Silicon build under an arm64 shell.
- xrd 3y agoSadly, this is a big problem. But, Rosetta is incredible. My solution for now: build only on Intel based Macs and use the binaries everywhere, with Rosetta when needed. I've had lots of errors running all kinds of builds with "error, arm64 code..." it's not a solved problem by a long shot. Until the prevalence of M1/M2 is overwhelming, I'm just going to stick with Intel builds.
- olliej 3y ago"I'm going to produce software that runs slower and uses more power, I'm sure users will love this"?
- xrd 3y agoI agree it isn't optimal. But, Apple is asking all their downstream library authors to migrate to a new platform and support the old one (via "universal binaries"). It just isn't feasible or practical for app developers nor for the library authors, especially when those authors are providing free and open source libraries. I wouldn't have imagined it possible, but we are shipping a x86 binary that uses a lot of open source libraries, that do video compression and decompression. And, Rosetta is incredible and the performance is amazing despite it all being x86. The M1 is a feat of engineering and Rosetta is an incredible and unexpected part of that marvel.
- saagarjha 3y agoIt's not feasible or practical for them to recompile their code?
- CaliforniaKarl 3y agoAs the article shows, it’s not as simple as changing a command-line option.
- dee-bee 3y agoThis seems to be an artifact of using Qt Creator. Generally speaking it is just a matter of running the same compilation steps with different targets (so long as you don't have arch-specific stuff in there like reliance on aliasing behavior or specialized simd, of course). Qt uses just about the most complicated build process I've seen outside of Xcode/objective-c++. I'm curious to compare what the GTK build process looks like as a universal binary; I think RawTherapee has done it.
- DiabloD3 3y agoI used to think it'd be easier to just not support Macs at all for most smaller tech companies, and after reading this, I still think that. Apple has not changed its policy in over a decade: they don't care about software devs, they don't want you to release your stuff there, and only the biggest companies who are willing to throw dev after dev at the problem get to participate in the walled garden. Screw 'em, release your software on Windows and Linux and don't look back.
- 128keaton 3y agoThis is a Qt5 project and not really indicative of the actual development experience imho. Writing native software for native platforms with native UI and bindings is a big undertaking but worth it in the long term
- olliej 3y agoI'm sorry, what is the bit that is hard? * You have to setup the binary to build N times (done automatically if you use the tools apple provides while apparently not caring about developers) * In this case you have to setup a non-standard UI toolkit, which obviously is going to make things harder, and make that build universal as well. Qt claims to support mac and iOS so I'm surprised that doesn't happen by default * Codesign, which is a trivial step The hardest part here is just the "I don't want to make a native app so I'm going to build an entire 3rd party UI toolkit", which is not an argument that apple doesn't care about devs.
- tumult 3y agoApple requires “notarization,” not just code signing. If you code sign your app and don’t “notarize” it, it will refuse to run. Like it will be harder for the end user to run it than if you had not code signed it at all. Submitting for “notarization” requires an Apple developer account with an active paid subscription and payment method. You have to upload it to Apple and wait for it to be approved in an asynchronous process which can sometimes take tens of minutes each time.
- 3y ago