AppsFlyerSDK / segment-appsflyer-ios

The AppsFlyer iOS SDK integration with Segment
https://segment.com/docs/integrations/appsflyer/
MIT License
23 stars 59 forks source link

Carthage #44

Closed ochornenko closed 1 year ago

ochornenko commented 3 years ago

Building a Swift project is failing if using Carthage

github "segmentio/analytics-ios"
github "AppsFlyerSDK/segment-appsflyer-ios" "6.1.2"
*** Building scheme "segment-appsflyer-ios" in segment-appsflyer-ios.xcodeproj
Build Failed
    Task failed with exit code 65:
    /usr/bin/xcrun xcodebuild -project /Users/proj/dev/Carthage/Checkouts/segment-appsflyer-ios/segment-appsflyer-ios.xcodeproj -scheme segment-appsflyer-ios -configuration Release -derivedDataPath /Users/proj/Library/Caches/org.carthage.CarthageKit/DerivedData/12.3_12C33/segment-appsflyer-ios/6.1.2 -sdk iphoneos ONLY_ACTIVE_ARCH=NO CODE_SIGNING_REQUIRED=NO CODE_SIGN_IDENTITY= CARTHAGE=YES archive -archivePath /var/folders/pm/v626bjt51cg6zmqb2bp95yjw0000gn/T/segment-appsflyer-ios SKIP_INSTALL=YES GCC_INSTRUMENT_PROGRAM_FLOW_ARCS=NO CLANG_ENABLE_CODE_COVERAGE=NO STRIP_INSTALLED_PRODUCT=NO (launched in /Users/proj/dev/Carthage/Checkouts/segment-appsflyer-ios)

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

I need to open segment-appsflyer-ios.xcodeproj project in Carthage/Checkouts folder and replace manually Analytics.framework with Segment.framework and then build project again

af-margot commented 3 years ago

Hi @ochornenko,

Thank you for the message. We will check this and get back to you soon!

af-margot commented 3 years ago

Hi, Could you try now with github "AppsFlyerSDK/segment-appsflyer-ios" "master" ?

ochornenko commented 3 years ago

Hi @af-margot I tried github "AppsFlyerSDK/segment-appsflyer-ios" "master" but still getting an error, I'm using Xcode 12.3

*** Building scheme "segment-appsflyer-ios" in segment-appsflyer-ios.xcodeproj
Build Failed
    Task failed with exit code 65:
    /usr/bin/xcrun xcodebuild -project /Users/oleg/dev/slap-ios/Carthage/Checkouts/segment-appsflyer-ios/segment-appsflyer-ios.xcodeproj -scheme segment-appsflyer-ios -configuration Release -derivedDataPath /Users/oleg/Library/Caches/org.carthage.CarthageKit/DerivedData/12.3_12C33/segment-appsflyer-ios/6a9a2509ceb1db6ef5e9a344eefb76d0bda795a1 -sdk iphoneos ONLY_ACTIVE_ARCH=NO CODE_SIGNING_REQUIRED=NO CODE_SIGN_IDENTITY= CARTHAGE=YES archive -archivePath /var/folders/pm/v626bjt51cg6zmqb2bp95yjw0000gn/T/segment-appsflyer-ios SKIP_INSTALL=YES GCC_INSTRUMENT_PROGRAM_FLOW_ARCS=NO CLANG_ENABLE_CODE_COVERAGE=NO STRIP_INSTALLED_PRODUCT=NO (launched in /Users/oleg/dev/slap-ios/Carthage/Checkouts/segment-appsflyer-ios)

This usually indicates that project itself failed to compile. Please check the xcodebuild log for more details: /var/folders/pm/v626bjt51cg6zmqb2bp95yjw0000gn/T/carthage-xcodebuild.fsjWBp.log
af-margot commented 3 years ago

Hi @ochornenko,

Not able to reproduce the issue this time. I'm using Xcode 12.2, so it should be good also for 12.3. Did you try deleting the cache rm -rf ~/Library/Caches/org.carthage.CarthageKit ?

ochornenko commented 3 years ago

@af-margot deleting cache rm -rf ~/Library/Caches/org.carthage.CarthageKit did not help, but I'm able to build it if I change Embed Without Signing to Do Not Embed for Frameworks and Libraries as on screenshot below

Screen Shot 2020-12-23 at 7 57 47 PM
af-margot commented 3 years ago

Hi @ochornenko, In order to get segment-Appsflyer-iOS, please add segment-appsflyer-ios frameowrk from Carthage/Build/iOS/ Xnip2020-12-24_11-31-40

af-margot commented 3 years ago

Hi @ochornenko, Did you manage to make it work?

ochornenko commented 3 years ago

Hi @af-margot I tried github "AppsFlyerSDK/segment-appsflyer-ios" "6.1.4" and I still need to change manually to "Do Not Embed" in order to build my project successfully

Screen Shot 2021-01-21 at 11 27 05 PM
shilmista commented 3 years ago

This is an issue we've been seeing with the latest AppsFlyer and Segment integration as well, with 6.1.4. We were on 6.0.3, which still compiles fine but the latest gives us this issue:

*** Building scheme "segment-appsflyer-ios" in segment-appsflyer-ios.xcodeproj
Build Failed
    Task failed with exit code 65:
    /usr/bin/xcrun xcodebuild -project /Users/Shared/web/mobile-iossdk/Swift/Carthage/Checkouts/segment-appsflyer-ios/segment-appsflyer-ios.xcodeproj -scheme segment-appsflyer-ios -configuration Release -derivedDataPath /Users/tcheng/Library/Caches/org.carthage.CarthageKit/DerivedData/12.2_12B45b/segment-appsflyer-ios/6.1.4 -sdk iphoneos ONLY_ACTIVE_ARCH=NO CODE_SIGNING_REQUIRED=NO CODE_SIGN_IDENTITY= CARTHAGE=YES archive -archivePath /var/folders/tb/hfld97_n1jqdl41nc07416_n9f1tdn/T/segment-appsflyer-ios SKIP_INSTALL=YES GCC_INSTRUMENT_PROGRAM_FLOW_ARCS=NO CLANG_ENABLE_CODE_COVERAGE=NO STRIP_INSTALLED_PRODUCT=NO (launched in /Users/Shared/web/mobile-iossdk/Swift/Carthage/Checkouts/segment-appsflyer-ios)

This usually indicates that project itself failed to compile. Please check the xcodebuild log for more details: /var/folders/tb/hfld97_n1jqdl41nc07416_n9f1tdn/T/carthage-xcodebuild.AiXIqx.log
af-margot commented 3 years ago

Hi @shilmista,

Could you check now?

shilmista commented 3 years ago

@af-margot I just tried again and got the same issue with 6.1.4. These are the logs I see with Carthage 0.36.1

Ld /Users/tcheng/Library/Caches/org.carthage.CarthageKit/DerivedData/12.2_12B45b/segment-appsflyer-ios/6.1.4/Build/Intermediates.noindex/ArchiveIntermediates/segment-appsflyer-ios/IntermediateBuildFilesPath/UninstalledProducts/iphoneos/SegmentAppsFlyeriOS.framework/SegmentAppsFlyeriOS normal (in target 'segment-appsflyer-ios' from project 'segment-appsflyer-ios')
    cd /Users/Shared/web/mobile-iossdk/Swift/Carthage/Checkouts/segment-appsflyer-ios
    /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang -target arm64-apple-ios12.0 -dynamiclib -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS14.2.sdk -L/Users/tcheng/Library/Caches/org.carthage.CarthageKit/DerivedData/12.2_12B45b/segment-appsflyer-ios/6.1.4/Build/Intermediates.noindex/ArchiveIntermediates/segment-appsflyer-ios/BuildProductsPath/Release-iphoneos -F/Users/tcheng/Library/Caches/org.carthage.CarthageKit/DerivedData/12.2_12B45b/segment-appsflyer-ios/6.1.4/Build/Intermediates.noindex/ArchiveIntermediates/segment-appsflyer-ios/BuildProductsPath/Release-iphoneos -F/Users/Shared/web/mobile-iossdk/Swift/Carthage/Checkouts/segment-appsflyer-ios/Carthage/Build/iOS -F/Users/Shared/web/mobile-iossdk/Swift/Carthage/Checkouts/segment-appsflyer-ios/Carthage/Build/iOS/Static -filelist /Users/tcheng/Library/Caches/org.carthage.CarthageKit/DerivedData/12.2_12B45b/segment-appsflyer-ios/6.1.4/Build/Intermediates.noindex/ArchiveIntermediates/segment-appsflyer-ios/IntermediateBuildFilesPath/segment-appsflyer-ios.build/Release-iphoneos/segment-appsflyer-ios.build/Objects-normal/arm64/SegmentAppsFlyeriOS.LinkFileList -install_name @rpath/SegmentAppsFlyeriOS.framework/SegmentAppsFlyeriOS -Xlinker -rpath -Xlinker @executable_path/Frameworks -Xlinker -rpath -Xlinker @loader_path/Frameworks -dead_strip -Xlinker -object_path_lto -Xlinker /Users/tcheng/Library/Caches/org.carthage.CarthageKit/DerivedData/12.2_12B45b/segment-appsflyer-ios/6.1.4/Build/Intermediates.noindex/ArchiveIntermediates/segment-appsflyer-ios/IntermediateBuildFilesPath/segment-appsflyer-ios.build/Release-iphoneos/segment-appsflyer-ios.build/Objects-normal/arm64/SegmentAppsFlyeriOS_lto.o -fembed-bitcode -Xlinker -bitcode_verify -Xlinker -bitcode_hide_symbols -Xlinker -bitcode_symbol_map -Xlinker /Users/tcheng/Library/Caches/org.carthage.CarthageKit/DerivedData/12.2_12B45b/segment-appsflyer-ios/6.1.4/Build/Intermediates.noindex/ArchiveIntermediates/segment-appsflyer-ios/BuildProductsPath/Release-iphoneos -fobjc-arc -fobjc-link-runtime -framework Segment -framework AppsFlyerLib -compatibility_version 1 -current_version 1 -Xlinker -dependency_info -Xlinker /Users/tcheng/Library/Caches/org.carthage.CarthageKit/DerivedData/12.2_12B45b/segment-appsflyer-ios/6.1.4/Build/Intermediates.noindex/ArchiveIntermediates/segment-appsflyer-ios/IntermediateBuildFilesPath/segment-appsflyer-ios.build/Release-iphoneos/segment-appsflyer-ios.build/Objects-normal/arm64/SegmentAppsFlyeriOS_dependency_info.dat -o /Users/tcheng/Library/Caches/org.carthage.CarthageKit/DerivedData/12.2_12B45b/segment-appsflyer-ios/6.1.4/Build/Intermediates.noindex/ArchiveIntermediates/segment-appsflyer-ios/IntermediateBuildFilesPath/UninstalledProducts/iphoneos/SegmentAppsFlyeriOS.framework/SegmentAppsFlyeriOS
ld: framework not found Segment
clang: error: linker command failed with exit code 1 (use -v to see invocation)

** ARCHIVE FAILED **

The following build commands failed:
    Ld /Users/tcheng/Library/Caches/org.carthage.CarthageKit/DerivedData/12.2_12B45b/segment-appsflyer-ios/6.1.4/Build/Intermediates.noindex/ArchiveIntermediates/segment-appsflyer-ios/IntermediateBuildFilesPath/UninstalledProducts/iphoneos/SegmentAppsFlyeriOS.framework/SegmentAppsFlyeriOS normal
(1 failure)
af-margot commented 3 years ago

Hi @shilmista ,

If you use XCode 12, could you test the following:

  1. clear cache with rm -rf ~/Library/Caches/org.carthage.CarthageKit
  2. run ./carthage.sh update --platform iOS with carthage.sh the following script :

carthage.sh

Usage example: ./carthage.sh build --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.

echo 'EXCLUDED_ARCHSEFFECTIVE_PLATFORM_SUFFIX_simulator__NATIVE_ARCH_64_BIT_x86_64XCODE_1200 = arm64 arm64e armv7 armv7s armv6 armv8' >> $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" carthage "$@"


( full solution with the script [here)](https://github.com/Carthage/Carthage/issues/3019#issuecomment-665136323)
mikebernardo commented 3 years ago

I'm having a similar but different error during the Carthage copy-frameworks phase with both master and 6.2.0. Carthage's re-signing is failing on AppsFlyerLib.framework:

"AppsFlyerLib.framework: bundle format unrecognized, invalid, or unsuitable"

Is anyone able to build with Carthage? @af-margot any ideas?

(Xcode 12.4)

EDIT (RESOLVED):

I was able to resolve this issue with AppsFlyerLib. If you follow the Carthage instructions here: https://github.com/Carthage/Carthage#if-youre-building-for-ios-tvos-or-watchos

It describes adding the frameworks added to your app to input.xcfilelist and output.xcfilelist to be used for the Carthage 'copy frameworks' build phase.

Add Segment and SegmentAppsFlyeriOS frameworks, but DO NOT add AppsFlyerLib since it's not really a framework. It's a static library. So it should just be added to the linked libraries with the "Do Not Embed" option and that's all.

This seems to work for me.

morisgateno-appsflyer commented 1 year ago

Hi @ochornenko . Carthage is not supported anymore.. Sorry for the inconvenience. Thanks. Moris Gateno