aws-amplify / amplify-swift

A declarative library for application development using cloud services.
Apache License 2.0
447 stars 193 forks source link

Compilation issue when using AWSPinpointAnalyticsPlugin #3312

Open gbitaudeau opened 11 months ago

gbitaudeau commented 11 months ago

Describe the bug

On a project with an iOS target which embed a watch target, when adding AWSPinpointAnalyticsPlugin dependency, the compilation for iOS simulator failed with the following message:

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

The problem comes from the massive 35000 lines generated file aws-sdk-swift/Sources/Services/AWSPinpoint/models/Models.swift.

Note: this compile for real device and for watchOS simulator ...

Steps To Reproduce

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

Expected behavior

Compile successfully

Amplify Framework Version

2.20.1

Amplify Categories

Analytics

Dependency manager

Swift PM

Swift version

5.9

CLI version

12.7.0

Xcode version

15.0.1 (15A507)

Relevant log output

<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



### Is this a regression?

No

### Regression additional context

_No response_

### Platforms

iOS

### OS Version

iOS 17.0.1

### Device

iPhone 15 Pro

### Specific to simulators

yes iOS 17.0.1 (21A342)

### Additional context

The problem occurs even if there is no code which use Amplify at all.
atierian commented 11 months ago

Thanks for reporting this @gbitaudeau I'm working on reproducing this to better understand what's going on. In the meantime, if this is currently blocking you, you can try using the previous linker by adding -ld64 to "Other Linker Flags" in the Build Settings of your iOS app target.

ld64
atierian commented 11 months ago

You can ignore the -ld64 suggestion - it doesn't help here unfortunately. I'm able to reproduce this error; we're looking into options to resolve this.

gbitaudeau commented 9 months ago

Hi @atierian, do you have any updates for this ?

atierian commented 9 months ago

I don't have any updates at this time. I tested this in Xcode 15.1 RC (15C65) to see if it resolves the issue -- unfortunately it results in a segfault with Xcode crashing.

We're exploring options, but these all appear to be longer term fixes currently.

gbitaudeau commented 8 months ago

Same with Xcode 15.1 ... Don't you think the file aws-sdk-swift/Sources/Services/AWSPinpoint/models/Models.swift is too big and causes the issue ?

lawmicha commented 8 months ago

Opened an issue over in the Swift SDK to get some more visibility on this https://github.com/awslabs/aws-sdk-swift/issues/1279

lawmicha commented 8 months ago

Would this workaround work for you? https://github.com/awslabs/aws-sdk-swift/issues/1279#issuecomment-1874329511

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.)

gbitaudeau commented 8 months ago

Hi @lawmicha unfortunately I already have this settings and use either DWARF or DWARF with dSYM file doesn't change anything.

thisisabhash commented 7 months ago

Tracking a related wider issue on aws-sdk-swift : https://github.com/awslabs/aws-sdk-swift/issues/1283