Interesting that it can't find the symbol for x86_64, even if building just for Apple Silicon.
That’s an interesting discovery, but it didn’t allow me to reproduce the problem )-: Here’s what I tried today:
-
I used Xcode 15.4 to create a new framework from the macOS > App template.
-
I added an AAATest
class with an implementation like this:
#import "AAATest.h"
@import MachO;
@implementation AAATest
+ (void)test {
NSUInteger len = 0;
NSData *data = [NSData dataWithBytes: getsectiondata(&_mh_execute_header, "__TEXT", "__somePlist_plist", &len) length:len];
NSLog(@"%zu", data.length);
}
@end
-
I changed the run destination to Any Mac, so Xcode builds both architectures.
-
The project built just fine.
-
I closed the project and re-opened it in Xcode 16.0b4.
-
I confirmed that the run destination from step 3 was preserved.
-
I built the app again, without any problems.
Looking at the built app I see that both architectures are present:
% file Test760543.app/Contents/MacOS/Test760543
…
Test760543.app/Contents/MacOS/Test760543 (for architecture x86_64)…
Test760543.app/Contents/MacOS/Test760543 (for architecture arm64)…
And nm
reveals that all the symbols for my class are present, along with _mh_execute_header
:
% nm -arch x86_64 Test760543.app/Contents/MacOS/Test760543
0000000100001290 t +[AAATest test]
…
0000000100003c38 S _OBJC_CLASS_$_AAATest
…
0000000100003c10 S _OBJC_METACLASS_$_AAATest
…
0000000100003aa0 s __OBJC_$_CLASS_METHODS_AAATest
…
0000000100003b08 s __OBJC_CLASS_RO_$_AAATest
…
0000000100003ac0 s __OBJC_METACLASS_RO_$_AAATest
…
0000000100000000 T __mh_execute_header
…
Please repeat this exact test. I suspect it’ll work and, if it does, that rules out any environmental issue, allowing us to focus on your project.
Share and Enjoy
—
Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"