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

Xcode 16 & iOS 18 Build Crash #892

Closed
5 tasks done
erisu opened this issue Aug 28, 2024 · 23 comments
Closed
5 tasks done

Xcode 16 & iOS 18 Build Crash #892

erisu opened this issue Aug 28, 2024 · 23 comments

Comments

@erisu
Copy link

erisu commented Aug 28, 2024

Bug report

CHECKLIST

  • I have reproduced the issue using the example project or provided the necessary information to reproduce the issue.
  • I have checked that no similar issues (open or closed) already exist.

Current behavior:

When attempting to build a project using this plugin with Xcode 16 beta, the build will crash with the following error:

/path/to/project/platforms/ios/Pods/BoringSSL-GRPC/src/ssl/tls_method.cc unsupported option '-G' for target 'arm64-apple-ios13.0-simulator'

This is a known issue which comes from a dependency that Firebase uses. This issue had been reported and fixed.

Firebase was also aware of the issue and updated their library which should have resolved this issue.

Below are the following tickets surrounding the issue.

Expected behavior:

Build should be successful.

Steps to reproduce:

Add current plugin to any project and try to build with Xcode 16 beta

Screenshots

Environment information

  • Cordova CLI version
    • 12.0.0
  • Cordova platform version
  • Plugins & versions installed in project (including this plugin)
  • Dev machine OS and version, e.g.
    • OSX
      • macOS 14.6.1 (23G93)

Runtime issue

  • Device details
    • iPhone 15 Pro Max Simulator
  • OS details
    • iOS 18.0 (22A5346a)

iOS build issue:

  • Node JS version
    • v22.6.0
  • XCode version
    • Xcode 16.0 - Build version 16A5230g

Other information:

There is a SO post that talked about the issue and included a workaround solution when there was no fix:

But looking at the Firebase library spec, I beleive the issue has been resolved in version 11.0.0. (Current version is 11.1.0)

The above linked issue tickets says:

Fixed in 1.65.2 and 1.66.0-pre1 release

Looking at the podspec of [email protected] it says gRPC-Core version is ~> 1.65.0. I believe this will pull in the fixed version.

@xavierserrai
Copy link

Dears,

What I did is add the workaround on https://stackoverflow.com/a/78633109 into scripts/ios/helper.js into the applyPodsPostInstall function.

The new code added:

if target.name == 'BoringSSL-GRPC'
         target.source_build_phase.files.each do |file|
             if file.settings && file.settings['COMPILER_FLAGS']
                 flags = file.settings['COMPILER_FLAGS'].split
                 flags.reject! { |flag| flag == '-GCC_WARN_INHIBIT_ALL_WARNINGS' }
                 file.settings['COMPILER_FLAGS'] = flags.join(' ')
             end
         end
     end

The resulting function:

    applyPodsPostInstall: function(pluginVariables, iosPlatform){
        var podFileModified = false,
            podFilePath = iosPlatform.podFile,
            podFile = fs.readFileSync(path.resolve(podFilePath)).toString(),
            DEBUG_INFORMATION_FORMAT = pluginVariables['IOS_STRIP_DEBUG'] && pluginVariables['IOS_STRIP_DEBUG'] === 'true' ? 'dwarf' : 'dwarf-with-dsym',
            IPHONEOS_DEPLOYMENT_TARGET = podFile.match(iosDeploymentTargetPodRegEx)[1];

        if(!podFile.match('post_install')){
            podFile += `
post_install do |installer|
    installer.pods_project.targets.each do |target|
        target.build_configurations.each do |config|
            config.build_settings['DEBUG_INFORMATION_FORMAT'] = '${DEBUG_INFORMATION_FORMAT}'
            config.build_settings['IPHONEOS_DEPLOYMENT_TARGET'] = '${IPHONEOS_DEPLOYMENT_TARGET}'
            if target.respond_to?(:product_type) and target.product_type == "com.apple.product-type.bundle"
                config.build_settings['CODE_SIGNING_ALLOWED'] = 'NO'
            end
        end
        if target.name == 'BoringSSL-GRPC'
            target.source_build_phase.files.each do |file|
                if file.settings && file.settings['COMPILER_FLAGS']
                    flags = file.settings['COMPILER_FLAGS'].split
                    flags.reject! { |flag| flag == '-GCC_WARN_INHIBIT_ALL_WARNINGS' }
                    file.settings['COMPILER_FLAGS'] = flags.join(' ')
                end
            end
        end
    end
end
                `;
            fs.writeFileSync(path.resolve(podFilePath), podFile);
            utilities.log('cordova-plugin-firebasex: Applied post install block to Podfile');
            podFileModified = true;
        }
        return podFileModified;
    },

Hope it helps.

@franfrLor
Copy link

if target.name == 'BoringSSL-GRPC'
target.source_build_phase.files.each do |file|
if file.settings && file.settings['COMPILER_FLAGS']
flags = file.settings['COMPILER_FLAGS'].split
flags.reject! { |flag| flag == '-GCC_WARN_INHIBIT_ALL_WARNINGS' }
file.settings['COMPILER_FLAGS'] = flags.join(' ')
end
end
end

How can we add this?
Do we need to make a new version of the firebasex plugin?
I tried to add the code directly in the Podfile on XCode but still build failed.

@garethedwards
Copy link

How can we add this? Do we need to make a new version of the firebasex plugin?
I tried to add the code directly in the Podfile on XCode but still build failed.

Same here - tried adding it to the helper.js as @xavierserrai recommended and even directly to the Podfile, and neither worked for me.
The build output always shows that it's adding the offending flag, suggesting it's not taking any notice of the altered Podfile
Right now I can't build without removing the Firebase plugin

Any other suggestions greatly welcome

@franfrLor
Copy link

How can we add this? Do we need to make a new version of the firebasex plugin?
I tried to add the code directly in the Podfile on XCode but still build failed.

Same here - tried adding it to the helper.js as @xavierserrai recommended and even directly to the Podfile, and neither worked for me. The build output always shows that it's adding the offending flag, suggesting it's not taking any notice of the altered Podfile Right now I can't build without removing the Firebase plugin

Any other suggestions greatly welcome

I just modified the sh file directly in vscode and it worked.

@garethedwards
Copy link

How can we add this? Do we need to make a new version of the firebasex plugin?
I tried to add the code directly in the Podfile on XCode but still build failed.

Same here - tried adding it to the helper.js as @xavierserrai recommended and even directly to the Podfile, and neither worked for me. The build output always shows that it's adding the offending flag, suggesting it's not taking any notice of the altered Podfile Right now I can't build without removing the Firebase plugin
Any other suggestions greatly welcome

I just modified the sh file directly in vscode and it worked.

Sorry - which sh file was that?

@franfrLor
Copy link

scripts/ios/helper.js

src-cordova/plugins/cordova-plugin-firebasex/scripts/ios/helper.js

@yann-intuitisoft
Copy link

thank you so much. Works for me.
I have created the pull request #893

@Rodedrengen
Copy link

As far as I can see the problem occurs becuase of this issue, in BoringSSL-GRPC grpc/grpc#36904.
This is released in BoringSSL-GRPC 0.0.36.

Cordova-plugin-firebasex 16.5.0, is adding a pod called FirebaseCore 10.24.0, which requires BoringSSL-GRPC 0.0.24, but the new version of FirebaseCore 11.2.0, should require the new 0.0.36. I think this would be the correct solution instead of this wired workaround.

@franfrLor
Copy link

As far as I can see the problem occurs becuase of this issue, in BoringSSL-GRPC grpc/grpc#36904. This is released in BoringSSL-GRPC 0.0.36.

Cordova-plugin-firebasex 16.5.0, is adding a pod called FirebaseCore 10.24.0, which requires BoringSSL-GRPC 0.0.24, but the new version of FirebaseCore 11.2.0, should require the new 0.0.36. I think this would be the correct solution instead of this wired workaround.

Can you propose a PR with an increase in versions to correct the problem?

@dpa99c
Copy link
Owner

dpa99c commented Sep 23, 2024

Just override the pinned default version using the plugin variable:

cordova plugin rm cordova-plugin-firebasex --nosave 
cordova plugin add cordova-plugin-firebasex --variable IOS_FIREBASE_SDK_VERSION=11.2.0

@mCassanoQuix
Copy link

mCassanoQuix commented Sep 24, 2024

Hello, i would like to report that pinning a specific version does not work, as FirebaseInAppMessaging is only available as beta and pod installation fails as the spec cannot be found. Adding the beta tag manually to the Podfile entry lets the installation continue, but GoogleTagManager and GoogleSignIn version also need to be increased. After that pod installation completes, but the build step fails as i assume some methods have changed signatures and/or module.

@mmwlada
Copy link

mmwlada commented Sep 24, 2024

I can confirm this.
I made changes in Podfile:

  • Firebase to 11.2.0
  • GoogleSignIn to 7.0.0
  • GoogleTagManager to 8.0.0.
  • iOS deployment target and platform increased

After that there were some changes in code,

  • FirebasePlugin
    Changed code in accordance with migration guide (See pictures)
  • AppDelegate+FirebasePlugin
    Added #import "FirebaseAuth-Swift.h"

After that, I was able to build the app, but my app doesn't use Google SignIn so I couldn't test that part.

https://developers.google.com/identity/sign-in/ios/quick-migration-guide
https://cocoapods.org/pods/GoogleSignIn#changelog
AppDelegate+FirebasePlugin Error
image

FirebasePlugin Errors
image
image

FirebasePlugin after fix
image
image

@mmwlada
Copy link

mmwlada commented Sep 24, 2024

I'd create a PR, but I'm not sure if there are changes that are not so obvious.

@roman-rr
Copy link

roman-rr commented Sep 24, 2024

Thank you @dpa99c

Just override the pinned default version using the plugin variable:

cordova plugin rm cordova-plugin-firebasex --nosave 
cordova plugin add cordova-plugin-firebasex --variable IOS_FIREBASE_SDK_VERSION=11.2.0

With such installation I have this error.

[!] CocoaPods could not find compatible versions for pod "FirebaseInAppMessaging":
  In Podfile:
    FirebaseInAppMessaging (= 11.2.0)

None of your spec sources contain a spec satisfying the dependency: `FirebaseInAppMessaging (= 11.2.0)`.

You have either:
 * out-of-date source repos which you can update with `pod repo update` or with `pod install --repo-update`.
 * mistyped the name or version.
 * not added the source repo that hosts the Podspec to your Podfile.

I found that there is FirebaseInAppMessaging: "11.2.0-beta" only.
Is this something we can set up on plugin code?

Meanwhile this is successful version for pod install

target 'App' do
	project 'App.xcodeproj'
	pod 'MaterialComponents/ActivityIndicator'
	pod 'FirebaseCore', '11.2.0'
	pod 'FirebaseAuth', '11.2.0'
	pod 'FirebaseAnalytics', '11.2.0'
	pod 'FirebaseMessaging', '11.2.0'
	pod 'FirebasePerformance', '11.2.0'
	pod 'FirebaseRemoteConfig', '11.2.0'
	pod 'FirebaseInAppMessaging', '11.2.0-beta'
	pod 'FirebaseFirestore', '11.2.0'
	pod 'FirebaseCrashlytics', '11.2.0'
	pod 'FirebaseFunctions', '11.2.0'
	pod 'FirebaseInstallations', '11.2.0'
	pod 'GoogleSignIn', '8.0.0'
	pod 'GoogleTagManager', '8.0.0'
end

Therefore, this config must works:

"IOS_FIREBASE_SDK_VERSION": "11.2.0",
"IOS_GOOGLE_SIGIN_VERSION": "8.0.0",
"IOS_GOOGLE_TAG_MANAGER_VERSION": "8.0.0",

But we must add IOS_FIREBASE_IN_APP_MESSAGING_VERSION option to helper.js to set it as '11.2.0-beta'.

And then I have success pod installation, but on XCODE, I got errors with google IOS_GOOGLE_SIGIN_VERSION as mentioned by @mmwlada

errors

@dpa99c
Copy link
Owner

dpa99c commented Sep 25, 2024

This should now be fixed in v17.0.0 of the plugin which I've just released:
it pins v11.2.0 of the Firebase iOS SDK, as well as GoogleSignIn v7.0.0 (plugin code has been updated for breaking API changes in this) and GoogleTagManager v8.0.0
Also added IOS_FIREBASE_IN_APP_MESSAGING_VERSION to enable setting that to a different version (i.e. -beta) than other iOS SDK component versions.
It's a new major plugin version as Firebase iOS SDK v11 drops support for iOS 12 which is a breaking change.

I've regression tested it using the example project with XCode v16 / iOS v18 / macOS v15
Let me know if you still encounter any issues with this.

P.S. If you have pinned component versions in your package.json / plugins/fetch.json, don't forget to update or remove them.

@mmwlada
Copy link

mmwlada commented Sep 25, 2024

I've just tried it with new version.
Adding ios fails with this error:
[!] CocoaPods could not find compatible versions for pod "FirebaseInAppMessaging": In Podfile: FirebaseInAppMessaging (= 11.2.0-beta) Specs satisfying the FirebaseInAppMessaging (= 11.2.0-beta) dependency were found, but they required a higher minimum deployment target.

This happens whatever version I put in deployment-target in config.xml.

@roman-rr
Copy link

roman-rr commented Sep 25, 2024

@mmwlada

I've just tried it with new version. Adding ios fails with this error: [!] CocoaPods could not find compatible versions for pod "FirebaseInAppMessaging": In Podfile: FirebaseInAppMessaging (= 11.2.0-beta) Specs satisfying the FirebaseInAppMessaging (= 11.2.0-beta) dependency were found, but they required a higher minimum deployment target.

This happens whatever version I put in deployment-target in config.xml.

Have you try to set deployment-target = 13 ?

@dpa99c
Copy link
Owner

dpa99c commented Sep 25, 2024

Check the deployment target in Podfile and Xcode: it needs to be 13.0 or above.

For comparison, here's the console log from a successful build of the example project using XCode 16, cordova-ios@7, [email protected]:
https://pixeldrain.com/u/twZRspSh

@roman-rr
Copy link

roman-rr commented Sep 26, 2024

Thank you @dpa99c
17.0.0 works well for me, with such configuration:

"IOS_FIREBASE_SDK_VERSION": "11.2.0",
"IOS_FIREBASE_IN_APP_MESSAGING_VERSION": "11.2.0-beta",
"IOS_GOOGLE_SIGIN_VERSION": "7.0.0",
"IOS_GOOGLE_TAG_MANAGER_VERSION": "8.0.0",

and config.xml

<platform name="ios">
        <preference name="deployment-target" value="13.0" />
</platform>

Build succeeds! 🎉

And for Android builds. Could you please check that build succeed at example project? Right now I got this:

Execution failed for task ':app:checkDebugAarMetadata'.
> A failure occurred while executing com.android.build.gradle.internal.tasks.CheckAarMetadataWorkAction
   > 2 issues were found when checking AAR metadata:
     
       1.  Dependency 'androidx.credentials:credentials:1.2.0-rc01' requires libraries and applications that
           depend on it to compile against version 34 or later of the
           Android APIs.
     
           :app is currently compiled against android-33.
     
           Also, the maximum recommended compile SDK version for Android Gradle
           plugin 7.4.2 is 33.
     
           Recommended action: Update this project's version of the Android Gradle
           plugin to one that supports 34, then update this project to use
           compileSdkVerion of at least 34.
     
           Note that updating a library or application's compileSdkVersion (which
           allows newer APIs to be used) can be done separately from updating
           targetSdkVersion (which opts the app in to new runtime behavior) and
           minSdkVersion (which determines which devices the app can be installed
           on).
     
       2.  Dependency 'androidx.credentials:credentials-play-services-auth:1.2.0-rc01' requires libraries and applications that
           depend on it to compile against version 34 or later of the
           Android APIs.
     
           :app is currently compiled against android-33.
     
           Also, the maximum recommended compile SDK version for Android Gradle
           plugin 7.4.2 is 33.
     
           Recommended action: Update this project's version of the Android Gradle
           plugin to one that supports 34, then update this project to use
           compileSdkVerion of at least 34.
     
           Note that updating a library or application's compileSdkVersion (which
           allows newer APIs to be used) can be done separately from updating
           targetSdkVersion (which opts the app in to new runtime behavior) and
           minSdkVersion (which determines which devices the app can be installed
           on).

@dpa99c
Copy link
Owner

dpa99c commented Sep 26, 2024

And for Android builds. Could you please check that build succeed at example project? Right now I got this:

Sorry, forgot to push the commit to the example project which sets API 34 as the build SDK: I've pushed it now so try pulling and rebuilding.

Android build Gradle 8.4 / cordova-android@13: build.log

@roman-rr
Copy link

@dpa99c Thank you again. I think it's completely resolved.

@dpa99c
Copy link
Owner

dpa99c commented Sep 26, 2024

OK, closing as resolved but can be re-opened if necessary

@grantsingleton
Copy link

Dears,

What I did is add the workaround on https://stackoverflow.com/a/78633109 into scripts/ios/helper.js into the applyPodsPostInstall function.

The new code added:

if target.name == 'BoringSSL-GRPC'
         target.source_build_phase.files.each do |file|
             if file.settings && file.settings['COMPILER_FLAGS']
                 flags = file.settings['COMPILER_FLAGS'].split
                 flags.reject! { |flag| flag == '-GCC_WARN_INHIBIT_ALL_WARNINGS' }
                 file.settings['COMPILER_FLAGS'] = flags.join(' ')
             end
         end
     end

The resulting function:

    applyPodsPostInstall: function(pluginVariables, iosPlatform){
        var podFileModified = false,
            podFilePath = iosPlatform.podFile,
            podFile = fs.readFileSync(path.resolve(podFilePath)).toString(),
            DEBUG_INFORMATION_FORMAT = pluginVariables['IOS_STRIP_DEBUG'] && pluginVariables['IOS_STRIP_DEBUG'] === 'true' ? 'dwarf' : 'dwarf-with-dsym',
            IPHONEOS_DEPLOYMENT_TARGET = podFile.match(iosDeploymentTargetPodRegEx)[1];

        if(!podFile.match('post_install')){
            podFile += `
post_install do |installer|
    installer.pods_project.targets.each do |target|
        target.build_configurations.each do |config|
            config.build_settings['DEBUG_INFORMATION_FORMAT'] = '${DEBUG_INFORMATION_FORMAT}'
            config.build_settings['IPHONEOS_DEPLOYMENT_TARGET'] = '${IPHONEOS_DEPLOYMENT_TARGET}'
            if target.respond_to?(:product_type) and target.product_type == "com.apple.product-type.bundle"
                config.build_settings['CODE_SIGNING_ALLOWED'] = 'NO'
            end
        end
        if target.name == 'BoringSSL-GRPC'
            target.source_build_phase.files.each do |file|
                if file.settings && file.settings['COMPILER_FLAGS']
                    flags = file.settings['COMPILER_FLAGS'].split
                    flags.reject! { |flag| flag == '-GCC_WARN_INHIBIT_ALL_WARNINGS' }
                    file.settings['COMPILER_FLAGS'] = flags.join(' ')
                end
            end
        end
    end
end
                `;
            fs.writeFileSync(path.resolve(podFilePath), podFile);
            utilities.log('cordova-plugin-firebasex: Applied post install block to Podfile');
            podFileModified = true;
        }
        return podFileModified;
    },

Hope it helps.

If you're using this in bare react native, put this update in your Podfile. native/ios/Podfile

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

No branches or pull requests

13 participants