Sounds like the XCFramework infrastructure isn’t able to identify the platform for each of your static libraries. I recommend that you dump the each library to confirm that the platform is set correctly. Before I talked about how to do that, a quick primary on structure:
A static library is a collection of object files (extension .o, Mach type MH_OBJECT).
These are collected in the archive format (extension .a, see the ar(5) man page).
Each architecture is then merged into a Mach-O universal binary (extension .a, see <mach-o/fat.h>). Note that the universal binary header does not have field to indicate what platform each architecture applies to.
Finally, those are collected into an XCFramework (.xframework).
Each level has its own tools. For example, you can examine a static library with
otool (see its
man page), an archive with
ar (
man page) and
ranlib (
man page), and a universal binary with
arch (
man page) and
lipo (
man page). Some of these tools can see through higher levels. For example,
otool can see through both the universal binary (select the target architecture using
-arch argument) and the archive.
So, what you want to do is run
otool against the static library to confirm that every object file has the correct platform info set. For example:
Code Block % otool -l -arch arm64 libTest673387.a |
Archive : libTest673387.a |
libTest673387.a(Test673387.o): |
… |
Load command 1 |
cmd LC_BUILD_VERSION |
cmdsize 24 |
platform 6 |
minos 14.3 |
sdk 14.3 |
ntools 0 |
… |
This tells you that the
arm64 architecture of the universal binary has an archive that contains an object file that was built for platform 6. A quick trip to
<mach-o/loader.h> reveals that 6 refers to
PLATFORM_MACCATALYST.
IMPORTANT Depending on the tools you use you may not see the
LC_BUILD_VERSION command but instead see the older
LC_VERSION_MIN_*** command, where
*** identifies the platform.
Share and Enjoy
—
Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@apple.com"