Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pre-built XCFrameworks cannot be used with Xcode 14.3 / Swift 5.8 #2180

Open
5 tasks done
username0x0a opened this issue Feb 18, 2023 · 14 comments
Open
5 tasks done

Pre-built XCFrameworks cannot be used with Xcode 14.3 / Swift 5.8 #2180

username0x0a opened this issue Feb 18, 2023 · 14 comments

Comments

@username0x0a
Copy link

username0x0a commented Feb 18, 2023

Checklist before submitting a bug report

Xcode version

14.3 Beta

Facebook iOS SDK version

16.0.0

Dependency Manager

Prebuilt Binaries

SDK Framework

Core

Goals

Compile a project with pre-built Facebook SDKs linked.

Expected results

The project compiles successfully.

Actual results

I'm getting a following error:

.../FacebookAnalyticsWrapper.swift:4:8 Failed to build module 'FBSDKCoreKit'; this SDK is not supported by the compiler
(the SDK is built with 'Apple Swift version 5.7.2 (swiftlang-5.7.2.135.5 clang-1400.0.29.51)', 
while this compiler is 'Apple Swift version 5.8 (swiftlang-5.8.0.117.11 clang-1403.0.22.8.60)').
Please select a toolchain which matches the SDK.

The same applies to 15.1.0 binaries complaining about being built with Swift 5.6. In both cases, both Static and Dynamic ones result in this error.

As the configuration seems to already use BUILD_LIBRARY_FOR_DISTRIBUTION=YES, I have really no quick idea how to solve this. 🤔 SKIP_INSTALL=NO could have some potential, but I can't really say…

Testing

Test case here would be a successful linking in a project with both Xcode 14.2 and 14.3.

Escalation

I know that Xcode 14.3 is still in Beta, but I guess this needs to be addressed ASAP, on top of that I've got no issues with other pre-built SDKs like Firebase for example, which means that something's already wrong with the XCFrameworks distribution setup that would cause this issue regularly with Apple updating the compiler version in Xcode.

@sunlighing
Copy link

image
/Users/triwin/liveBingoWork/Xcode/Libraries/FacebookSDK/SDK/Editor/iOS/Swift/FBSDKTournamentUpdater.swift:21:8: Failed to build module 'FBSDKCoreKit'; this SDK is not supported by the compiler (the SDK is built with 'Apple Swift version 5.7.2 (swiftlang-5.7.2.135.5 clang-1400.0.29.51)', while this compiler is 'Apple Swift version 5.6 (swiftlang-5.6.0.323.62 clang-1316.0.20.8)'). Please select a toolchain which matches the SDK.

same issue ,where 5.6 compiler

@ecant
Copy link

ecant commented Feb 28, 2023

Experiencing the same issue with Xcode 14.3 Beta 1 and Beta 2:

Failed to build module 'FBSDKCoreKit'; 
this SDK is not supported by the compiler (the SDK is built with 'Apple Swift 
version 5.7.2 (swiftlang-5.7.2.135.5 clang-1400.0.29.51)', while this compiler 
is 'Apple Swift version 5.8 (swiftlang-5.8.0.119.11 clang-1403.0.22.11.100)'). 
Please select a toolchain which matches the SDK.

@NigamAnkit
Copy link

NigamAnkit commented Mar 4, 2023

Same issue with Xcode 14.3 Beta 2.
#2186

@username0x0a
Copy link
Author

@sunlighing: Your issue looks similar, but is actually different – you can't use frameworks built by a newer Swift compiler version in Xcode/app using an older compiler version. Basically tl;dr: the newer compiler may generate chunks in the Swift module interface potentially not yet known by your (older) compiler version, so Library distribution only allows the framework to be consumed by the same or newer compiler version.

For the other guys: it won't differ with future Betas 'cause there's an issue with Library distribution/Module compatibility in place. The weird thing here is it complains about FBSDKCoreKit which has Swift interface included while I'd rather expect FBSDKCoreKit_Basics to be an issue as that one doesn't 🤔 but we'll see what Facebook devs have to say about the setup.

@SunZhiC
Copy link

SunZhiC commented Mar 8, 2023

There is a work around for cocoapods, add these code to Podfile

post_install do |installer|

  installer.pods_project.targets.each do |target|
    target.build_configurations.each do |config|
      config.build_settings['BUILD_LIBRARY_FOR_DISTRIBUTION'] = 'YES'
    end
  end
end

It works with FBSDK 16.0 and Xcode Version 14.3 beta 2 (14E5207e)

@Dimillian
Copy link

This workaround is not working on the RC for us. With version 15 & 16.

@username0x0a
Copy link
Author

username0x0a commented Mar 27, 2023

Well, isn't CocoaPods building the libs from source? 🤔 In that case, the workaround isn't really needed…

TL;DR: SKIP_INSTALL=NO and BUILD_LIBRARY_FOR_DISTRIBUTION=YES needs to be set properly for building (in Xcode 14.2 so that it's then working with 14.2 and 14.3 as well); in this case in the xcconfig files. 👍 The patch/fix should be quite easy here, but I'll verify it in my setup first.

@raxityo
Copy link

raxityo commented Mar 27, 2023

This issue has been fixed in Xcode 14.3 RC2. The app compiles and builds successfully for me 🎉

From the Relese Notes:

Fixed: The Swift compiler may fail to build modules for XCFramework dependencies that were built with BUILD_LIBRARY_FOR_DISTRIBUTION enabled. These failures will occur when the XCFramework contains public Swift declarations that have @MainActor constraints implicitly added, such as subclasses of UIView or NSView. The Swift compiler expects those declarations to be marked @available for an operating system version where Swift concurrency is available.
(105610970)

@paulb777
Copy link

We see the same issue building binary xcframeworks for distribution with Xcode 14.1 and are considering continuing to build our binary distributions with Xcode 13.3.1 - firebase/firebase-ios-sdk#11010

@username0x0a
Copy link
Author

username0x0a commented Mar 28, 2023

@paulb777 Weeeell…Apple will make it simple for us (with 14.1 minimum requirement), as every year. 😄

https://twitter.com/9to5mac/status/1640772265787760640

@pastelcode
Copy link

Hi!! Any solution on this? 😭

@Rokon-556
Copy link

I am facing the same issue with Xcode 13.2

@shahbazhashmi
Copy link

Cocoapod version 1.11.3 works for me

@vijaycoderkube
Copy link

Can we resolve this issue by using the same Xcode version 13.2.1?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

13 participants