facebook / facebook-ios-sdk

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

Building from source failing when using Carthage (due to SmokeTestSPM.xcodeproj) #1891

Closed aakarsh-sasi closed 3 years ago

aakarsh-sasi commented 3 years ago

Checklist before submitting a bug report

Xcode version

12.5.1

Swift version

5.4.2

Installation platform & version

Carthage

Package

Other / I don't know

Goals

Build framework successfully with carthage from source

Expected results

Run ./carthage.sh bootstrap --platform iOS --no-use-binaries and build from source

image

Actual results

image

Steps to reproduce

Cartfile github "facebook/facebook-ios-sdk" "v9.1.0"

Cartfile.resolved github "facebook/facebook-ios-sdk" "v9.1.0"

  1. Run ./carthage.sh bootstrap --platform iOS --no-use-binaries

Code samples & details

On debugging I found that the issue was with the SmokeTestSPM.xcodeproj. It is not able to resolve package dependencies and hence the project is failing to build, which is leading to the sdk failing to build itself.

![image](https://user-images.githubusercontent.com/77329844/134102788-63d333c5-3b0d-4773-9401-738928b61398.png)

1) My question is why does Carthage build SmokeTestSPM.xcodeproj since its not a part of any SDK.

2) Also, on changing the branch here from "HEAD" to "main", fixed the build issue. If this change is done it will be really helpful. 

I'm currently using v9.1.0 but this is happening for the latest version as well. 
I created a fork, made the change to the branch and tried the carthage bootstrap command again and it worked.
aakarsh-sasi commented 3 years ago

image

jawwad commented 3 years ago

Hi @aakarsh-sasi,

Thank you for the very detailed issue report on this.

1) My question is why does Carthage build SmokeTestSPM.xcodeproj since its not a part of any SDK.

This this something I was looking into with @joesus, but we haven't figured it out yet. Also when we try to build it on our end we aren't able to re-produce the error so we are still not sure what is causing this.

2) Also, on changing the branch here from "HEAD" to "main", fixed the build issue. If this change is done it will be really helpful.

That's weird. I'm not sure why that would fix the issue. Since HEAD and main should refer to the same commit it shouldn't make a difference, but if that fixes it I think it should be ok to make that change on our end which we can make for the next release (scheduled for early October). cc @joesus.

joesus commented 3 years ago

Quick thoughts.

We've been working towards vending XCFrameworks starting in v12 so there should be no reason to build from source.

I'll work on deleting that job since it won't make much sense to keep once we're on v12.

In the meantime this is valid but also easy to work around by moving to Swift Package Manager or CocoaPods. If you must use Carthage then please try to use it with the option that lets you consume the prebuilt XCFrameworks attached to the release. See Carthage building from source was deprecated in v11.1.0 https://github.com/facebook/facebook-ios-sdk/blob/main/CHANGELOG.md#1110

Thanks!