Apple has transitioned Macs from Intel to ARM (M1/M2) chips. Within the course of it has supplied an emulation layer (Rosetta2) to make sure that the brand new ARM Macs can nonetheless run purposes created for Intel Macs. The emulation works very nicely, however is quoted to be some 20% slower than working native ARM binaries. That will not look like rather a lot, however it’s important on processor intensive purposes reminiscent of my very own data wrangling software, which regularly processes datasets with tens of millions of rows by means of complicated sequences of merging, splitting, reformatting, filtering and reshaping. Additionally individuals who have simply spent a small fortune on a shiny new ARM Mac can get grumpy about not having a local ARM binary to run on it. So I’ve been investigating transferring Straightforward Knowledge Rework from an Intel binary to a Common (‘fats') binary containing each Intel and ARM binaries. This can be a course of acquainted from transferring my seating planner software for Mac from PowerPC to Intel chips some years in the past. Hopefully I’ll have retired earlier than the subsequent chip change on the Mac.
My software program is constructed on-top of the wonderful Qt cross-platfom framework. Qt introduced help for Mac Common binaries in Qt 6.2 and Qt 5.15.9. I’m sticking with Qt 5 for now, as a result of it higher helps a number of textual content encodings and since I don’t see any explicit benefit to switching to Qt 6 but. However, there’s a wrinkle. Qt 5.15.3 and later are solely out there to Qt clients with business licenses. I wish to use the QtCharts element in Straightforward Knowledge Rework v2, and QtCharts requires a business license (or GPL, which is a no-go for me). I additionally need entry to all the most recent bug fixes for Qt 5. So I made a decision to modify from the free LGPL license and purchase a business Qt license. Fortunately I used to be eligible for the Qt small business license which is at present $499 per yr. The push in the direction of business licensing is controversial with Qt builders, however I actually recognize Qt and all of the work that goes into it, so I’m completely happy to help the enterprise (not sufficient to pay the eye-watering charge for a full enterprise license although!).
Transferring from producing an Intel binary utilizing LGPL Qt to producing a Common binary utilizing business Qt concerned a number of main stumbling factors that took me hours and quite a lot of googling to kind out. I’m going to spell them out right here to avoid wasting you that ache. You’re welcome.
- The newest Qt 5 LTS releases should not out there by way of the Qt upkeep software you probably have open supply Qt put in. After you purchase your business licence you’ll want to delete your open supply set up and all of the related license recordsdata. Right here is the data I obtained from Qt help:
I assume that you simply had been beforehand utilizing open supply model, is that appropriate? Qt 5.15.10 ought to be out there by means of the upkeep software however it's required to take away the outdated open supply set up fully and likewise take away the open supply license recordsdata out of your system. So, first step is to take away the outdated Qt set up fully. Then take away the outdated open supply licenses which could exist. Directions for eradicating the license recordsdata: **************************** Unified installer/maintenancetool/qtcreator will save all licenses (downloaded from the used Qt Account) inside the brand new qtlicenses.ini file. You could take away the next recordsdata to totally reset the license data. Home windows "C:/Customers/%USERNAME%/AppData/Roaming/Qt/qtlicenses.ini" "C:/Customers/%USERNAME%/AppData/Roaming/Qt/qtaccount.ini" Linux "/house/$USERNAME/.native/share/Qt/qtlicenses.ini" "/house/$USERNAME/.native/share/Qt/qtaccount.ini" OS X "/Customers/$USERNAME/Library/Utility Help/Qt/qtlicenses.ini" "/Customers/$USERNAME/Library/Utility Help/Qt/qtaccount.ini" As a facet be aware: If the recordsdata above can't be discovered $HOME/.qt-license(Linux/macOS) or %USERPROFILE%.qt-license(Home windows) file is used as a fallback. .qt-license file could be downloaded from Qt Account. https://account.qt.io/licenses Make sure to identify the Qt license file as ".qt-license" and never for instance ".qt-license.txt". *********************************************************************** After eradicating the outdated set up and the license recordsdata, please obtain the brand new on-line installer by way of your business Qt Account. You'll be able to login there at: https://login.qt.io/login After putting in Qt with business license, it ought to be capable of discover the Qt 5.15.10 additionally by means of the upkeep software along with on-line installer.
- Then you’ll want to obtain the business installer out of your on-line Qt account and reinstall all of the Qt variations you want. Gigabytes of it. Time to drink some espresso. Loads of espresso.
- In your .professional file you’ll want to add:
macx QMAKE_APPLE_DEVICE_ARCHS = x86_64 arm64
- Observe that the above doubles the construct time of your utility, so that you in all probability don’t need it set for daily growth.
- You should use macdeployqt to create your deployable Common .app however, and that is the important step that took me hours to work out, you’ll want to use <QtDir>/macos/bin/macdeployqt not <QtDir>/clang_64/bin/macdeployqt . Doh!
- You’ll be able to test the .app is Common utilizing the lipo command, e.g.:
lipo -detailed_info EasyDataTransform.app/Contents/MacOS/EasyDataTransform
- I used to be in a position to make use of my present practise of copying further recordsdata (third occasion libraries, assist and so on) into the .app file after which digitally signing every thing utilizing codesign –deep . Fortunately the one third occasion library I take advantage of other than Qt (the wonderful libXL library for Excel) is out there as a Common framework.
- I notarize the appliance, as earlier than.
I did all of the above on an Intel iMac utilizing the most recent Qt 5 LTS launch (Qt 5.15.10) and XCode 13.4 on macOS 12. I then examined it on an ARM MacBook Air. Little doubt you can even construct Common binaries on an ARM Mac.
Unsurprisingly the Common app is considerably bigger than the Intel-only model. My Straightforward Knowledge Rework .dmg file (which additionally contains quite a lot of assist documentation) went from ~56 MB to ~69 MB. Nonetheless that’s nonetheless positively anorexic in comparison with many bloated trendy apps (taking a look at you Electron).
A few checks I did on an ARM MacBook Air confirmed ~16% enchancment in efficiency. For instance becoming a member of two 500,000 row x 10 column tables went from 4.5 seconds to three.8 seconds. Clearly the efficiency enchancment is determined by the duty and the system. One buyer reported batch processing 3,541 JSON Information and writing the outcomes to CSV went from 12.8 to eight.1 seconds, a 37% enchancment.
 I’m not judging.
 Apparently using –deep is frowned on by Apple. However it works (for now anyway). Chew me, Apple.