facebook / facebook-ios-sdk

Used to integrate the Facebook Platform with your iOS & tvOS apps.
https://developers.facebook.com/docs/ios
Other
7.8k stars 3.56k forks source link

Build failed in Carthage #1822

Closed 417-72KI closed 3 years ago

417-72KI commented 3 years ago

Checklist before submitting a bug report

Xcode version

12.5.1

Swift version

No response

Installation platform & version

Carthage 0.36.0 ~ 0.38.0

Package

Other / I don't know

Goals

Use latest version of this SDK with Carthage

Expected results

Succeed to build via Carthage

Actual results

A shell task (/usr/bin/xcrun xcodebuild -project path/to/project/Carthage/Checkouts/facebook-ios-sdk/samples/SmoketestSPM/SmoketestSPM.xcodeproj CODE_SIGNING_REQUIRED=NO CODE_SIGN_IDENTITY= CARTHAGE=YES -list) failed with exit code 74:
xcodebuild: error: Could not resolve package dependencies:
  target 'FBSDKShareKit' has invalid header layout: umbrella header found at '/Users/user/Library/Developer/Xcode/DerivedData/SmoketestSPM-amvioqbeeblqvjghektrpvezsxje/SourcePackages/checkouts/facebook-ios-sdk/FBSDKShareKit/FBSDKShareKit/include/FBSDKShareKit.h', but directories exist next to it: /Users/user/Library/Developer/Xcode/DerivedData/SmoketestSPM-amvioqbeeblqvjghektrpvezsxje/SourcePackages/checkouts/facebook-ios-sdk/FBSDKShareKit/FBSDKShareKit/include/include; consider removing them
  target 'FBSDKLoginKit' has invalid header layout: umbrella header found at '/Users/user/Library/Developer/Xcode/DerivedData/SmoketestSPM-amvioqbeeblqvjghektrpvezsxje/SourcePackages/checkouts/facebook-ios-sdk/FBSDKLoginKit/FBSDKLoginKit/include/FBSDKLoginKit.h', but directories exist next to it: /Users/user/Library/Developer/Xcode/DerivedData/SmoketestSPM-amvioqbeeblqvjghektrpvezsxje/SourcePackages/checkouts/facebook-ios-sdk/FBSDKLoginKit/FBSDKLoginKit/include/include; consider removing them

Steps to reproduce

Cartfile.resolved

github "facebook/facebook-ios-sdk" "v11.1.0"

Script to run

#!/usr/bin/env bash

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

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.
for simulator in iphonesimulator appletvsimulator; do
    echo "EXCLUDED_ARCHS__EFFECTIVE_PLATFORM_SUFFIX_${simulator}__NATIVE_ARCH_64_BIT_x86_64__XCODE_1200 = arm64 arm64e armv7 armv7s armv6 armv8" >> $xcconfig
done
echo 'EXCLUDED_ARCHS = $(inherited) $(EXCLUDED_ARCHS__EFFECTIVE_PLATFORM_SUFFIX_$(PLATFORM_NAME)__NATIVE_ARCH_64_BIT_$(NATIVE_ARCH_64_BIT)__XCODE_$(XCODE_VERSION_MAJOR))' >> $xcconfig

export XCODE_XCCONFIG_FILE="$xcconfig"
cat $XCODE_XCCONFIG_FILE
mint run Carthage carthage "$@"

command

path/to/carthage-build.sh bootstrap --platform iOS --no-use-binaries --cache-builds facebook-ios-sdk
jawwad commented 3 years ago

Hi @417-72KI - What version of carthage are you using? With 0.38 I wasn't able to reproduce the error you are getting. I used your script and the only change I mad was to use carthage instead of mint run Carthage carthage.

carthage-build.sh bootstrap --platform iOS --no-use-binaries --cache-builds facebook-ios-sdk
EXCLUDED_ARCHS__EFFECTIVE_PLATFORM_SUFFIX_iphonesimulator__NATIVE_ARCH_64_BIT_x86_64__XCODE_1200 = arm64 arm64e armv7 armv7s armv6 armv8
EXCLUDED_ARCHS__EFFECTIVE_PLATFORM_SUFFIX_appletvsimulator__NATIVE_ARCH_64_BIT_x86_64__XCODE_1200 = arm64 arm64e armv7 armv7s armv6 armv8
EXCLUDED_ARCHS = $(inherited) $(EXCLUDED_ARCHS__EFFECTIVE_PLATFORM_SUFFIX_$(PLATFORM_NAME)__NATIVE_ARCH_64_BIT_$(NATIVE_ARCH_64_BIT)__XCODE_$(XCODE_VERSION_MAJOR))
*** Checking out facebook-ios-sdk at "v11.1.0"
*** No cache found for facebook-ios-sdk, building with all downstream dependencies
*** xcodebuild output can be found in /var/folders/v4/dl0hd2056gvg22yrtf919v_80000gn/T/carthage-xcodebuild.3UoLsD.log
*** Building scheme "FBAEMKit" in FacebookSDK.xcworkspace
*** Building scheme "FBSDKCoreKit_Basics-Dynamic" in FacebookSDK.xcworkspace
*** Building scheme "FBAEMKit-Dynamic" in FacebookSDK.xcworkspace
*** Building scheme "FBSDKCoreKit" in FacebookSDK.xcworkspace
*** Building scheme "FBSDKCoreKit-Dynamic" in FacebookSDK.xcworkspace
*** Building scheme "FacebookGamingServices-Dynamic" in FacebookSDK.xcworkspace
*** Building scheme "FBSDKGamingServicesKit" in FacebookSDK.xcworkspace
*** Building scheme "FBSDKGamingServicesKit-Dynamic" in FacebookSDK.xcworkspace
*** Building scheme "LegacyGamingServices-Dynamic" in FacebookSDK.xcworkspace
*** Building scheme "FBSDKShareKit" in FacebookSDK.xcworkspace
*** Building scheme "FBSDKShareKit-Dynamic" in FacebookSDK.xcworkspace
*** Building scheme "FBSDKLoginKit" in FacebookSDK.xcworkspace
*** Building scheme "FBSDKLoginKit-Dynamic" in FacebookSDK.xcworkspace

@joesus - Any ideas?

417-72KI commented 3 years ago

@jawwad I tried with 0.36, 0.37, and 0.38 and each versions failed with same error.

aakarsh-sasi commented 3 years ago

Same issue as #1891

jawwad commented 3 years ago

Hi @417-72KI and @aakarsh-sasi,

We just released v12.0.0 of the iOS SDK. Could you see if updating to v12.0.0 fixes this issue for you?

Note: You'll have to migrate your project to use XCFrameworks as mentioned in the changelog: https://github.com/facebook/facebook-ios-sdk/blob/main/CHANGELOG.md#1200

The changelog will refer you to this page: https://github.com/Carthage/Carthage#migrating-a-project-from-framework-bundles-to-xcframeworks

Here's a screenshot of the relevant section on that page: image

jawwad commented 3 years ago

Closing this since v12.0.0 should fix this issue. Please comment or re-open if there are still issues.

aakarsh-sasi commented 3 years ago

Hi @jawwad,

Thanks, this is working fine now. But building from source still fails with this issue:

   Falling back to building from the source
A shell task (XXXX/XXXX/Carthage/Checkouts/facebook-ios-sdk/samples/SmoketestSPM/SmoketestSPM.xcodeproj CODE_SIGNING_REQUIRED=NO CODE_SIGN_IDENTITY= CARTHAGE=YES -list) failed with exit code 74:
xcodebuild: error: Could not resolve package dependencies:
  could not find a branch named ‘HEAD’ in https://github.com/facebook/facebook-ios-sdk
remover commented 3 years ago

Hi @jawwad,

Thanks, this is working fine now. But building from source still fails with this issue:

   Falling back to building from the source
A shell task (XXXX/XXXX/Carthage/Checkouts/facebook-ios-sdk/samples/SmoketestSPM/SmoketestSPM.xcodeproj CODE_SIGNING_REQUIRED=NO CODE_SIGN_IDENTITY= CARTHAGE=YES -list) failed with exit code 74:
xcodebuild: error: Could not resolve package dependencies:
  could not find a branch named ‘HEAD’ in https://github.com/facebook/facebook-ios-sdk

same issue here :(