Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Project Catalyst Support (aka UIKit on macOS) #60

Closed
chrisballinger opened this issue Jun 5, 2019 · 14 comments
Closed

Project Catalyst Support (aka UIKit on macOS) #60

chrisballinger opened this issue Jun 5, 2019 · 14 comments

Comments

@chrisballinger
Copy link

It looks like perhaps xcframeworks will be required? I am trying to wrap my head around what is necessary to enable cross compilation for that new target platform.

$ xcodebuild archive -workspace Alamofire.xcworkspace -scheme "Alamofire iOS" -sdk iphoneos13.0 OBJROOT=build/iOS
$ xcodebuild archive -workspace Alamofire.xcworkspace -scheme "Alamofire iOS" -sdk iphonesimulator13.0 OBJROOT=build/simulator
$ xcodebuild -create-xcframework -framework build/iOS/UninstalledProducts/iphoneos/Alamofire.framework -framework build/simulator/UninstalledProducts/iphonesimulator/Alamofire.framework -output build/Alamofire.xcframework
@chrisballinger
Copy link
Author

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:

Compiling

  • -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

Linking

  • -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

@krzyzanowskim
Copy link
Owner

If you have anything working, I'm happy to see it. Starting with PR would be great to collaborate I think.

@chrisvanbuskirk
Copy link

chrisvanbuskirk commented Jun 6, 2019

Linking a stackoverflow question I created already. Hopefully it will steer some traffic.

https://stackoverflow.com/questions/56459036/how-does-one-build-a-openssl-library-for-uikitformac

@chrisballinger
Copy link
Author

Had some progress. This seems to be the magic trick: -target x86_64-apple-ios-macabi -miphoneos-version-min=13.0. Add it to CFLAGS and LDFLAGS.

@hellc
Copy link

hellc commented Jul 1, 2019

Any progress update?
Could we provide static libcrypto lib for UIKit on mac?

@krzyzanowskim
Copy link
Owner

I guess we need a script to build a xcframework structure. I didn't dig it much yet by myself.

@hellc
Copy link

hellc commented Jul 2, 2019

@chrisballinger Could you provide a proper sh script to build libcrypto.a from public source?
It should be compatible with UIKit for mac. Seems like export CFLAGS="-target x86_64-apple-ios-macabi -miphoneos-version-min=13.0" is not enough and I'm having trouble to use resulted static lib in UIKitForMac env. Then I could help u with Universal xcframework script.

@chrisballinger
Copy link
Author

chrisballinger commented Jul 3, 2019

@hellc Here's a hacky WIP where OpenSSL is compiled in another context: https://github.com/ursachec/CPAProxy/compare/marzipan

@fishandphil
Copy link

Has anyone succeeded with this? Our catalyst app is like 99% ready appart from OpenSSL lib which we haven't achieved to build yet. Thanks

@krzyzanowskim
Copy link
Owner

I haven't tried it, but I'm interested in working and confirmed solution to include and release

@benrosen78
Copy link

Any update on using this OpenSSL cocoapod in Catalyst?

@krzyzanowskim
Copy link
Owner

I didn't do much research, who wants to make it happen?

@BubblyNetDev
Copy link

Hello, are there any updates on this?

@krzyzanowskim
Copy link
Owner

Catalyst build is here as of 1.1.180 🎊

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants