bdk-ffi icon indicating copy to clipboard operation
bdk-ffi copied to clipboard

swift package doesn't support macOS, watchOS etc...

Open cedricloneux opened this issue 1 year ago • 5 comments

I am working on a cross-platform app that should work on all Apple's systems. iOS, macOS, watchOS When I tried to run the Mac app, I was blocked by this error message saying that the package is not compatible. image

Would it be possible to fix that issue and support all platforms?

cedricloneux avatar Jun 09 '23 01:06 cedricloneux

Our bdk-swift swift package does include MacOS (M1 and x86), plus the iOS (including M1 and x86 simulator). For watchOS support, it looks like it has tier 3 support for rust (https://github.com/rust-lang/rust/blob/master/src/doc/rustc/src/platform-support/apple-watchos.md) so we might be able to support it.

notmandatory avatar Jun 09 '23 02:06 notmandatory

I noticed also you're using Mac Catalyst, is any available swift package supposed to work with it? I haven't used it before. https://developer.apple.com/mac-catalyst/

notmandatory avatar Jun 09 '23 02:06 notmandatory

It looks like there may be some additional xcframework packaging voodoo to get them to work with Catalyst:

https://developer.apple.com/documentation/xcode/creating-a-multi-platform-binary-framework-bundle#Create-archives-for-frameworks-or-libraries

notmandatory avatar Jun 09 '23 02:06 notmandatory

I made a simple test MacOS app, added package bdk-swift 0.28, imported it and used a couple BDK functions and it worked fine for me. Note I did not try to use Catalyst.

notmandatory avatar Jun 09 '23 03:06 notmandatory

As notmandatory mentioned everything works for a macOS app, but Mac Catalyst has some interesting nuances to get it working for a framework like bdk-swift; but I think we can make this happen or at least I'd like to try it out with something like adding this in our workflows (bdk-ffi + bdk-swift):

name: "Install Rust targets"

rustup target add aarch64-apple-ios-macabi # Mac Catalyst ARM64
rustup target add x86_64-apple-ios-macabi # Mac Catalyst x86_64

name: "Build bdk-ffi for all targets"

cargo build --profile release-smaller --target aarch64-apple-ios-macabi
cargo build --profile release-smaller --target x86_64-apple-ios-macabi

name: "Create universal binary for Mac Catalyst"

mkdir -p target/universal/release-smaller
    lipo -create \
      target/aarch64-apple-ios-macabi/release/libbdkffi.a \
      target/x86_64-apple-ios-macabi/release/libbdkffi.a \
      -output target/universal/release-smaller/libbdkffi_catalyst.a

... and so on.

@cedricloneux do you still have a need for Mac Catalyst support?

reez avatar Apr 30 '24 01:04 reez