xcodebuild determines this based on the -destination option.
How do we apply this when a static library is not built with Xcode? I have a static library (in C) built for several architectures, but I haven't found any way to build an xcframework that associates the correct architecture with the simulator. When I try to construct an xcframework just by appending them all:
Code Block for lib in *.a; do xcodebuild -create-xcframework -library $lib -headers include -output PEQ.xcframework; done |
the linking product that consumes them throws a warning:
Code Block ld: warning: ignoring file .../Release-iphonesimulator/PEQ-x86_64.a, missing required architecture arm64 ... |
And cannot find the symbols. I've also tried linking just the x86_64 and arm64 versions in a single call:
Code Block xcodebuild -create-xcframework -library PEQ-arm64.a -headers include -library PEQ-x86_64.a -headers include -output PEQ.xcframework |
(If I try to include the i386 or armv7 versions, it complains that they "represent two equivalent library definitions")
There is no xcodeproj for these static libraries. They are proprietary and do not even have source code for them. How do I associate the correct static library with each platform and simulator?
@dhoerl, this seems to be very similar to your issue (in that the libraries are built outside of Xcode), so did this solution work?
Note that I don't actually care about creating an xcframework. I don't need to distribute this framework. I'm just trying to link existing static libraries into our application, and have it work on device and simulator.