I'm not sure if this is better suited as an umbrella issue for people to help surface rough edges, or if opening multiple individual issues would be better.
One issue I've found so far is that I haven't found a way to vendor a fat static library built for multiple architectures. For instance:
ld: in libcrypto.a(cryptlib.o), building for UIKitForMac, but linking in object file built for macOS, file 'libcrypto.a' for architecture x86_64
I'm not sure if the podspec DSL needs to be updated to support something like s.iosmac.vendored_libraries
because including the simulator x86_64 architectures conflicts with the iOS Mac x86_64 slice.
Issues identified so far:
iosmac
when vendoring static libraries #8892~ vendor xcframeworks instead, supported added in v1.9.0you can do s.macos.vendored_libraries
and s.ios.vendored_libraries
maybe ship 2 .a
files.
@dnkoutso Ah yeah I'm saying that we might need to ship 3 .a
files now instead of 2 because of the conflict for the x86_64 slice being used by both the iOS simulator and "UIKit for macOS".
# built for macOS (x86_64, i386)
s.macos.vendored_libraries = 'libs/mac/*.a'
# built for iOS and iOS simulator (armv7, arm64, x86_64, i386)
s.ios.vendored_libraries = 'libs/ios/*.a'
# built for "UIKit for macOS" (x86_64)
s.iosmac.vendored_libraries = 'libs/iosmac/*.a'
I see is this Catalina only? probably yes we need to have this enhancement.
Yep! I am still trying to figure out how to cross compile static libs in the first place for the "UIKit for macOS" platform SDK, it's not exactly straightforward and I haven't seen any other examples yet. I can confirm so far that the "UIKit for macOS" linker rejects x86_64 slices built for the iOS simulator and for native macOS. I can also confirm that x86_64 is still not a valid non-simulator iOS target.
In file included from /Applications/Xcode-beta.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS13.0.sdk/usr/include/stdlib.h:62:
/Applications/Xcode-beta.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS13.0.sdk/usr/include/sys/cdefs.h:803:2: error: Unsupported
architecture
#error Unsupported architecture
Do we need to add a new platform iosmac
to Core?
@amorde That's my current hypothesis. It seems that the new xcframework
stuff is the "blessed" approach in Xcode 11, but that doesn't really solve the problem for vendored static libraries. It might be helpful to check out how Carthage is approaching Catalyst support here: https://github.com/Carthage/Carthage/issues/2799
I did some more digging, it looks like you use a subfolder in the MacOSX SDK with a x86_64-apple-ios13.0-macabi
target. Here are some nuggets I found in the raw build logs for compiling a C file in a static lib:
-target x86_64-apple-ios13.0-macabi
-isysroot /Applications/Xcode-beta.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.15.sdk
-isystem /Applications/Xcode-beta.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.15.sdk/System/iOSSupport/usr/include
-iframework /Applications/Xcode-beta.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.15.sdk/System/iOSSupport/System/Library/Frameworks
-syslibroot /Applications/Xcode-beta.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.15.sdk
-L/Applications/Xcode-beta.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.15.sdk/System/iOSSupport/usr/lib
-L/Applications/Xcode-beta.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/uikitformac
CompileC /Users/xxxxxx/Library/Developer/Xcode/DerivedData/Marzipan-gbnckgdrmlikahasegoldvxdkpif/Build/Intermediates.noindex/Marzipan.build/Debug-uikitformac/CrossTwo.build/Objects-normal/x86_64/CrossTest.o /Users/xxxxxx/Desktop/Marzipan/CrossTwo/CrossTest.c normal x86_64 c com.apple.compilers.llvm.clang.1_0.compiler (in target: CrossTwo)
cd /Users/xxxxxx/Desktop/Marzipan
export LANG=en_US.US-ASCII
/Applications/Xcode-beta.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang -x c -target x86_64-apple-ios13.0-macabi -fmessage-length=0 -fdiagnostics-show-note-include-stack -fmacro-backtrace-limit=0 -std=gnu11 -fmodules -fmodules-cache-path=/Users/xxxxxx/Library/Developer/Xcode/DerivedData/ModuleCache.noindex -fmodules-prune-interval=86400 -fmodules-prune-after=345600 -fbuild-session-file=/Users/xxxxxx/Library/Developer/Xcode/DerivedData/ModuleCache.noindex/Session.modulevalidation -fmodules-validate-once-per-build-session -Wnon-modular-include-in-framework-module -Werror=non-modular-include-in-framework-module -Wno-trigraphs -fpascal-strings -O0 -fno-common -Wno-missing-field-initializers -Wno-missing-prototypes -Werror=return-type -Wdocumentation -Wunreachable-code -Werror=deprecated-objc-isa-usage -Werror=objc-root-class -Wno-missing-braces -Wparentheses -Wswitch -Wunused-function -Wno-unused-label -Wno-unused-parameter -Wunused-variable -Wunused-value -Wempty-body -Wuninitialized -Wconditional-uninitialized -Wno-unknown-pragmas -Wno-shadow -Wno-four-char-constants -Wno-conversion -Wconstant-conversion -Wint-conversion -Wbool-conversion -Wenum-conversion -Wno-float-conversion -Wnon-literal-null-conversion -Wobjc-literal-conversion -Wshorten-64-to-32 -Wpointer-sign -Wno-newline-eof -DDEBUG=1 -isysroot /Applications/Xcode-beta.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.15.sdk -fasm-blocks -fstrict-aliasing -Wdeprecated-declarations -g -Wno-sign-conversion -Winfinite-recursion -Wcomma -Wblock-capture-autoreleasing -Wstrict-prototypes -Wno-semicolon-before-method-body -Wunguarded-availability -index-store-path /Users/xxxxxx/Library/Developer/Xcode/DerivedData/Marzipan-gbnckgdrmlikahasegoldvxdkpif/Index/DataStore -iquote /Users/xxxxxx/Library/Developer/Xcode/DerivedData/Marzipan-gbnckgdrmlikahasegoldvxdkpif/Build/Intermediates.noindex/Marzipan.build/Debug-uikitformac/CrossTwo.build/CrossTwo-generated-files.hmap -I/Users/xxxxxx/Library/Developer/Xcode/DerivedData/Marzipan-gbnckgdrmlikahasegoldvxdkpif/Build/Intermediates.noindex/Marzipan.build/Debug-uikitformac/CrossTwo.build/CrossTwo-own-target-headers.hmap -I/Users/xxxxxx/Library/Developer/Xcode/DerivedData/Marzipan-gbnckgdrmlikahasegoldvxdkpif/Build/Intermediates.noindex/Marzipan.build/Debug-uikitformac/CrossTwo.build/CrossTwo-all-non-framework-target-headers.hmap -ivfsoverlay /Users/xxxxxx/Library/Developer/Xcode/DerivedData/Marzipan-gbnckgdrmlikahasegoldvxdkpif/Build/Intermediates.noindex/Marzipan.build/Debug-uikitformac/CrossTwo.build/all-product-headers.yaml -iquote /Users/xxxxxx/Library/Developer/Xcode/DerivedData/Marzipan-gbnckgdrmlikahasegoldvxdkpif/Build/Intermediates.noindex/Marzipan.build/Debug-uikitformac/CrossTwo.build/CrossTwo-project-headers.hmap -I/Users/xxxxxx/Library/Developer/Xcode/DerivedData/Marzipan-gbnckgdrmlikahasegoldvxdkpif/Build/Products/Debug-uikitformac/include -isystem /Applications/Xcode-beta.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.15.sdk/System/iOSSupport/usr/include -I/Users/xxxxxx/Library/Developer/Xcode/DerivedData/Marzipan-gbnckgdrmlikahasegoldvxdkpif/Build/Intermediates.noindex/Marzipan.build/Debug-uikitformac/CrossTwo.build/DerivedSources-normal/x86_64 -I/Users/xxxxxx/Library/Developer/Xcode/DerivedData/Marzipan-gbnckgdrmlikahasegoldvxdkpif/Build/Intermediates.noindex/Marzipan.build/Debug-uikitformac/CrossTwo.build/DerivedSources/x86_64 -I/Users/xxxxxx/Library/Developer/Xcode/DerivedData/Marzipan-gbnckgdrmlikahasegoldvxdkpif/Build/Intermediates.noindex/Marzipan.build/Debug-uikitformac/CrossTwo.build/DerivedSources -F/Users/xxxxxx/Library/Developer/Xcode/DerivedData/Marzipan-gbnckgdrmlikahasegoldvxdkpif/Build/Products/Debug-uikitformac -iframework /Applications/Xcode-beta.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.15.sdk/System/iOSSupport/System/Library/Frameworks -MMD -MT dependencies -MF /Users/xxxxxx/Library/Developer/Xcode/DerivedData/Marzipan-gbnckgdrmlikahasegoldvxdkpif/Build/Intermediates.noindex/Marzipan.build/Debug-uikitformac/CrossTwo.build/Objects-normal/x86_64/CrossTest.d --serialize-diagnostics /Users/xxxxxx/Library/Developer/Xcode/DerivedData/Marzipan-gbnckgdrmlikahasegoldvxdkpif/Build/Intermediates.noindex/Marzipan.build/Debug-uikitformac/CrossTwo.build/Objects-normal/x86_64/CrossTest.dia -c /Users/xxxxxx/Desktop/Marzipan/CrossTwo/CrossTest.c -o /Users/xxxxxx/Library/Developer/Xcode/DerivedData/Marzipan-gbnckgdrmlikahasegoldvxdkpif/Build/Intermediates.noindex/Marzipan.build/Debug-uikitformac/CrossTwo.build/Objects-normal/x86_64/CrossTest.o
Libtool /Users/xxxxxx/Library/Developer/Xcode/DerivedData/Marzipan-gbnckgdrmlikahasegoldvxdkpif/Build/Products/Debug-uikitformac/libCrossTwo.a normal x86_64 (in target: CrossTwo)
cd /Users/xxxxxx/Desktop/Marzipan
export MACOSX_DEPLOYMENT_TARGET=10.15
/Applications/Xcode-beta.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/libtool -static -arch_only x86_64 -D -syslibroot /Applications/Xcode-beta.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.15.sdk -L/Users/xxxxxx/Library/Developer/Xcode/DerivedData/Marzipan-gbnckgdrmlikahasegoldvxdkpif/Build/Products/Debug-uikitformac -L/Applications/Xcode-beta.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.15.sdk/System/iOSSupport/usr/lib -L/Applications/Xcode-beta.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/uikitformac -L/Applications/Xcode-beta.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.15.sdk/System/iOSSupport/usr/lib -L/Applications/Xcode-beta.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/uikitformac -filelist /Users/xxxxxx/Library/Developer/Xcode/DerivedData/Marzipan-gbnckgdrmlikahasegoldvxdkpif/Build/Intermediates.noindex/Marzipan.build/Debug-uikitformac/CrossTwo.build/Objects-normal/x86_64/CrossTwo.LinkFileList -o /Users/xxxxxx/Library/Developer/Xcode/DerivedData/Marzipan-gbnckgdrmlikahasegoldvxdkpif/Build/Products/Debug-uikitformac/libCrossTwo.a
Another issue I've noticed is that podspec resource bundles now require a development team / signing identity. I think this only affects static libraries with resource bundles and not when the resources are bundled within a framework.
pod install
For any other lost souls trying to recompile their binary blobs, adding the following to CFLAGS
and LDFLAGS
seems to be the magic ticket:
-target x86_64-apple-ios-macabi -miphoneos-version-min=13.0
Alrighty, was able to get things to work in case anyone else wants to check out an example: https://github.com/ChatSecure/ChatSecure-iOS/pull/1121
I think I'll open up two separate issues for the CocoaPods related issues surfaced earlier so they are easier to tackle individually.
Thank you so much for diagnosing here.
And on the usage side of things, how could I exclude some pods only from the macOS app, while still being available on iOS?
/Applications/Xcode-beta.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/uikitformac not found in xcode-beta 4 release.
Any news?
Here's a workaround for the Resource signing issue: https://github.com/firebase/firebase-ios-sdk/issues/3500#issuecomment-518741681
For any other lost souls trying to recompile their binary blobs, adding the following to
CFLAGS
andLDFLAGS
seems to be the magic ticket:
-target x86_64-apple-ios-macabi -miphoneos-version-min=13.0
May you please explain how you have done this? Do you set that in XCODE itself? Thanks
too much trouble, I would not support this soon... maybe ill wait until its stable enough.
There hasn't been any activity on this issue recently. Due to the high number of incoming GitHub notifications, we have to clean some of the old issues, as many of them have already been resolved with the latest updates.
This has not been fixed yet.
There hasn't been any activity on this issue recently. Due to the high number of incoming GitHub notifications, we have to clean some of the old issues, as many of them have already been resolved with the latest updates.
Resource bundles on Catalyst are still problematic, however..... as far as I can tell they can't be shipped to the App Store.
ITMS-90284: Invalid Code Signing - The executable 'Example.app/Contents/Resources/ExamplePod.bundle' must be signed with the certificate that is contained in the provisioning profile.
I wasn't able to find a workaround, so my solution has been to remove pods that contain resource bundles.
There hasn't been any activity on this issue recently. Due to the high number of incoming GitHub notifications, we have to clean some of the old issues, as many of them have already been resolved with the latest updates.
Not stale
This issue will be auto-closed because there hasn't been any activity for a few months. Feel free to open a new one if you still experience this problem :+1:
There hasn't been any activity on this issue recently. Due to the high number of incoming GitHub notifications, we have to clean some of the old issues, as many of them have already been resolved with the latest updates.
Not stale
Most helpful comment
For any other lost souls trying to recompile their binary blobs, adding the following to
CFLAGS
andLDFLAGS
seems to be the magic ticket:-target x86_64-apple-ios-macabi -miphoneos-version-min=13.0