Very simple setup:
Created a static library from a set of object files compiled with -target x86_64-apple-darwin20.1.0 then into a static library with ar and ranlib.
Did the same again with -target arm64-apple-darwin20.1.0
So now have two static libraries, one for Intel, one for Apple Silicon.
Combined them into a universal binary with lipo -create and checked it with lipo -archs. Everything looks perfect.
However when I set my Xcode project to link against this library it will only work for the arm64 build. If I set to an x86 build it says the static library is arm64 only which is clearly utter rubbish.
Anyone any idea what the issue is here? Seems that Xcode is unable to use universal binary libraries but that's clearly also got to be wrong, so why isn't it selecting the correct library architecture?
Thanks.
Created a static library from a set of object files compiled with -target x86_64-apple-darwin20.1.0 then into a static library with ar and ranlib.
Did the same again with -target arm64-apple-darwin20.1.0
So now have two static libraries, one for Intel, one for Apple Silicon.
Combined them into a universal binary with lipo -create and checked it with lipo -archs. Everything looks perfect.
However when I set my Xcode project to link against this library it will only work for the arm64 build. If I set to an x86 build it says the static library is arm64 only which is clearly utter rubbish.
Anyone any idea what the issue is here? Seems that Xcode is unable to use universal binary libraries but that's clearly also got to be wrong, so why isn't it selecting the correct library architecture?
Thanks.