I am building KDE Connect for M1 Mac (darwin arm64), but I found KDE Craft deliberately builds packages for x86_64 which is incompatible with arm64, and a number of the prebuilt binaries delivered are x86_64 only, while arm64 versions are available by Homebrew or manually compilation. This causes a lot of compilation errors in linking like “ld: warning: ignoring file /Users/turx/CraftRoot/lib/libKF5IconThemes.5.89.0.dylib, building for macOS-arm64 but attempting to link with file built for macOS-x86_64” or the inverse (when it incorrectly trying to build for x86_64 with arm64 libs), causing "clang: error: linker command failed with exit code 1". I am using macOS 12.1, and a part of my "uname -a" info is "Darwin 21.2.0 Darwin Kernel Version 21.2.0: Sun Nov 28 20:28:41 PST 2021; root:xnu-8019.61.5~1/RELEASE_ARM64_T6000 arm64".
One way I found to solve it is to add the following to each CMakeLists.txt if(APPLE) option(OSX_FRAMEWORK "Build a Mac OS X Framework" ON) set(CMAKE_OSX_ARCHITECTURES “x86_64;arm64" CACHE STRING "Build architectures for Mac OS X" FORCE) else() set(OSX_FRAMEWORK OFF) endif() or pass -DCMAKE_OSX_ARCHITECTURES=x86_64;arm64 to cmake The current build system builds for x86_64 anytime, and the above command is to enable the universal binary build. If we only want to build for one arch at a time, we can change it to “arm64” in case of a build for M1.
I am happy to help solve this problem if you can give me some hints, considering we may not have many developers with an M1 Mac available.
We have tens of CMakeLists.txt so this solution isn't viable. is there a way to set this in CraftSettings.ini ?
We also tried to build KStars on M1 Macs and failed due to this exact issue as well.
For now: arch -arch x86_64 zsh -li . craftenv.sh Now craft will build everything in x86_64 mode.
And Qt5 has no support for arm builds for that reason we won't try to implement it. Some where this year I'll play with qt6 and m1 builds.
Craft can build software for macOS ARM now.