aws-amplify / aws-sdk-ios

AWS SDK for iOS. For more information, see our web site:
https://aws-amplify.github.io/docs
Other
1.68k stars 884 forks source link

Unable to build with Carthage and Xcode 12 beta (3,4,5,6) #2906

Closed tethridge closed 3 years ago

tethridge commented 4 years ago

Describe the bug Unable to build frameworks using Carthage and Xcode 12 beta 6.

To Reproduce Steps to reproduce the behavior:

  1. Install Xcode 12 beta 6

  2. Open Xcode 12 and accept the new build tools when prompted. Then create a new iOS project.

  3. Create a Cartfile containing: github "aws-amplify/aws-sdk-ios"

  4. Put the cartfile with your project source code.

  5. Set Xcode to use the new compiler. $ sudo xcode-select --switch /Applications/Xcode-beta.app/Contents/Developer

  6. Build using: $ carthage update --no-use-binaries

Observed Behavior

$ carthage update --no-use-binaries Fetching aws-sdk-ios Checking out aws-sdk-ios at "2.15.0" xcodebuild output can be found in /var/folders/gt/_k_rvf056xz16v_bp4klg_gh0000gn/T/carthage-xcodebuild.Tm3ciQ.log Building scheme "AWSAutoScaling" in AWSiOSSDKv2.xcodeproj Build Failed Task failed with exit code 1: /usr/bin/xcrun lipo -create /Users/tethridge/Library/Caches/org.carthage.CarthageKit/DerivedData/12.0_12A8169g/aws-sdk-ios/2.15.0/Build/Intermediates.noindex/ArchiveIntermediates/AWSAutoScaling/IntermediateBuildFilesPath/UninstalledProducts/iphoneos/AWSAutoScaling.framework/AWSAutoScaling /Users/tethridge/Library/Caches/org.carthage.CarthageKit/DerivedData/12.0_12A8169g/aws-sdk-ios/2.15.0/Build/Products/Release-iphonesimulator/AWSAutoScaling.framework/AWSAutoScaling -output /Users/tethridge/Projects/companions/relay/ios/Carthage/Build/iOS/AWSAutoScaling.framework/AWSAutoScaling

This usually indicates that project itself failed to compile. Please check the xcodebuild log for more details: /var/folders/gt/_k_rvf056xz16v_bp4klg_gh0000gn/T/carthage-xcodebuild.Tm3ciQ.log

Expected Behavior All of the frameworks should build without error.

Environment(please complete the following information):

carthage-xcodebuild.Tm3ciQ.log

Prince2k3 commented 4 years ago

Same in Xcode 12 beta 5. Please can you guys get this working! There are people who have stake in making sure they have a build ready at launch of iOS 14.

stevenkramer commented 4 years ago

@tethridge @Prince2k3 the lipo error is probably due to https://github.com/Carthage/Carthage/issues/3019, which has a work-around.

Prince2k3 commented 4 years ago

@stevenkramer ... I've commented out this library to make sure. The other libs compile and create frameworks the issue is definitely with this library ... I have tried the workaround and It got passed the original issue (AWSAutoscaling) only to fail at (AWSLex).

with AWSLex error

In file included from /Carthage/Checkouts/aws-sdk-ios/AWSLex/AWSLexInteractionKit.m:17:
/Carthage/Checkouts/aws-sdk-ios/AWSLex/AWSLexInteractionKit.h:519:34: error: expected a type
- (void)requestRecordPermission:(PermissionBlock)response;

it points to PermissionBlock

stevenkramer commented 4 years ago

@Prince2k3 https://github.com/aws-amplify/aws-sdk-ios/issues/2943

Prince2k3 commented 4 years ago

@stevenkramer pointed to develop branch which got passed AWSLex but then AWSAppleSignIn breaks.

Undefined symbols for architecture x86_64:
  "_OBJC_CLASS_$_AWSSignInManager", referenced from:
      objc-class-ref in AWSAppleSignInProvider.o
      objc-class-ref in AWSAppleSignInButton.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
marciogranzotto commented 4 years ago

Also pointing to develop. I can build AWSAppleSignIn, but it breaks on AWSAuthUI:

*** Checking out aws-sdk-ios at "e855cc6a1090cec9b30affd53e9bc08c125ab678"
*** Building scheme "AWSTranslate" in AWSiOSSDKv2.xcodeproj
*** Building scheme "AWSAppleSignIn" in AWSAuthSDK.xcodeproj
*** Building scheme "AWSAuthCore" in AWSAuthSDK.xcodeproj
*** Building scheme "AWSAuthUI" in AWSAuthSDK.xcodeproj
Build Failed
    Task failed with exit code 65:
    /usr/bin/xcrun xcodebuild -project /Users/myuser/Project/code/ios-app-v2/ios-sdk/iOS-MySDK/Carthage/Checkouts/aws-sdk-ios/AWSAuthSDK/AWSAuthSDK.xcodeproj -scheme AWSAuthUI -configuration Release -derivedDataPath /Users/myuser/Library/Caches/org.carthage.CarthageKit/DerivedData/12.0_12A8189h/aws-sdk-ios/e855cc6a1090cec9b30affd53e9bc08c125ab678 -sdk iphonesimulator -destination platform=iOS\ Simulator,id=5560603D-CFBB-40D2-A48A-6C19D9A152E2 -destination-timeout 3 ONLY_ACTIVE_ARCH=NO CODE_SIGNING_REQUIRED=NO CODE_SIGN_IDENTITY= CARTHAGE=YES build (launched in /Users/myuser/Project/code/ios-app-v2/ios-sdk/iOS-MySDK/Carthage/Checkouts/aws-sdk-ios)

This usually indicates that project itself failed to compile. Please check the xcodebuild log for more details: /var/folders/l2/8j4852911h7fkl4724_s21p80000gn/T/carthage-xcodebuild.zdfrPt.log

Log:

Ld /Users/myuser/Library/Caches/org.carthage.CarthageKit/DerivedData/12.0_12A8189h/aws-sdk-ios/e855cc6a1090cec9b30affd53e9bc08c125ab678/Build/Intermediates.noindex/AWSAuthSDK.build/Release-iphonesimulator/AWSAuthUI.build/Objects-normal/x86_64/Binary/AWSAuthUI normal x86_64 (in target 'AWSAuthUI' from project 'AWSAuthSDK')
    cd /Users/myuser/Project/code/ios-app-v2/ios-sdk/iOS-MySDK/Carthage/Checkouts/aws-sdk-ios/AWSAuthSDK
    /Applications/Xcode-beta.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang -target x86_64-apple-ios9.0-simulator -dynamiclib -isysroot /Applications/Xcode-beta.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator14.0.sdk -L/Users/myuser/Library/Caches/org.carthage.CarthageKit/DerivedData/12.0_12A8189h/aws-sdk-ios/e855cc6a1090cec9b30affd53e9bc08c125ab678/Build/Products/Release-iphonesimulator -F/Users/myuser/Library/Caches/org.carthage.CarthageKit/DerivedData/12.0_12A8189h/aws-sdk-ios/e855cc6a1090cec9b30affd53e9bc08c125ab678/Build/Products/Release-iphonesimulator -filelist /Users/myuser/Library/Caches/org.carthage.CarthageKit/DerivedData/12.0_12A8189h/aws-sdk-ios/e855cc6a1090cec9b30affd53e9bc08c125ab678/Build/Intermediates.noindex/AWSAuthSDK.build/Release-iphonesimulator/AWSAuthUI.build/Objects-normal/x86_64/AWSAuthUI.LinkFileList -install_name @rpath/AWSAuthUI.framework/AWSAuthUI -Xlinker -rpath -Xlinker @executable_path/Frameworks -Xlinker -rpath -Xlinker @loader_path/Frameworks -dead_strip -Xlinker -object_path_lto -Xlinker /Users/myuser/Library/Caches/org.carthage.CarthageKit/DerivedData/12.0_12A8189h/aws-sdk-ios/e855cc6a1090cec9b30affd53e9bc08c125ab678/Build/Intermediates.noindex/AWSAuthSDK.build/Release-iphonesimulator/AWSAuthUI.build/Objects-normal/x86_64/AWSAuthUI_lto.o -Xlinker -objc_abi_version -Xlinker 2 -fobjc-arc -fobjc-link-runtime -compatibility_version 1 -current_version 1 -Xlinker -dependency_info -Xlinker /Users/myuser/Library/Caches/org.carthage.CarthageKit/DerivedData/12.0_12A8189h/aws-sdk-ios/e855cc6a1090cec9b30affd53e9bc08c125ab678/Build/Intermediates.noindex/AWSAuthSDK.build/Release-iphonesimulator/AWSAuthUI.build/Objects-normal/x86_64/AWSAuthUI_dependency_info.dat -o /Users/myuser/Library/Caches/org.carthage.CarthageKit/DerivedData/12.0_12A8189h/aws-sdk-ios/e855cc6a1090cec9b30affd53e9bc08c125ab678/Build/Intermediates.noindex/AWSAuthSDK.build/Release-iphonesimulator/AWSAuthUI.build/Objects-normal/x86_64/Binary/AWSAuthUI
Undefined symbols for architecture x86_64:
  "_OBJC_CLASS_$_AWSAuthUIHelper", referenced from:
      objc-class-ref in AWSSignInViewController.o
  "_OBJC_CLASS_$_AWSSignInManager", referenced from:
      objc-class-ref in AWSSignInViewController.o
      objc-class-ref in AWSAuthUIViewController.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)

Ld /Users/myuser/Library/Caches/org.carthage.CarthageKit/DerivedData/12.0_12A8189h/aws-sdk-ios/e855cc6a1090cec9b30affd53e9bc08c125ab678/Build/Intermediates.noindex/AWSAuthSDK.build/Release-iphonesimulator/AWSAuthUI.build/Objects-normal/i386/Binary/AWSAuthUI normal i386 (in target 'AWSAuthUI' from project 'AWSAuthSDK')
    cd /Users/myuser/Project/code/ios-app-v2/ios-sdk/iOS-MySDK/Carthage/Checkouts/aws-sdk-ios/AWSAuthSDK
    /Applications/Xcode-beta.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang -target i386-apple-ios9.0-simulator -dynamiclib -isysroot /Applications/Xcode-beta.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator14.0.sdk -L/Users/myuser/Library/Caches/org.carthage.CarthageKit/DerivedData/12.0_12A8189h/aws-sdk-ios/e855cc6a1090cec9b30affd53e9bc08c125ab678/Build/Products/Release-iphonesimulator -F/Users/myuser/Library/Caches/org.carthage.CarthageKit/DerivedData/12.0_12A8189h/aws-sdk-ios/e855cc6a1090cec9b30affd53e9bc08c125ab678/Build/Products/Release-iphonesimulator -filelist /Users/myuser/Library/Caches/org.carthage.CarthageKit/DerivedData/12.0_12A8189h/aws-sdk-ios/e855cc6a1090cec9b30affd53e9bc08c125ab678/Build/Intermediates.noindex/AWSAuthSDK.build/Release-iphonesimulator/AWSAuthUI.build/Objects-normal/i386/AWSAuthUI.LinkFileList -install_name @rpath/AWSAuthUI.framework/AWSAuthUI -Xlinker -rpath -Xlinker @executable_path/Frameworks -Xlinker -rpath -Xlinker @loader_path/Frameworks -dead_strip -Xlinker -object_path_lto -Xlinker /Users/myuser/Library/Caches/org.carthage.CarthageKit/DerivedData/12.0_12A8189h/aws-sdk-ios/e855cc6a1090cec9b30affd53e9bc08c125ab678/Build/Intermediates.noindex/AWSAuthSDK.build/Release-iphonesimulator/AWSAuthUI.build/Objects-normal/i386/AWSAuthUI_lto.o -Xlinker -objc_abi_version -Xlinker 2 -fobjc-arc -fobjc-link-runtime -compatibility_version 1 -current_version 1 -Xlinker -dependency_info -Xlinker /Users/myuser/Library/Caches/org.carthage.CarthageKit/DerivedData/12.0_12A8189h/aws-sdk-ios/e855cc6a1090cec9b30affd53e9bc08c125ab678/Build/Intermediates.noindex/AWSAuthSDK.build/Release-iphonesimulator/AWSAuthUI.build/Objects-normal/i386/AWSAuthUI_dependency_info.dat -o /Users/myuser/Library/Caches/org.carthage.CarthageKit/DerivedData/12.0_12A8189h/aws-sdk-ios/e855cc6a1090cec9b30affd53e9bc08c125ab678/Build/Intermediates.noindex/AWSAuthSDK.build/Release-iphonesimulator/AWSAuthUI.build/Objects-normal/i386/Binary/AWSAuthUI

** BUILD FAILED **
marciogranzotto commented 4 years ago

Actually after running it one more time, I have the same error as @Prince2k3

*** Building scheme "AWSTranslate" in AWSiOSSDKv2.xcodeproj
*** Building scheme "AWSAppleSignIn" in AWSAuthSDK.xcodeproj
Build Failed
    Task failed with exit code 65:
    /usr/bin/xcrun xcodebuild -project /Users/myuser/Project/code/ios-app-v2/ios-sdk/iOS-MySDK/Carthage/Checkouts/aws-sdk-ios/AWSAuthSDK/AWSAuthSDK.xcodeproj -scheme AWSAppleSignIn -configuration Release -derivedDataPath /Users/myuser/Library/Caches/org.carthage.CarthageKit/DerivedData/12.0_12A8189h/aws-sdk-ios/e855cc6a1090cec9b30affd53e9bc08c125ab678 -sdk iphonesimulator -destination platform=iOS\ Simulator,id=5560603D-CFBB-40D2-A48A-6C19D9A152E2 -destination-timeout 3 ONLY_ACTIVE_ARCH=NO CODE_SIGNING_REQUIRED=NO CODE_SIGN_IDENTITY= CARTHAGE=YES build (launched in /Users/myuser/Project/code/ios-app-v2/ios-sdk/iOS-MySDK/Carthage/Checkouts/aws-sdk-ios)

This usually indicates that project itself failed to compile. Please check the xcodebuild log for more details: /var/folders/l2/8j4852911h7fkl4724_s21p80000gn/T/carthage-xcodebuild.7p20Io.log
Ld /Users/myuser/Library/Caches/org.carthage.CarthageKit/DerivedData/12.0_12A8189h/aws-sdk-ios/e855cc6a1090cec9b30affd53e9bc08c125ab678/Build/Products/Release-iphonesimulator/AWSAppleSignIn.framework/AWSAppleSignIn normal (in target 'AWSAppleSignIn' from project 'AWSAuthSDK')
    cd /Users/myuser/Project/code/ios-app-v2/ios-sdk/iOS-MySDK/Carthage/Checkouts/aws-sdk-ios/AWSAuthSDK
    /Applications/Xcode-beta.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang -target x86_64-apple-ios13.0-simulator -dynamiclib -isysroot /Applications/Xcode-beta.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator14.0.sdk -L/Users/myuser/Library/Caches/org.carthage.CarthageKit/DerivedData/12.0_12A8189h/aws-sdk-ios/e855cc6a1090cec9b30affd53e9bc08c125ab678/Build/Products/Release-iphonesimulator -F/Users/myuser/Library/Caches/org.carthage.CarthageKit/DerivedData/12.0_12A8189h/aws-sdk-ios/e855cc6a1090cec9b30affd53e9bc08c125ab678/Build/Products/Release-iphonesimulator -filelist /Users/myuser/Library/Caches/org.carthage.CarthageKit/DerivedData/12.0_12A8189h/aws-sdk-ios/e855cc6a1090cec9b30affd53e9bc08c125ab678/Build/Intermediates.noindex/AWSAuthSDK.build/Release-iphonesimulator/AWSAppleSignIn.build/Objects-normal/x86_64/AWSAppleSignIn.LinkFileList -install_name @rpath/AWSAppleSignIn.framework/AWSAppleSignIn -Xlinker -rpath -Xlinker @executable_path/Frameworks -Xlinker -rpath -Xlinker @loader_path/Frameworks -dead_strip -Xlinker -object_path_lto -Xlinker /Users/myuser/Library/Caches/org.carthage.CarthageKit/DerivedData/12.0_12A8189h/aws-sdk-ios/e855cc6a1090cec9b30affd53e9bc08c125ab678/Build/Intermediates.noindex/AWSAuthSDK.build/Release-iphonesimulator/AWSAppleSignIn.build/Objects-normal/x86_64/AWSAppleSignIn_lto.o -Xlinker -objc_abi_version -Xlinker 2 -fobjc-arc -fobjc-link-runtime -compatibility_version 1 -current_version 1 -Xlinker -dependency_info -Xlinker /Users/myuser/Library/Caches/org.carthage.CarthageKit/DerivedData/12.0_12A8189h/aws-sdk-ios/e855cc6a1090cec9b30affd53e9bc08c125ab678/Build/Intermediates.noindex/AWSAuthSDK.build/Release-iphonesimulator/AWSAppleSignIn.build/Objects-normal/x86_64/AWSAppleSignIn_dependency_info.dat -o /Users/myuser/Library/Caches/org.carthage.CarthageKit/DerivedData/12.0_12A8189h/aws-sdk-ios/e855cc6a1090cec9b30affd53e9bc08c125ab678/Build/Products/Release-iphonesimulator/AWSAppleSignIn.framework/AWSAppleSignIn
Undefined symbols for architecture x86_64:
  "_OBJC_CLASS_$_AWSSignInManager", referenced from:
      objc-class-ref in AWSAppleSignInProvider.o
      objc-class-ref in AWSAppleSignInButton.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)

warning: The iOS Simulator deployment target 'IPHONEOS_DEPLOYMENT_TARGET' is set to 8.0, but the range of supported deployment target versions is 9.0 to 14.0.99. (in target 'AWSCore' from project 'AWSiOSSDKv2')
** BUILD FAILED **

The following build commands failed:
    Ld /Users/myuser/Library/Caches/org.carthage.CarthageKit/DerivedData/12.0_12A8189h/aws-sdk-ios/e855cc6a1090cec9b30affd53e9bc08c125ab678/Build/Products/Release-iphonesimulator/AWSAppleSignIn.framework/AWSAppleSignIn normal
(1 failure)
lawmicha commented 4 years ago

I tried the carthage workaround to get pass the lipo issue, not sure what is the impact in doing this, and we should track the outcome of the carthage issue in https://github.com/Carthage/Carthage/issues/3019 to replace the workaround. The reason why I wanted to get pass the lipo issue is so that I could try the same fix that's being applied over in https://github.com/aws-amplify/aws-sdk-ios/issues/2927 . Other developers had seen build failures when using xcode 12 with the SDK through cocoapods and an upgrade on the SDK to support a minimum deployment version of iOS 9 seems to fix that issue https://github.com/aws-amplify/aws-sdk-ios/pull/2981

However, with the carthage installation, the lipo workaround, xcode 12 beta 6, SDK PR for iOS 9, is still failing for me on AWSAuthUI

Undefined symbols for architecture x86_64:
  "_OBJC_CLASS_$_AWSAuthUIHelper", referenced from:
      objc-class-ref in AWSSignInViewController.o
  "_OBJC_CLASS_$_AWSSignInManager", referenced from:
      objc-class-ref in AWSSignInViewController.o
      objc-class-ref in AWSAuthUIViewController.o
ld: symbol(s) not found for architecture x86_64
stevenkramer commented 4 years ago

@lawmicha and @Prince2k3 - I build only the required (for my project) subset of AWS libraries. If you don't need AWSAuthUI, perhaps that works for you too.

Prince2k3 commented 4 years ago

@stevenkramer Using Carthage I don't think that is possible. Using Cocopods works but breaks SwiftUI previews, which is a deal breaker. I'd prefer using SPM but that isn't supported. Right now the option is rest APIs working as we just need Cognito

stevenkramer commented 4 years ago

@Prince2k3 I also use only Cognito. I've broken up the carthage installation into checkout and build actions. In between I remove the schemes that build the targets I don't need.

carthage checkout ${deps} >&2
echo Checked out, removing unwanted AWS targets >&2

find Carthage/Checkouts/aws-sdk-ios -iname '*.xcscheme' | grep -v -E 'AWSAuthCore|AWSUserPoolsSignIn|AWSCognito|AWSCognitoAuth|AWSCognitoIdentityProvider|AWSCognitoIdentityProviderASF|AWSCore' | xargs -Jrepl rm repl

carthage build --verbose --cache-builds --platform iOS
Prince2k3 commented 4 years ago

@stevenkramer This is interesting. I have never seen that before with Carthage. I'll give it a try. Thanks!

stevenkramer commented 4 years ago

Yes, it's a bit of a kludge, but it will work. I love Carthage, never looked back after moving from manual deps and Pods, but it's hard to compete with the Apple sanctioned tools. Time for spm.

Prince2k3 commented 4 years ago

@stevenkramer Agreed.

Prince2k3 commented 4 years ago

@stevenkramer that works building only what is needed but it still fails to build. in the instance it fails to build as class AWSIdentityManager. :-/

BrandonSmith commented 4 years ago

I am only building frameworks as shown by @Prince2k3 I need while also using the lipo xcconfig fix demonstrated here.

xcconfig=$(mktemp /tmp/static.xcconfig.XXXXXX)
trap 'rm -f "$xcconfig"' INT TERM HUP EXIT

# For Xcode 12 make sure EXCLUDED_ARCHS is set to arm architectures otherwise
# the build will fail on lipo due to duplicate architectures.
# Xcode 12 Beta 3:
echo 'EXCLUDED_ARCHS__EFFECTIVE_PLATFORM_SUFFIX_simulator__NATIVE_ARCH_64_BIT_x86_64__XCODE_1200__BUILD_12A8169g = arm64 arm64e armv7 armv7s armv6 armv8' >> $xcconfig
# Xcode 12 beta 4
echo 'EXCLUDED_ARCHS__EFFECTIVE_PLATFORM_SUFFIX_simulator__NATIVE_ARCH_64_BIT_x86_64__XCODE_1200__BUILD_12A8179i = arm64 arm64e armv7 armv7s armv6 armv8' >> $xcconfig
# Xcode 12 beta 5
echo 'EXCLUDED_ARCHS__EFFECTIVE_PLATFORM_SUFFIX_simulator__NATIVE_ARCH_64_BIT_x86_64__XCODE_1200__BUILD_12A8189h = arm64 arm64e armv7 armv7s armv6 armv8' >> $xcconfig
# Xcode 12 beta 6
echo 'EXCLUDED_ARCHS__EFFECTIVE_PLATFORM_SUFFIX_simulator__NATIVE_ARCH_64_BIT_x86_64__XCODE_1200__BUILD_12A8189n = arm64 arm64e armv7 armv7s armv6 armv8' >> $xcconfig

echo 'EXCLUDED_ARCHS__EFFECTIVE_PLATFORM_SUFFIX_simulator__NATIVE_ARCH_64_BIT_x86_64__XCODE_1200 = $(EXCLUDED_ARCHS__EFFECTIVE_PLATFORM_SUFFIX_simulator__NATIVE_ARCH_64_BIT_x86_64__XCODE_1200__BUILD_$(XCODE_PRODUCT_BUILD_VERSION))' >> $xcconfig
echo 'EXCLUDED_ARCHS = $(inherited) $(EXCLUDED_ARCHS__EFFECTIVE_PLATFORM_SUFFIX_$(EFFECTIVE_PLATFORM_SUFFIX)__NATIVE_ARCH_64_BIT_$(NATIVE_ARCH_64_BIT)__XCODE_$(XCODE_VERSION_MAJOR))' >> $xcconfig

export XCODE_XCCONFIG_FILE="$xcconfig"

echo Checked out, removing unwanted AWS targets >&2

find Carthage/Checkouts/aws-sdk-ios -iname '*.xcscheme' | grep -v -E 'AWSAuthCore|AWSCognitoIdentityProvider|AWSCognitoIdentityProviderASF|AWSCore|AWSMobileClient|AWSPinpoint' | xargs -Jrepl rm repl

carthage build --verbose  --platform iOS --no-use-binaries

The following command fails...

/usr/bin/xcrun xcodebuild -project /Users/brandon/work/rw/companions/relay/ios/Carthage/Checkouts/aws-sdk-ios/AWSAuthSDK/AWSAuthSDK.xcodeproj -scheme AWSMobileClient -configuration Release -derivedDataPath /Users/brandon/Library/Caches/org.carthage.CarthageKit/DerivedData/12.0_12A8189n/aws-sdk-ios/2.15.3 -sdk iphonesimulator -destination platform=iOS\ Simulator,id=1E894721-0FCF-4532-A0FE-1B149528003C -destination-timeout 3 ONLY_ACTIVE_ARCH=NO CODE_SIGNING_REQUIRED=NO CODE_SIGN_IDENTITY= CARTHAGE=YES build

with...

** BUILD FAILED **

The following build commands failed:
    CompileSwift normal x86_64
    CompileSwift normal i386
    CompileSwift normal arm64
    Ld /Users/brandon/Library/Caches/org.carthage.CarthageKit/DerivedData/12.0_12A8189n/aws-sdk-ios/2.15.3/Build/Intermediates.noindex/AWSAuthSDK.build/Release-iphonesimulator/AWSAuthCore.build/Objects-normal/x86_64/Binary/AWSAuthCore normal x86_64
(4 failures)

A few lines up the log output show...

Undefined symbols for architecture x86_64:
  "_OBJC_CLASS_$_AWSTask", referenced from:
      objc-class-ref in AWSIdentityManager.o
  "_OBJC_CLASS_$_AWSInfo", referenced from:
      objc-class-ref in AWSIdentityManager.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
stevenkramer commented 4 years ago

May be aws version specific? I use github "aws-amplify/aws-sdk-ios" "2.12.6"

lawmicha commented 4 years ago

my sample app with pods builds and runs on canvas/simulator fine when i use the lawmicha/ios-9-xcode-12 branch which bumps the min iOS deployment target to 9.0 across the different projects. I was trying to verify with carthage build, could @Prince2k3 @stevenkramer @BrandonSmith that is using a different set up from what I had try using lawmicha/ios-9-xcode-12 branch to verify?

Prince2k3 commented 4 years ago

@lawmicha Does it work with SwiftUI previews? That is the issue using cocoapods

lawmicha commented 4 years ago

@lawmicha Does it work with SwiftUI previews? That is the issue using cocoapods

yes, I was able to run the UI (the canvas swiftUI preview) using local pods pointing to the branch. cocoapods issue tracking over in https://github.com/aws-amplify/aws-sdk-ios/issues/2927

stevenkramer commented 4 years ago

So for me the winning combination is:

BrandonSmith commented 4 years ago

@stevenkramer Through experimentation, I discovered whatever caused my last build error was introduced in 2.13.4.

I, too, have arrived at a similar combination as you.

Thanks for the tip.

sebskuse commented 4 years ago

Any update on this? We've got the GM of Xcode 12 now, so would be good to know there's a plan to fix this issue - we'd rather not go back to a version of the AWS SDK from 6 months ago

AndyDentFree commented 4 years ago

Confirming it is broken with the GM XCode12

lawmicha commented 4 years ago

Trying this again with the latest develop branch.

  1. I have made a new project using Xcode 12 beta 6
  2. carthage-build.sh with the following:
    
    # carthage-build.sh
    # Usage example: ./carthage-build.sh --platform iOS

set -euo pipefail

xcconfig=$(mktemp /tmp/static.xcconfig.XXXXXX) trap 'rm -f "$xcconfig"' INT TERM HUP EXIT

For Xcode 12 make sure EXCLUDED_ARCHS is set to arm architectures otherwise

the build will fail on lipo due to duplicate architectures.

Xcode 12 Beta 3:

echo 'EXCLUDED_ARCHSEFFECTIVE_PLATFORM_SUFFIX_simulator__NATIVE_ARCH_64_BIT_x86_64XCODE_1200__BUILD_12A8169g = arm64 arm64e armv7 armv7s armv6 armv8' >> $xcconfig

Xcode 12 beta 4

echo 'EXCLUDED_ARCHSEFFECTIVE_PLATFORM_SUFFIX_simulator__NATIVE_ARCH_64_BIT_x86_64XCODE_1200__BUILD_12A8179i = arm64 arm64e armv7 armv7s armv6 armv8' >> $xcconfig

Xcode 12 beta 5

echo 'EXCLUDED_ARCHSEFFECTIVE_PLATFORM_SUFFIX_simulator__NATIVE_ARCH_64_BIT_x86_64XCODE_1200__BUILD_12A8189h = arm64 arm64e armv7 armv7s armv6 armv8' >> $xcconfig

Xcode 12 beta 6

echo 'EXCLUDED_ARCHSEFFECTIVE_PLATFORM_SUFFIX_simulator__NATIVE_ARCH_64_BIT_x86_64XCODE_1200__BUILD_12A8189n = arm64 arm64e armv7 armv7s armv6 armv8' >> $xcconfig

Xcode 12 GM

echo 'EXCLUDED_ARCHSEFFECTIVE_PLATFORM_SUFFIX_simulator__NATIVE_ARCH_64_BIT_x86_64XCODE_1200__BUILD_12A7208 = arm64 arm64e armv7 armv7s armv6 armv8' >> $xcconfig

Xcode 12 GM (updated build)

echo 'EXCLUDED_ARCHSEFFECTIVE_PLATFORM_SUFFIX_simulator__NATIVE_ARCH_64_BIT_x86_64XCODE_1200__BUILD_12A7209 = arm64 arm64e armv7 armv7s armv6 armv8' >> $xcconfig

echo 'EXCLUDED_ARCHSEFFECTIVE_PLATFORM_SUFFIX_simulator__NATIVE_ARCH_64_BIT_x86_64XCODE_1200 = $(EXCLUDED_ARCHSEFFECTIVE_PLATFORM_SUFFIX_simulator__NATIVE_ARCH_64_BIT_x86_64XCODE_1200BUILD_$(XCODE_PRODUCT_BUILD_VERSION))' >> $xcconfig echo 'EXCLUDED_ARCHS = $(inherited) $(EXCLUDED_ARCHSEFFECTIVE_PLATFORMSUFFIX$(EFFECTIVE_PLATFORM_SUFFIX)__NATIVE_ARCH_64BIT$(NATIVE_ARCH_64_BIT)_XCODE$(XCODE_VERSION_MAJOR))' >> $xcconfig

export XCODE_XCCONFIG_FILE="$xcconfig" echo $XCODE_XCCONFIG_FILE carthage update "$@"

got this from [here](https://github.com/Carthage/Carthage/issues/3019#issuecomment-692966701)

3. `cartfile` with the following contents

github "aws-amplify/aws-sdk-ios" "develop"

At this time, the cartfile.resolved points to `github "aws-amplify/aws-sdk-ios" "334ca3770102ab4689c6c283a6c5c609acc9669e"`, and points to this commit https://github.com/aws-amplify/aws-sdk-ios/commit/334ca3770102ab4689c6c283a6c5c609acc9669e
`

4. I have not excluded any schemes so it did take like >1hr to build. Build output:

sdk29063 % ./carthage-build.sh --platform iOS /tmp/static.xcconfig.yjImAO Please update to the latest Carthage version: 0.35.1. You currently are on 0.35.0 Fetching aws-sdk-ios Checking out aws-sdk-ios at "334ca3770102ab4689c6c283a6c5c609acc9669e" xcodebuild output can be found in /var/folders/wl/yhpbkfx93g38l3k0ts5f92_1kgt2sf/T/carthage-xcodebuild.WX3QyU.log Building scheme "AWSAutoScaling" in AWSiOSSDKv2.xcodeproj Building scheme "AWSAPIGateway" in AWSiOSSDKv2.xcodeproj Building scheme "AWSCloudWatch" in AWSiOSSDKv2.xcodeproj Building scheme "AWSCognito" in AWSiOSSDKv2.xcodeproj Building scheme "AWSCognitoAuth" in AWSiOSSDKv2.xcodeproj Building scheme "AWSCognitoIdentityProvider" in AWSiOSSDKv2.xcodeproj Building scheme "AWSCognitoIdentityProviderASF" in AWSiOSSDKv2.xcodeproj Building scheme "AWSComprehend" in AWSiOSSDKv2.xcodeproj Building scheme "AWSConnect" in AWSiOSSDKv2.xcodeproj Building scheme "AWSConnectParticipant" in AWSiOSSDKv2.xcodeproj Building scheme "AWSCore" in AWSiOSSDKv2.xcodeproj Building scheme "AWSEC2" in AWSiOSSDKv2.xcodeproj Building scheme "AWSDynamoDB" in AWSiOSSDKv2.xcodeproj Building scheme "AWSElasticLoadBalancing" in AWSiOSSDKv2.xcodeproj Building scheme "AWSKinesis" in AWSiOSSDKv2.xcodeproj Building scheme "AWSIoT" in AWSiOSSDKv2.xcodeproj Building scheme "AWSKinesisVideo" in AWSiOSSDKv2.xcodeproj Building scheme "AWSKinesisVideoArchivedMedia" in AWSiOSSDKv2.xcodeproj Building scheme "AWSKMS" in AWSiOSSDKv2.xcodeproj Building scheme "AWSLambda" in AWSiOSSDKv2.xcodeproj Building scheme "AWSKinesisVideoSignaling" in AWSiOSSDKv2.xcodeproj Building scheme "AWSLex" in AWSiOSSDKv2.xcodeproj Building scheme "AWSLogs" in AWSiOSSDKv2.xcodeproj Building scheme "AWSMobileAnalytics" in AWSiOSSDKv2.xcodeproj Building scheme "AWSMachineLearning" in AWSiOSSDKv2.xcodeproj Building scheme "AWSPinpoint" in AWSiOSSDKv2.xcodeproj Building scheme "AWSPolly" in AWSiOSSDKv2.xcodeproj Building scheme "AWSRekognition" in AWSiOSSDKv2.xcodeproj Building scheme "AWSS3" in AWSiOSSDKv2.xcodeproj Building scheme "AWSSageMakerRuntime" in AWSiOSSDKv2.xcodeproj Building scheme "AWSSES" in AWSiOSSDKv2.xcodeproj Building scheme "AWSSimpleDB" in AWSiOSSDKv2.xcodeproj Building scheme "AWSSNS" in AWSiOSSDKv2.xcodeproj Building scheme "AWSTestResources" in AWSiOSSDKv2.xcodeproj Building scheme "AWSTranscribe" in AWSiOSSDKv2.xcodeproj Building scheme "AWSSQS" in AWSiOSSDKv2.xcodeproj Building scheme "AWSTextract" in AWSiOSSDKv2.xcodeproj Building scheme "AWSTranscribeStreaming" in AWSiOSSDKv2.xcodeproj Building scheme "AWSTranslate" in AWSiOSSDKv2.xcodeproj Building scheme "AWSAppleSignIn" in AWSAuthSDK.xcodeproj Building scheme "AWSAuthUI" in AWSAuthSDK.xcodeproj Building scheme "AWSAuthCore" in AWSAuthSDK.xcodeproj Building scheme "AWSMobileClient" in AWSAuthSDK.xcodeproj Building scheme "AWSFacebookSignIn" in AWSAuthSDK.xcodeproj Building scheme "AWSGoogleSignIn" in AWSAuthSDK.xcodeproj *** Building scheme "AWSUserPoolsSignIn" in AWSAuthSDK.xcodeproj



Some things to note was that I had missed a change in the current release (2.16.0), and fixed in this PR https://github.com/aws-amplify/aws-sdk-ios/pull/3012 and merged into `develop` branch, related to dropping support for iOS 8. So although I don't have an exact correlation to the errors seen regarding the carthage build, I was able to build using carthage using the latest commits in `develop` branch
lawmicha commented 4 years ago

The combination that I found working (xcode 12 new app, lipo workaround, using latest SDK from develop branch) would be pending release since the code is in develop branch. I'll try the same steps again using the main branch and if it fails, then it may be obvious that its related dropping iOS 8 support across all targets in the SDK.

I'm setting this to requesting feedback for others that are running into this. Could you please provide the following information to reproduce?

  1. Does the installation work with latest SDK? develop branch, main branch, or 2.16.0?
  2. What does your cartfile look like?
  3. What is the cartfile.resolved
  4. Are you using the lipo workaround for carthage?
  5. Are you excluding building certain frameworks?
  6. What command are you using to build?
  7. Which carthage version are you using?
  8. What is the error you are seeing?
  9. If possible, any sample repo I can pull down to reproduce the problem?
ZavenArra commented 4 years ago

I had problems still with GM Xcode 12. Here's how I resolved it using info from various posts on the subject

1) Create tmp.xccconfig (lipo fix and only build for iphone, not simulator)

EXCLUDED_ARCHS__EFFECTIVE_PLATFORM_SUFFIX_simulator__NATIVE_ARCH_64_BIT_x86_64=arm64 arm64e armv7 armv7s armv6 armv8
EXCLUDED_ARCHS=$(inherited) $(EXCLUDED_ARCHS__EFFECTIVE_PLATFORM_SUFFIX_$(EFFECTIVE_PLATFORM_SUFFIX)__NATIVE_ARCH_64_BIT_$(NATIVE_ARCH_64_BIT))
SUPPORTED_PLATFORMS=iphoneos

2) only build schemes that I need

carthage checkout aws-sdk-ios
find Carthage/Checkouts/aws-sdk-ios -iname '*.xcscheme' | grep -v -E 'AWSAuthCore|AWSUserPoolsSignIn|AWSCognito|AWSCognitoAuth|AWSCognitoIdentityProvider|AWSCognitoIdentityProviderASF|AWSCore|AWSMobileClient' | xargs -Jrepl rm repl
carthage build aws-sdk-ios --platform iOS --no-use-binaries --verbose

Finally back up and running

nourahassan commented 4 years ago

Using carthage-build from here, it fails on building either AWSMobileClient or AWSAuthCore

carthage update --no-build 

echo Removing unwanted AWS targets

find Carthage/Checkouts/aws-sdk-ios -iname '*.xcscheme' | grep -v -E 'AWSAuthCore|AWSCognitoIdentityProvider|AWSCognitoIdentityProviderASF|AWSCore|AWSMobileClient|AWSLambda|AWSS3|AWSPinpoint' | xargs -Jrepl rm repl

carthage build --platform iOS 

BUILD FAILED

The following build commands failed: CompileSwift normal x86_64 CompileSwift normal i386 Ld ~/Library/Caches/org.carthage.CarthageKit/build/5.3+df4651b6117805e4aa1fc1bc0670304e/aws-sdk-ios/334ca3770102ab4689c6c283a6c5c609acc9669e/Build/Intermediates.noindex/AWSAuthSDK.build/Release-iphonesimulator/AWSAuthCore.build/Objects-normal/i386/Binary/AWSAuthCore normal i386 (3 failures)

AndyDentFree commented 4 years ago

I have just built successfully on Xcode12 with the following combination.

  1. use develop in my Cartfile
  2. the carthage script, with added suppression of i386 run with the command

sudo ./carthage.sh update --verbose --platform ios,macos --no-use-binaries

Cartfile

github "https://github.com/realm/realm-cocoa" "master"
github "aws-amplify/aws-sdk-ios" "develop"
github "GianniCarlo/DirectoryWatcher" ~> 2.0.0
github "SVGKit/SVGKit" "3.x"

carthage.sh

#!/usr/bin/env bash

# carthage.sh
# Usage example: ./carthage.sh build --platform iOS
# from  https://github.com/Carthage/Carthage/issues/3019#issuecomment-665136323

set -euo pipefail

xcconfig=$(mktemp /tmp/static.xcconfig.XXXXXX)
trap 'rm -f "$xcconfig"' INT TERM HUP EXIT

# For Xcode 12 make sure EXCLUDED_ARCHS is set to arm architectures otherwise
# the build will fail on lipo due to duplicate architectures.
echo 'EXCLUDED_ARCHS__EFFECTIVE_PLATFORM_SUFFIX_simulator__NATIVE_ARCH_64_BIT_x86_64__XCODE_1200 = arm64 arm64e armv7 armv7s armv6 armv8' >> $xcconfig
echo 'EXCLUDED_ARCHS = i386 $(inherited) $(EXCLUDED_ARCHS__EFFECTIVE_PLATFORM_SUFFIX_$(EFFECTIVE_PLATFORM_SUFFIX)__NATIVE_ARCH_64_BIT_$(NATIVE_ARCH_64_BIT)__XCODE_$(XCODE_VERSION_MAJOR))' >> $xcconfig

# line added to get around AWSAuth failure as discussed at
# https://github.com/aws-amplify/aws-sdk-ios/issues/2906#issuecomment-679385066
echo 'IPHONEOS_DEPLOYMENT_TARGET=9.0' >> $xcconfig
export XCODE_XCCONFIG_FILE="$xcconfig"
carthage "$@"
palpatim commented 4 years ago

Hi all, this should be fixed with the 2.17.0 release, which now uses a Carthage build step similar to what @BrandonSmith and a few others have posted that updates EXCLUDED_ARCHS for the various Xcode 12 simulator platforms.

Please note that this release includes a couple of breaking changes, one directly related to supporting Xcode 12 (we no longer ship the libAWSCognitoIdentityProviderASFBinary.a static library. This won't affect most customers, since most projects don't directly depend on the AWSCognitoIdentityProviderASF framework. However, if you do depend directly on AWSCognitoIdentityProviderASF, make sure you remove any project references to that static library and link to the framework instead.

Please let us know if you have any questions.

palpatim commented 4 years ago

Related to #2927.

factotvm commented 4 years ago

I upgraded and am now unblocked. Thank you.

WarSunsOfPeace commented 3 years ago

I was able to build with this using carthage and xcode 12, thanks!

nebillo commented 3 years ago

I'm still getting the same error with the latest Xcode (12A7300), carthage (0.36.0) and AWS sdk (2.17.0)

Running this: carthage update aws-sdk-ios --platform iOS --configuration Release --no-use-binaries

Produces the following error:

*** Building scheme "AWSAPIGateway" in AWSiOSSDKv2.xcodeproj
Build Failed
    Task failed with exit code 1:
    /usr/bin/xcrun lipo -create /Users/nebil/Library/Caches/org.carthage.CarthageKit/DerivedData/12.0.1_12A7300/aws-sdk-ios/2.17.0/Build/Intermediates.noindex/ArchiveIntermediates/AWSAPIGateway/IntermediateBuildFilesPath/UninstalledProducts/iphoneos/AWSAPIGateway.framework/AWSAPIGateway /Users/nebil/Library/Caches/org.carthage.CarthageKit/DerivedData/12.0.1_12A7300/aws-sdk-ios/2.17.0/Build/Products/Release-iphonesimulator/AWSAPIGateway.framework/AWSAPIGateway -output /Users/nebil/Code/aws_demo/Carthage/Build/iOS/AWSAPIGateway.framework/AWSAPIGateway

This usually indicates that project itself failed to compile. Please check the xcodebuild log for more details: /var/folders/rt/zfyj9sw94tggp4ln635bxs6w0000gn/T/carthage-xcodebuild.8kcV77.log

I have a tested this on both an existing and brand new project, with Cartfile: github "aws-amplify/aws-sdk-ios" == 2.17.0

what am I missing?

nourahassan commented 3 years ago

I'm still getting the same error with the latest Xcode (12A7300), carthage (0.36.0) and AWS sdk (2.17.0)

Running this: carthage update aws-sdk-ios --platform iOS --configuration Release --no-use-binaries

Produces the following error:

*** Building scheme "AWSAPIGateway" in AWSiOSSDKv2.xcodeproj
Build Failed
  Task failed with exit code 1:
  /usr/bin/xcrun lipo -create /Users/nebil/Library/Caches/org.carthage.CarthageKit/DerivedData/12.0.1_12A7300/aws-sdk-ios/2.17.0/Build/Intermediates.noindex/ArchiveIntermediates/AWSAPIGateway/IntermediateBuildFilesPath/UninstalledProducts/iphoneos/AWSAPIGateway.framework/AWSAPIGateway /Users/nebil/Library/Caches/org.carthage.CarthageKit/DerivedData/12.0.1_12A7300/aws-sdk-ios/2.17.0/Build/Products/Release-iphonesimulator/AWSAPIGateway.framework/AWSAPIGateway -output /Users/nebil/Code/aws_demo/Carthage/Build/iOS/AWSAPIGateway.framework/AWSAPIGateway

This usually indicates that project itself failed to compile. Please check the xcodebuild log for more details: /var/folders/rt/zfyj9sw94tggp4ln635bxs6w0000gn/T/carthage-xcodebuild.8kcV77.log

I have a tested this on both an existing and brand new project, with Cartfile: github "aws-amplify/aws-sdk-ios" == 2.17.0

what am I missing?

Use the carthage script here to fix the lipo error

stale[bot] commented 3 years ago

This issue has been automatically closed because of inactivity. Please open a new issue if are still encountering problems.