Built for macOS not UIKit for Mac

Hi


I've started looking at running my iPad app in macOS 10.15 using Xcode 11. I've run through the steps to add Mac support but when I build it complains that some of the libraries I use at link time are compiled for macOS and not "UIKit for Mac". Surely they are both x64 architecture so I'm slightly confused. I can't find any documentation about this - does anyone have any idea on how I would rebuild these libraries so that they are supported?


Thanks,

Mike.

Were you able to solve this issue?

I'm now using makefile to generate FFMpeg libraries, everything builds correctly, but i have a problem during building xcframework.

Here are my compiler and linker flags.


CFLAGS="$CFLAGS -target x86_64-apple-ios13.0-macabi \
  -isysroot $xcode_path/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk \
  -isystem $xcode_path/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/System/iOSSupport/usr/include \
  -iframework $xcode_path/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/System/iOSSupport/System/Library/Frameworks"


  LDFLAGS="$LDFLAGS -target x86_64-apple-ios13.0-macabi \
  -isysroot $xcode_path/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk \
  -L$xcode_path/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/System/iOSSupport/usr/lib \
  -L$xcode_path/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/maccatalyst \
  -iframework $xcode_path/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/System/iOSSupport/System/Library/Frameworks"

I tried to use built library and also I tried to use object files to glue them into library with libtool.


libtool -static -arch_only $ARCHS -D \
  -syslibroot $xcode_path/MacOSX.platform/Developer/SDKs/MacOSX.sdk \
  -L$xcode_path/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/System/iOSSupport/usr/lib \
  -L$xcode_path/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/maccatalyst \
  $object_files \
  -o "$TMP_FOLDER/$FRAMEWORK_NAME"



Then I do following to create XCFramework from libraries:


xcodebuild -create-xcframework \
  -library "arm64/$LIB_NAME" \
  -library "x86_64/$LIB_NAME" \
  -headers "include" \
  -output "$XCFRAMEWORK"



When I try to create XCFramework with only iOS arm64 slice, it succeeds.

If I use mac-catalyst x86_64 slice, it fails with following error


error: unable to find any specific architecture information in the binary at 'foo/bar/x86_64/libavcodec.a'

Key @Skaro, I've opened a PR on the OpenSSL-for-iPhone repo adding support to Catalyst.


You can use y code by running the following on your terminal:

git clone git@github.com:marcelosalloum/OpenSSL-for-iPhone.git --branch feature/mac-catalyst && \
cd OpenSSL-for-iPhone && \
./build-libssl.sh --archs="MacOSX_x86_64 i386 arm64 armv7s armv7"

I've tested this code in a real project and it worked fine. Please let me know if it works for you too.

BTW, those warnings (and I'm dealing with them too in an open source lib) are now hard errors in Xcode 11.4-beta. FYI.

Did you ever resolve the issue:

error: unable to find any specific architecture information in the binary at 'foo/bar/x86_64/libavcodec.a'


I'm running into the same error trying to build an xcframework for FFmpeg.


EDIT:


Nevermind, I see that you figured out the cause: https://github.com/kewlbear/FFmpeg-iOS-build-script/pull/147#issue-325840617


"x86_64 binaries are built without ASM support, since ASM for x86_64 is actually x86 and that confuses

xcodebuild -create-xcframework
"


For anyone else running into this issue with FFmpeg, you need to add "--disable-asm" to the configure flags.

Built for macOS not UIKit for Mac
 
 
Q