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 effectively, however is quoted to be some 20{f65efea6d27829be98a14bd166213de8b08b157d7769decbd4c759b4a6936bdf} slower than working native ARM binaries. That won’t look like so much, however it’s vital on processor intensive purposes corresponding to my very own data wrangling software, which regularly processes datasets with tens of millions of rows by means of advanced 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 shifting Straightforward Information Remodel from an Intel binary to a Common (‘fats'[1]) binary containing each Intel and ARM binaries. It is a course of acquainted from shifting 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 superb 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 accessible to Qt clients with industrial licenses. I wish to use the QtCharts part in Straightforward Information Remodel v2, and QtCharts requires a industrial license (or GPL, which is a no-go for me). I additionally need entry to all the newest bug fixes for Qt 5. So I made a decision to modify from the free LGPL license and purchase a industrial Qt license. Fortunately I used to be eligible for the Qt small business license which is presently $499 per 12 months. The push in direction of industrial licensing is controversial with Qt builders, however I actually respect Qt and all of the work that goes into it, so I’m glad to help the enterprise (not sufficient to pay the eye-watering charge for a full enterprise license although!).
Shifting from producing an Intel binary utilizing LGPL Qt to producing a Common binary utilizing industrial Qt concerned a number of main stumbling factors that took me hours and plenty of googling to type 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 usually are not accessible through the Qt upkeep device in case you have open supply Qt put in. After you purchase your industrial licence you have to delete your open supply set up and all of the related license information. Right here is the data I received from Qt help:
I assume that you simply have been beforehand utilizing open supply model, is that appropriate? Qt 5.15.10 must be accessible by means of the upkeep device however it's required to take away the outdated open supply set up fully and in addition take away the open supply license information 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 information: **************************** Unified installer/maintenancetool/qtcreator will save all licenses (downloaded from the used Qt Account) inside the brand new qtlicenses.ini file. That you must take away the next information to totally reset the license info. Home windows "C:/Customers/{f65efea6d27829be98a14bd166213de8b08b157d7769decbd4c759b4a6936bdf}USERNAME{f65efea6d27829be98a14bd166213de8b08b157d7769decbd4c759b4a6936bdf}/AppData/Roaming/Qt/qtlicenses.ini" "C:/Customers/{f65efea6d27829be98a14bd166213de8b08b157d7769decbd4c759b4a6936bdf}USERNAME{f65efea6d27829be98a14bd166213de8b08b157d7769decbd4c759b4a6936bdf}/AppData/Roaming/Qt/qtaccount.ini" Linux "/residence/$USERNAME/.native/share/Qt/qtlicenses.ini" "/residence/$USERNAME/.native/share/Qt/qtaccount.ini" OS X "/Customers/$USERNAME/Library/Software Help/Qt/qtlicenses.ini" "/Customers/$USERNAME/Library/Software Help/Qt/qtaccount.ini" As a facet observe: If the information above can't be discovered $HOME/.qt-license(Linux/macOS) or {f65efea6d27829be98a14bd166213de8b08b157d7769decbd4c759b4a6936bdf}USERPROFILE{f65efea6d27829be98a14bd166213de8b08b157d7769decbd4c759b4a6936bdf}.qt-license(Home windows) file is used as a fallback. .qt-license file might be downloaded from Qt Account. https://account.qt.io/licenses You should definitely title the Qt license file as ".qt-license" and never for instance ".qt-license.txt". *********************************************************************** After eradicating the outdated set up and the license information, please obtain the brand new on-line installer through your industrial Qt Account. You possibly can login there at: https://login.qt.io/login After putting in Qt with industrial license, it ought to be capable to discover the Qt 5.15.10 additionally by means of the upkeep device along with on-line installer.
- Then you have to obtain the industrial 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. A whole lot of espresso.
- In your .professional file you have to add:
macx QMAKE_APPLE_DEVICE_ARCHS = x86_64 arm64
- Be aware that the above doubles the construct time of your utility, so that you most likely don’t need it set for daily growth.
- You should utilize macdeployqt to create your deployable Common .app however, and that is the essential step that took me hours to work out, you have to use <QtDir>/macos/bin/macdeployqt not <QtDir>/clang_64/bin/macdeployqt . Doh!
- You possibly can examine 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 information (third occasion libraries, assist and so forth) into the .app file after which digitally signing every part utilizing codesign –deep [2]. Fortunately the one third occasion library I exploit aside from Qt (the superb libXL library for Excel) is offered as a Common framework.
- I notarize the applying, as earlier than.
I did all of the above on an Intel iMac utilizing the newest 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 Information Remodel .dmg file (which additionally consists of plenty 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 assessments I did on an ARM MacBook Air confirmed ~16{f65efea6d27829be98a14bd166213de8b08b157d7769decbd4c759b4a6936bdf} 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 depends upon 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{f65efea6d27829be98a14bd166213de8b08b157d7769decbd4c759b4a6936bdf} enchancment.
[1] I’m not judging.
[2] Apparently using –deep is frowned on by Apple. However it works (for now anyway). Chew me, Apple.