aws-mobile-appsync-sdk-ios icon indicating copy to clipboard operation
aws-mobile-appsync-sdk-ios copied to clipboard

Prebuilt frameworks using Swift 5.5 (Carthage)

Open pokryfka opened this issue 4 years ago • 16 comments

Describe the bug

Please prebuilt frameworks using Swift 5.5. (Carthage)

To Reproduce Steps to reproduce the behavior:

echo github "awslabs/aws-mobile-appsync-sdk-ios" > Cartfile
carthage update --use-xcframework

Result:

*** Downloading aws-sdk-ios binary at "AWS SDK for iOS 2.26.1"
*** Downloading aws-mobile-appsync-sdk-ios binary at "3.4.1"
***  Skipped installing aws-mobile-appsync-sdk-ios binary due to the error:
	"Incompatible Swift version - framework was built with 5.3 (swiftlang-1200.0.29.2 clang-1200.0.30.1) and the local version is 5.5 (swiftlang-1300.0.31.1 clang-1300.0.29.1)."

    Falling back to building from the source

Expected behavior A clear and concise description of what you expected to happen.

Screenshots n/a

Environment(please complete the following information):

  • AppSync SDK Version: 3.4.1
  • Dependency Manager: Carthage
  • Swift Version : 5.5, Xcode 13.0

Device Information (please complete the following information): n/a

Additional context n/a

pokryfka avatar Oct 14 '21 05:10 pokryfka

Hi @pokryfka, thanks for bringing this to our attention. aws-mobile-appsync-sdk-ios uses Travis CI, which does not yet support Xcode 13.

Until Xcode 13 is available in our CI pipeline, it should be possible for Carthage to build the SDK from source. Is this behavior working for you?

ameter avatar Oct 15 '21 21:10 ameter

Thank you for following up on that.

Yes, I can compile it.

The main issue with it is that it takes quite a long time. It compiles all the targets of AWSCore, most of them are not needed by AppSync itself.

Looking forward to CI update.

pokryfka avatar Oct 16 '21 02:10 pokryfka

@ameter Travis CI added an image with Xcode 13.1

from https://docs.travis-ci.com/user/reference/osx/#xcode-version

Xcode 13.1 is available by adding osx_image: xcode13.1 to your .travis.yml.

pokryfka avatar Nov 01 '21 04:11 pokryfka

👋

pokryfka avatar Nov 30 '21 06:11 pokryfka

@pokryfka Thanks for following up. We'll update the build and provide an update here when the new version is ready.

ameter avatar Nov 30 '21 16:11 ameter

@pokryfka we updated our CI script and released a new of version of the SDK. Let us know if that solves your issues

diegocstn avatar Dec 28 '21 16:12 diegocstn

Thank you for the change. Unfortunately ABI changed again and the latest stable version, 5.5.2, is not binary compatible with 5.5.1 :/ I guess its primarily because of async/await backward compatibility.

*** Downloading aws-mobile-appsync-sdk-ios binary at "3.4.2"
***  Skipped installing aws-mobile-appsync-sdk-ios binary due to the error:
	"Incompatible Swift version - framework was built with 5.5.1 (swiftlang-1300.0.31.4 clang-1300.0.29.6) and the local version is 5.5.2 (swiftlang-1300.0.47.5 clang-1300.0.29.30)."

Please note that Travis does have image with Xcode 13.2.1/Swift 5.5.2:

Xcode 13.2.1 is available by adding osx_image: xcode13.2 to your .travis.yml.

pokryfka avatar Dec 29 '21 12:12 pokryfka

Thank you!

pokryfka avatar Feb 10 '22 00:02 pokryfka

Well, binaries are fetched as expected but they dont include AppSync at all.

pokryfka avatar Feb 10 '22 01:02 pokryfka

@pokryfka We released AppSync SDK v3.5.0 that includes a pre-built version of the framework bundled in a XCFramework. Let us know if that solves your issue.

diegocstn avatar Feb 24 '22 23:02 diegocstn

@pokryfka We released AppSync SDK v3.5.0 that includes a pre-built version of the framework bundled in a XCFramework. Let us know if that solves your issue.

Thank you for the update.

I made a quick test and the generated framework can be imported (embedded), however when the library is loaded (runtime) it lacks some symbols from AppSyncRealTimeClient. (I did embed AppSyncRealTimeClient). Will try to investigate further.

dyld[41253]: Symbol not found: _$s21AppSyncRealTimeClient0aB11MessageTypeO9subscribeyACSScACmFWC
  Referenced from: /Users/michal/Library/Developer/Xcode/DerivedData/SuperPro-buvmonsqzsflotdpwrvmqdchvsof/Build/Products/Debug-iphonesimulator/AWSAppSync.framework/AWSAppSync
  Expected in: /Users/michal/Library/Developer/Xcode/DerivedData/SuperPro-buvmonsqzsflotdpwrvmqdchvsof/Build/Products/Debug-iphonesimulator/AppSyncRealTimeClient.framework/AppSyncRealTimeClient
Symbol not found: _$s21AppSyncRealTimeClient0aB11MessageTypeO9subscribeyACSScACmFWC

For the record, Cartfile does not pin any specific version:

github "awslabs/aws-mobile-appsync-sdk-ios"

and its resolved to:

github "aws-amplify/aws-appsync-realtime-client-ios" "1.9.0"
github "aws/aws-sdk-ios" "2.27.1"
github "awslabs/aws-mobile-appsync-sdk-ios" "3.5.0"
github "daltoniam/starscream" "4.0.4"
github "stephencelis/SQLite.swift" "0.12.2"

pokryfka avatar Feb 28 '22 04:02 pokryfka

@pokryfka are you getting that error from a clean build? If you haven't done that already, I'd also recommend to clean your derived data folder just to rule out that the issue isn't related to old artifacts.

diegocstn avatar Mar 01 '22 18:03 diegocstn

@pokryfka are you getting that error from a clean build? If you haven't done that already, I'd also recommend to clean your derived data folder just to rule out that the issue isn't related to old artifacts.

removing derived data does not help. I just rechecked it in clean environment and the problem remains:

dyld[37985]: Symbol not found: _$s21AppSyncRealTimeClient0aB11MessageTypeO9subscribeyACSScACmFWC
  Referenced from: /Users/pokryfka/Library/Developer/Xcode/DerivedData/SuperPro-aojgolpochodiodkgrdjucubyrye/Build/Products/Debug-iphonesimulator/AWSAppSync.framework/AWSAppSync

The problem does not happen when I build xframeworks myself which I do using using Carthage:

carthage build --use-xcframeworks --platform ios --no-use-binaries

(without --no-use-binaries Carthage downloads binaries which saves a lot of compilation time but, for now, does not work - see error above)

Cartfile:

github "awslabs/aws-mobile-appsync-sdk-ios"

Cartfile.resolved:

github "aws-amplify/aws-appsync-realtime-client-ios" "1.9.0"
github "aws/aws-sdk-ios" "2.27.2"
github "awslabs/aws-mobile-appsync-sdk-ios" "3.5.0"
github "daltoniam/starscream" "4.0.4"
github "stephencelis/SQLite.swift" "0.12.2"

--

enums seem to be compiled/bridged/exported differently, I also noticed warning when switching AWSAppSyncClientError value to handle "unknown" case which does not happen when I compile frameworks myself.

pokryfka avatar Mar 05 '22 03:03 pokryfka

BTW Reachibility is not explicitly listed as dependency, it used to be prior to 3.5.0

pokryfka avatar Mar 07 '22 11:03 pokryfka

@pokryfka how are you linking the framework in your project? Your target should be linking at least the following binaries:

  • AppSyncRealTimeClient
  • AWSAppSync
  • AWSCore
  • SQLite
  • Starscream

BTW Reachibility is not explicitly listed as dependency, it used to be prior to 3.5.0

That's expected, we've opted to temporarily embed and renamed that to AWSAppSyncReachability to circumvent this Swift compiler issue. In the long term we'd like to use Apple's Network framework.

diegocstn avatar Mar 07 '22 18:03 diegocstn

right, I link all of these:

private let appSyncFrameworks = [
    "AWSAppSync",
    "AppSyncRealTimeClient",
    "AWSCore",
    "SQLite",
    "Starscream",
    "Reachability",
]

it all works well when I build them myself via carthage build --use-xcframeworks --platform ios --no-use-binaries if I fetch them, which I do using carthage build --use-xcframeworks --platform ios there are linking problems

pokryfka avatar Mar 08 '22 09:03 pokryfka

we can close it as far as I am concerned, I switched to SPM as Xcode support of SPM got a bit better

BTW I noticed that even when adding AppSync via SPM it still gets AWSCore xcframeworks, its just that they are not downloaded by Carthage

pokryfka avatar Oct 06 '22 06:10 pokryfka