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

Compilation Issue using AWSPinpoint on iOS target with watch target #1279

Closed
lawmicha opened this issue Jan 2, 2024 · 5 comments
Closed
Assignees
Labels
bug This issue is a bug. needs-triage This issue or PR still needs to be triaged.

Comments

@lawmicha
Copy link

lawmicha commented Jan 2, 2024

Describe the bug

Over in the Amplify repo, we got an issue related to compiling AWSPinpointAnalyticsPlugin as a dependency for an iOS target which embeds a watch target.

Issue: aws-amplify/amplify-swift#3312

Expected Behavior

No compilation issues

Current Behavior

<details>
<summary>Log Messages</summary>


SwiftCompile normal i386 Compiling\ Models.swift /Users/gbitaudeau/Documents/workspace_ios/_AppSonic/TestAmplifyGBI/DerivedData/TestAmplifyGBI/SourcePackages/checkouts/aws-sdk-swift/Sources/Services/AWSPinpoint/models/Models.swift (in target 'AWSPinpoint' from project 'aws-sdk-swift')
    cd /Users/gbitaudeau/Documents/workspace_ios/_AppSonic/TestAmplifyGBI/DerivedData/TestAmplifyGBI/SourcePackages/checkouts/aws-sdk-swift
    builtin-swiftTaskExecution -- /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/swift-frontend -frontend -c /Users/gbitaudeau/Documents/workspace_ios/_AppSonic/TestAmplifyGBI/DerivedData/TestAmplifyGBI/SourcePackages/checkouts/aws-sdk-swift/Sources/Services/AWSPinpoint/EndpointResolver.swift /Users/gbitaudeau/Documents/workspace_ios/_AppSonic/TestAmplifyGBI/DerivedData/TestAmplifyGBI/SourcePackages/checkouts/aws-sdk-swift/Sources/Services/AWSPinpoint/PinpointClient.swift /Users/gbitaudeau/Documents/workspace_ios/_AppSonic/TestAmplifyGBI/DerivedData/TestAmplifyGBI/SourcePackages/checkouts/aws-sdk-swift/Sources/Services/AWSPinpoint/PinpointClientProtocol.swift -primary-file /Users/gbitaudeau/Documents/workspace_ios/_AppSonic/TestAmplifyGBI/DerivedData/TestAmplifyGBI/SourcePackages/checkouts/aws-sdk-swift/Sources/Services/AWSPinpoint/models/Models.swift -emit-dependencies-path /Users/gbitaudeau/Documents/workspace_ios/_AppSonic/TestAmplifyGBI/DerivedData/Build/Intermediates.noindex/aws-sdk-swift.build/Debug-watchsimulator/AWSPinpoint.build/Objects-normal/i386/Models.d -emit-const-values-path /Users/gbitaudeau/Documents/workspace_ios/_AppSonic/TestAmplifyGBI/DerivedData/Build/Intermediates.noindex/aws-sdk-swift.build/Debug-watchsimulator/AWSPinpoint.build/Objects-normal/i386/Models.swiftconstvalues -emit-reference-dependencies-path /Users/gbitaudeau/Documents/workspace_ios/_AppSonic/TestAmplifyGBI/DerivedData/Build/Intermediates.noindex/aws-sdk-swift.build/Debug-watchsimulator/AWSPinpoint.build/Objects-normal/i386/Models.swiftdeps -serialize-diagnostics-path /Users/gbitaudeau/Documents/workspace_ios/_AppSonic/TestAmplifyGBI/DerivedData/Build/Intermediates.noindex/aws-sdk-swift.build/Debug-watchsimulator/AWSPinpoint.build/Objects-normal/i386/Models.dia -target i386-apple-watchos6.0-simulator -enable-objc-interop -sdk /Applications/Xcode.app/Contents/Developer/Platforms/WatchSimulator.platform/Developer/SDKs/WatchSimulator10.0.sdk -I /Users/gbitaudeau/Documents/workspace_ios/_AppSonic/TestAmplifyGBI/DerivedData/Build/Products/Debug-watchsimulator -I /Applications/Xcode.app/Contents/Developer/Platforms/WatchSimulator.platform/Developer/usr/lib -F /Users/gbitaudeau/Documents/workspace_ios/_AppSonic/TestAmplifyGBI/DerivedData/Build/Products/Debug-watchsimulator/PackageFrameworks -F /Users/gbitaudeau/Documents/workspace_ios/_AppSonic/TestAmplifyGBI/DerivedData/Build/Products/Debug-watchsimulator/PackageFrameworks -F /Users/gbitaudeau/Documents/workspace_ios/_AppSonic/TestAmplifyGBI/DerivedData/Build/Products/Debug-watchsimulator/PackageFrameworks -F /Users/gbitaudeau/Documents/workspace_ios/_AppSonic/TestAmplifyGBI/DerivedData/Build/Products/Debug-watchsimulator/PackageFrameworks -F /Users/gbitaudeau/Documents/workspace_ios/_AppSonic/TestAmplifyGBI/DerivedData/Build/Products/Debug-watchsimulator/PackageFrameworks -F /Users/gbitaudeau/Documents/workspace_ios/_AppSonic/TestAmplifyGBI/DerivedData/Build/Products/Debug-watchsimulator/PackageFrameworks -F /Users/gbitaudeau/Documents/workspace_ios/_AppSonic/TestAmplifyGBI/DerivedData/Build/Products/Debug-watchsimulator/PackageFrameworks -F /Users/gbitaudeau/Documents/workspace_ios/_AppSonic/TestAmplifyGBI/DerivedData/Build/Products/Debug-watchsimulator/PackageFrameworks -F /Users/gbitaudeau/Documents/workspace_ios/_AppSonic/TestAmplifyGBI/DerivedData/Build/Products/Debug-watchsimulator/PackageFrameworks -F /Users/gbitaudeau/Documents/workspace_ios/_AppSonic/TestAmplifyGBI/DerivedData/Build/Products/Debug-watchsimulator/PackageFrameworks -F /Users/gbitaudeau/Documents/workspace_ios/_AppSonic/TestAmplifyGBI/DerivedData/Build/Products/Debug-watchsimulator/PackageFrameworks -F /Users/gbitaudeau/Documents/workspace_ios/_AppSonic/TestAmplifyGBI/DerivedData/Build/Products/Debug-watchsimulator/PackageFrameworks -F /Users/gbitaudeau/Documents/workspace_ios/_AppSonic/TestAmplifyGBI/DerivedData/Build/Products/Debug-watchsimulator/PackageFrameworks -F /Users/gbitaudeau/Documents/workspace_ios/_AppSonic/TestAmplifyGBI/DerivedData/Build/Products/Debug-watchsimulator/PackageFrameworks -F /Users/gbitaudeau/Documents/workspace_ios/_AppSonic/TestAmplifyGBI/DerivedData/Build/Products/Debug-watchsimulator/PackageFrameworks -F /Users/gbitaudeau/Documents/workspace_ios/_AppSonic/TestAmplifyGBI/DerivedData/Build/Products/Debug-watchsimulator/PackageFrameworks -F /Users/gbitaudeau/Documents/workspace_ios/_AppSonic/TestAmplifyGBI/DerivedData/Build/Products/Debug-watchsimulator/PackageFrameworks -F /Users/gbitaudeau/Documents/workspace_ios/_AppSonic/TestAmplifyGBI/DerivedData/Build/Products/Debug-watchsimulator/PackageFrameworks -F /Users/gbitaudeau/Documents/workspace_ios/_AppSonic/TestAmplifyGBI/DerivedData/Build/Products/Debug-watchsimulator -F /Applications/Xcode.app/Contents/Developer/Platforms/WatchSimulator.platform/Developer/Library/Frameworks -F /Applications/Xcode.app/Contents/Developer/Platforms/WatchSimulator.platform/Developer/SDKs/WatchSimulator10.0.sdk/Developer/Library/Frameworks -no-color-diagnostics -enable-testing -g -module-cache-path /Users/gbitaudeau/Documents/workspace_ios/_AppSonic/TestAmplifyGBI/DerivedData/ModuleCache.noindex -swift-version 5 -enforce-exclusivity\=checked -Onone -D SWIFT_PACKAGE -D DEBUG -D Xcode -serialize-debugging-options -const-gather-protocols-file /Users/gbitaudeau/Documents/workspace_ios/_AppSonic/TestAmplifyGBI/DerivedData/Build/Intermediates.noindex/aws-sdk-swift.build/Debug-watchsimulator/AWSPinpoint.build/Objects-normal/i386/AWSPinpoint_const_extract_protocols.json -empty-abi-descriptor -validate-clang-modules-once -clang-build-session-file /Users/gbitaudeau/Documents/workspace_ios/_AppSonic/TestAmplifyGBI/DerivedData/ModuleCache.noindex/Session.modulevalidation -Xcc -working-directory -Xcc /Users/gbitaudeau/Documents/workspace_ios/_AppSonic/TestAmplifyGBI/DerivedData/TestAmplifyGBI/SourcePackages/checkouts/aws-sdk-swift -resource-dir /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift -enable-anonymous-context-mangled-names -Xcc -fmodule-map-file\=/Users/gbitaudeau/Documents/workspace_ios/_AppSonic/TestAmplifyGBI/DerivedData/Build/Intermediates.noindex/GeneratedModuleMaps-watchsimulator/AwsCEventStream.modulemap -Xcc -fmodule-map-file\=/Users/gbitaudeau/Documents/workspace_ios/_AppSonic/TestAmplifyGBI/DerivedData/Build/Intermediates.noindex/GeneratedModuleMaps-watchsimulator/AwsChecksums.modulemap -Xcc -fmodule-map-file\=/Users/gbitaudeau/Documents/workspace_ios/_AppSonic/TestAmplifyGBI/DerivedData/Build/Intermediates.noindex/GeneratedModuleMaps-watchsimulator/AwsCAuth.modulemap -Xcc -fmodule-map-file\=/Users/gbitaudeau/Documents/workspace_ios/_AppSonic/TestAmplifyGBI/DerivedData/Build/Intermediates.noindex/GeneratedModuleMaps-watchsimulator/AwsCSdkUtils.modulemap -Xcc -fmodule-map-file\=/Users/gbitaudeau/Documents/workspace_ios/_AppSonic/TestAmplifyGBI/DerivedData/Build/Intermediates.noindex/GeneratedModuleMaps-watchsimulator/AwsCHttp.modulemap -Xcc -fmodule-map-file\=/Users/gbitaudeau/Documents/workspace_ios/_AppSonic/TestAmplifyGBI/DerivedData/Build/Intermediates.noindex/GeneratedModuleMaps-watchsimulator/AwsCIo.modulemap -Xcc -fmodule-map-file\=/Users/gbitaudeau/Documents/workspace_ios/_AppSonic/TestAmplifyGBI/DerivedData/Build/Intermediates.noindex/GeneratedModuleMaps-watchsimulator/AwsCCal.modulemap -Xcc -fmodule-map-file\=/Users/gbitaudeau/Documents/workspace_ios/_AppSonic/TestAmplifyGBI/DerivedData/Build/Intermediates.noindex/GeneratedModuleMaps-watchsimulator/AwsCCompression.modulemap -Xcc -fmodule-map-file\=/Users/gbitaudeau/Documents/workspace_ios/_AppSonic/TestAmplifyGBI/DerivedData/Build/Intermediates.noindex/GeneratedModuleMaps-watchsimulator/AwsCCommon.modulemap -Xcc -ivfsstatcache -Xcc /Users/gbitaudeau/Documents/workspace_ios/_AppSonic/TestAmplifyGBI/DerivedData/SDKStatCaches.noindex/watchsimulator10.0-21R354-0721569cb29233c0c9a52e7b62401995.sdkstatcache -Xcc -I/Users/gbitaudeau/Documents/workspace_ios/_AppSonic/TestAmplifyGBI/DerivedData/Build/Intermediates.noindex/aws-sdk-swift.build/Debug-watchsimulator/AWSPinpoint.build/swift-overrides.hmap -Xcc -I/Users/gbitaudeau/Documents/workspace_ios/_AppSonic/TestAmplifyGBI/DerivedData/TestAmplifyGBI/SourcePackages/checkouts/aws-crt-swift/aws-common-runtime/aws-c-event-stream/include -Xcc -I/Users/gbitaudeau/Documents/workspace_ios/_AppSonic/TestAmplifyGBI/DerivedData/TestAmplifyGBI/SourcePackages/checkouts/aws-crt-swift/aws-common-runtime/aws-checksums/include -Xcc -I/Users/gbitaudeau/Documents/workspace_ios/_AppSonic/TestAmplifyGBI/DerivedData/TestAmplifyGBI/SourcePackages/checkouts/aws-crt-swift/aws-common-runtime/aws-c-auth/include -Xcc -I/Users/gbitaudeau/Documents/workspace_ios/_AppSonic/TestAmplifyGBI/DerivedData/TestAmplifyGBI/SourcePackages/checkouts/aws-crt-swift/aws-common-runtime/aws-c-sdkutils/include -Xcc -I/Users/gbitaudeau/Documents/workspace_ios/_AppSonic/TestAmplifyGBI/DerivedData/TestAmplifyGBI/SourcePackages/checkouts/aws-crt-swift/aws-common-runtime/aws-c-http/include -Xcc -I/Users/gbitaudeau/Documents/workspace_ios/_AppSonic/TestAmplifyGBI/DerivedData/TestAmplifyGBI/SourcePackages/checkouts/aws-crt-swift/aws-common-runtime/aws-c-io/include -Xcc -I/Users/gbitaudeau/Documents/workspace_ios/_AppSonic/TestAmplifyGBI/DerivedData/TestAmplifyGBI/SourcePackages/checkouts/aws-crt-swift/aws-common-runtime/aws-c-cal/include -Xcc -I/Users/gbitaudeau/Documents/workspace_ios/_AppSonic/TestAmplifyGBI/DerivedData/TestAmplifyGBI/SourcePackages/checkouts/aws-crt-swift/aws-common-runtime/aws-c-compression/include -Xcc -I/Users/gbitaudeau/Documents/workspace_ios/_AppSonic/TestAmplifyGBI/DerivedData/TestAmplifyGBI/SourcePackages/checkouts/aws-crt-swift/aws-common-runtime/aws-c-common/include -Xcc -I/Users/gbitaudeau/Documents/workspace_ios/_AppSonic/TestAmplifyGBI/DerivedData/TestAmplifyGBI/SourcePackages/checkouts/aws-crt-swift/aws-common-runtime/config -Xcc -I/Users/gbitaudeau/Documents/workspace_ios/_AppSonic/TestAmplifyGBI/DerivedData/Build/Products/Debug-watchsimulator/include -Xcc -I/Users/gbitaudeau/Documents/workspace_ios/_AppSonic/TestAmplifyGBI/DerivedData/Build/Intermediates.noindex/aws-sdk-swift.build/Debug-watchsimulator/AWSPinpoint.build/DerivedSources-normal/i386 -Xcc -I/Users/gbitaudeau/Documents/workspace_ios/_AppSonic/TestAmplifyGBI/DerivedData/Build/Intermediates.noindex/aws-sdk-swift.build/Debug-watchsimulator/AWSPinpoint.build/DerivedSources/i386 -Xcc -I/Users/gbitaudeau/Documents/workspace_ios/_AppSonic/TestAmplifyGBI/DerivedData/Build/Intermediates.noindex/aws-sdk-swift.build/Debug-watchsimulator/AWSPinpoint.build/DerivedSources -Xcc -DSWIFT_PACKAGE -Xcc -DDEBUG\=1 -module-name AWSPinpoint -frontend-parseable-output -disable-clang-spi -target-sdk-version 10.0 -target-sdk-name watchsimulator10.0 -external-plugin-path /Applications/Xcode.app/Contents/Developer/Platforms/WatchSimulator.platform/Developer/SDKs/WatchSimulator10.0.sdk/usr/lib/swift/host/plugins\#/Applications/Xcode.app/Contents/Developer/Platforms/WatchSimulator.platform/Developer/SDKs/WatchSimulator10.0.sdk/usr/bin/swift-plugin-server -external-plugin-path /Applications/Xcode.app/Contents/Developer/Platforms/WatchSimulator.platform/Developer/SDKs/WatchSimulator10.0.sdk/usr/local/lib/swift/host/plugins\#/Applications/Xcode.app/Contents/Developer/Platforms/WatchSimulator.platform/Developer/SDKs/WatchSimulator10.0.sdk/usr/bin/swift-plugin-server -external-plugin-path /Applications/Xcode.app/Contents/Developer/Platforms/WatchOS.platform/Developer/usr/lib/swift/host/plugins\#/Applications/Xcode.app/Contents/Developer/Platforms/WatchOS.platform/Developer/usr/bin/swift-plugin-server -external-plugin-path /Applications/Xcode.app/Contents/Developer/Platforms/WatchOS.platform/Developer/usr/local/lib/swift/host/plugins\#/Applications/Xcode.app/Contents/Developer/Platforms/WatchOS.platform/Developer/usr/bin/swift-plugin-server -plugin-path /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/host/plugins -plugin-path /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/local/lib/swift/host/plugins -o /Users/gbitaudeau/Documents/workspace_ios/_AppSonic/TestAmplifyGBI/DerivedData/Build/Intermediates.noindex/aws-sdk-swift.build/Debug-watchsimulator/AWSPinpoint.build/Objects-normal/i386/Models.o -index-unit-output-path /aws-sdk-swift.build/Debug-watchsimulator/AWSPinpoint.build/Objects-normal/i386/Models.o -index-store-path /Users/gbitaudeau/Documents/workspace_ios/_AppSonic/TestAmplifyGBI/DerivedData/TestAmplifyGBI/Index.noindex/DataStore -index-system-modules

error: <unknown>:0: Section too large, can't encode r_address (0x10004e8) into 24 bits of scattered relocation entry.

Command SwiftCompile failed with a nonzero exit code

Reproduction Steps

ATM I didn't do this directly with the AWS SDK for Swift, but I think it should be reproducible since Amplify's AWSPinpointPlugin doesn't depend on much other than Swift SDK's AWSPinpoint. Here are the steps from aws-amplify/amplify-swift#3312

Steps to reproduce the behavior:
1. Make a new Xcode project with a iOS app including a watchOS embed app
2. Add `Amplify` and `AWSPinpointAnalyticsPlugin` as dependencies of the both targets (3 dependencies on iOS: Amplify, AWSPinpointAnalyticsPlugin and the Watch app, 2 dependencies on watchOS: Amplify, AWSPinpointAnalyticsPlugin)
3. Compile for iOS simulator

Possible Solution

Possibly pull in @atierian as he may have some ideas here (see comment aws-amplify/amplify-swift#3312 (comment))

The customer thinks the file may be too big: aws-amplify/amplify-swift#3312 (comment)

Maybe we need to keep track of the line limit and split the split the generated file into extension files? I'm not sure of the architecture so hard to suggest a fix

Additional Information/Context

No response

AWS SWIFT SDK version used

0.31.0"

Compiler and Version used

Xcode 15.1 RC (15C65)

Operating System and version

macOS

@lawmicha lawmicha added bug This issue is a bug. needs-triage This issue or PR still needs to be triaged. labels Jan 2, 2024
@jbelkins
Copy link
Contributor

jbelkins commented Jan 2, 2024

@lawmicha I'm on the AWS SDK for Swift team, and I'm looking into this.

I created a Apple Watch project in Xcode, and was able to reproduce this failure as you described.

I'm not deeply familiar with Apple Watch development; is it normal to compile for 32 bits? (see your failed compile command above, the failed compile seems to be for i386. Looking at my compile locally, arm64 & x86_64 compiles of the same source file succeeded.)

@jbelkins
Copy link
Contributor

jbelkins commented Jan 2, 2024

After a little Google searching and a little experimenting in Xcode:

  • The issue seems to be that object file size for a 32-bit compile cannot exceed 16MB.
  • I was able to make the AWSPinpoint client compile for the watch simulator by going into the Watch app target's Build Settings and changing the "Debug Information Format" from "DWARF" to "DWARF with dSYM file" for the Debug build configuration. (This is already the default setting for the Release build configuration.)

I was able to get the watch app to run on my desktop but the change to DWARF settings may impair the ability to debug the app.

In the meantime, we will continue to investigate.

@jbelkins jbelkins self-assigned this Jan 2, 2024
@jbelkins jbelkins changed the title Compiliation Issue using AWSPoinpoint on iOS target with watch target Compilation Issue using AWSPinpoint on iOS target with watch target Jan 2, 2024
@jbelkins
Copy link
Contributor

jbelkins commented Jan 4, 2024

@lawmicha Because this issue is wider than just AWS Pinpoint, I have filed a more general ticket to address watchOS compilation challenges: #1283.

If you don't have anything else specific to AWS Pinpoint, and the DWARF settings fix above unblocks you for the interim, I'm going to close this ticket & keep #1283 open until the root causes are addressed.

We are starting to take a closer look at platform-specific issues like this as we approach GA, so please feel free to file tickets for any other platform-specific problems you encounter.

@lawmicha
Copy link
Author

lawmicha commented Jan 4, 2024

Hi @jbelkins, thanks for looking into this

is it normal to compile for 32 bits?

It seems like this is expected. I couldn't find some definitive answers about watchOS architecture but we mainly observed the behavior that Int is 32-bit at runtime of the app on a watch device. In the related issues, we ended up doing size checks before creating the Int or swapping it out to use Int64 or UInt64.

There was one SO link that mentioned arm64_32 has 32-bit pointer sizes

arm64_32 is a variant of arm64 with 32-bit pointer sizes, used on Apple Watch Series 4 and later.

@lawmicha
Copy link
Author

lawmicha commented Jan 4, 2024

After a little Google searching and a little experimenting in Xcode:

  • The issue seems to be that object file size for a 32-bit compile cannot exceed 16MB.
  • I was able to make the AWSPinpoint client compile for the watch simulator by going into the Watch app target's Build Settings and changing the "Debug Information Format" from "DWARF" to "DWARF with dSYM file" for the Debug build configuration. (This is already the default setting for the Release build configuration.)

I was able to get the watch app to run on my desktop but the change to DWARF settings may impair the ability to debug the app.

In the meantime, we will continue to investigate.

Great findings, thanks for the workaround! I'll pass it along to aws-amplify/amplify-swift#3312

Feel free to close this issue and we'll track #1283

@lawmicha lawmicha closed this as completed Jan 4, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug This issue is a bug. needs-triage This issue or PR still needs to be triaged.
Projects
None yet
Development

No branches or pull requests

2 participants