Kext run well on Xcode but kextload failed after archive to others

I was developing kext for use on Apple Silicon Mac, the kext ran well when I put into the app project. However, after I archived the app and installed it on other computers, I got some error messages while doing kextload command. I have no idea what to do, the error messages are as following: "Error domain=KMErrorDomain Code=71 Incompatible architecture: Cannot find arm64e in fat binary. Unsupported Error: one or more extensions are unsupported to load."

I run Xcode projects on M2 Pro MAX and I'm sure the other Mac have been closed SIP. If I use the other Mac to run xcode project, the kext works fine too.

Answered by DTS Engineer in 801641022

As a first step I recommend that you check the built architectures of your KEXT. I would expect to see the following:

% file Test761926.kext/Contents/MacOS/Test761926 
Test761926.kext/Contents/MacOS/Test761926: Mach-O universal binary with 2 architectures: …
Test761926.kext/Contents/MacOS/Test761926 (for architecture x86_64):    Mach-O 64-bit kext bundle x86_64
Test761926.kext/Contents/MacOS/Test761926 (for architecture arm64e):    Mach-O 64-bit kext bundle arm64e

That is, your KEXT should include both the 64-bit Intel (x86_64) and Apple silicon with pointer authentication (arm64e) architectures.

IMPORTANT In general, we do not support pointer authentication on Apple silicon, except for testing purposes (see Preparing your app to work with pointer authentication). However, KEXTs are an exception to this rule. KEXTS must be built for arm64e, not arm64.

Share and Enjoy

Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"

As a first step I recommend that you check the built architectures of your KEXT. I would expect to see the following:

% file Test761926.kext/Contents/MacOS/Test761926 
Test761926.kext/Contents/MacOS/Test761926: Mach-O universal binary with 2 architectures: …
Test761926.kext/Contents/MacOS/Test761926 (for architecture x86_64):    Mach-O 64-bit kext bundle x86_64
Test761926.kext/Contents/MacOS/Test761926 (for architecture arm64e):    Mach-O 64-bit kext bundle arm64e

That is, your KEXT should include both the 64-bit Intel (x86_64) and Apple silicon with pointer authentication (arm64e) architectures.

IMPORTANT In general, we do not support pointer authentication on Apple silicon, except for testing purposes (see Preparing your app to work with pointer authentication). However, KEXTs are an exception to this rule. KEXTS must be built for arm64e, not arm64.

Share and Enjoy

Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"

Kext run well on Xcode but kextload failed after archive to others
 
 
Q