firebase-ios-sdk icon indicating copy to clipboard operation
firebase-ios-sdk copied to clipboard

Xcode Archive failure with manual code signing when upgrading Firebase from 8.14

Open natemekonnen opened this issue 1 year ago • 6 comments

Description

I recently upgraded the Firebase SDK from version 8.14.0 to the 10.24.0 to utilize the real-time remote config feature in my iOS project. After the upgrade, the functionality works as expected during development. However, when attempting to create an IPA file using manual code signing for release builds, I encountered a compilation failure.

Issue Encountered:

During the archive process, the compilation fails with the following error:

CompileSwift normal arm64 (in target 'FirebaseCoreInternal' from project 'Firebase')
    cd /Users/runner/Library/Developer/Xcode/DerivedData/SourcePackages/checkouts/firebase-ios-sdk/FirebaseCore/Internal/Sources/HeartbeatLogging/HeartbeatsPayload.swift:20:10: error: no such module 'GoogleUtilities'
  import GoogleUtilities
.
.
.
** ARCHIVE FAILED **


The following build commands failed:
	SwiftCompile normal arm64 Compiling\ Heartbeat.swift,\ HeartbeatController.swift,\ HeartbeatStorage.swift,\ HeartbeatsBundle.swift,\ HeartbeatsPayload.swift ....
        CompileSwift normal arm64 (in target 'FirebaseCoreInternal' from project 'Firebase')
(2 failures)

Command used to run archive:

xcodebuild \ 
  -sdk iphoneos \
  -configuration Release \
  -project ./Sample.xcodeproj \
  -scheme Release clean archive SWIFT_ACTIVE_COMPILATION_CONDITIONS=RELEASE 

Important build settings to highlight

CODE_SIGN_STYLE = Manual;
COPY_PHASE_STRIP = YES;
IPHONEOS_DEPLOYMENT_TARGET = 16.0;
SWIFT_COMPILATION_MODE = wholemodule;
SWIFT_OPTIMIZATION_LEVEL = "-O";
SWIFT_VERSION = 5.0;
VALIDATE_PRODUCT = YES;

Expected Behavior:

Interestingly, the archive succeeds when automatic code signing is enabled for DEBUG builds. I expect the archive process for RELEASE builds to succeed with manual code signing enabled, similar to DEBUG builds.

Reproducing the issue

No response

Firebase SDK Version

10.24.0

Xcode Version

15.2

Installation Method

Swift Package Manager

Firebase Product(s)

Messaging, Remote Config

Targeted Platforms

iOS

Relevant Log Output

** ARCHIVE FAILED **


The following build commands failed:
	SwiftCompile normal arm64 Compiling\ Heartbeat.swift,\ HeartbeatController.swift,\ HeartbeatStorage.swift,\ HeartbeatsBundle.swift,\ HeartbeatsPayload.swift ....
        CompileSwift normal arm64 (in target 'FirebaseCoreInternal' from project 'Firebase')
(2 failures)

If using Swift Package Manager, the project's Package.resolved

Expand Package.resolved snippet

{
  "object": {
    "pins": [
      {
        "package": "abseil",
        "repositoryURL": "https://github.com/google/abseil-cpp-binary.git",
        "state": {
          "branch": null,
          "revision": "748c7837511d0e6a507737353af268484e1745e2",
          "version": "1.2024011601.1"
        }
      },
      {
        "package": "AppCheck",
        "repositoryURL": "https://github.com/google/app-check.git",
        "state": {
          "branch": null,
          "revision": "7d2688de038d5484866d835acb47b379722d610e",
          "version": "10.19.0"
        }
      },
      {
        "package": "AppCenter",
        "repositoryURL": "https://github.com/microsoft/appcenter-sdk-apple.git",
        "state": {
          "branch": null,
          "revision": "88e65475ffd3a7cf2bbde07df9e62159a1fd60a8",
          "version": "5.0.0"
        }
      },
      {
        "package": "Firebase",
        "repositoryURL": "https://github.com/firebase/firebase-ios-sdk",
        "state": {
          "branch": null,
          "revision": "42eae77a0af79e9c3f41df04a23c76f05cfdda77",
          "version": "10.24.0"
        }
      },
      {
        "package": "GoogleAppMeasurement",
        "repositoryURL": "https://github.com/google/GoogleAppMeasurement.git",
        "state": {
          "branch": null,
          "revision": "51ba746a9d51a4bd0774b68499b0c73ef6e8570d",
          "version": "10.24.0"
        }
      },
      {
        "package": "GoogleDataTransport",
        "repositoryURL": "https://github.com/google/GoogleDataTransport.git",
        "state": {
          "branch": null,
          "revision": "a637d318ae7ae246b02d7305121275bc75ed5565",
          "version": "9.4.0"
        }
      },
      {
        "package": "GoogleUtilities",
        "repositoryURL": "https://github.com/google/GoogleUtilities.git",
        "state": {
          "branch": null,
          "revision": "26c898aed8bed13b8a63057ee26500abbbcb8d55",
          "version": "7.13.1"
        }
      },
      {
        "package": "gRPC",
        "repositoryURL": "https://github.com/google/grpc-binary.git",
        "state": {
          "branch": null,
          "revision": "e9fad491d0673bdda7063a0341fb6b47a30c5359",
          "version": "1.62.2"
        }
      },
      {
        "package": "GTMSessionFetcher",
        "repositoryURL": "https://github.com/google/gtm-session-fetcher.git",
        "state": {
          "branch": null,
          "revision": "0382ca27f22fb3494cf657d8dc356dc282cd1193",
          "version": "3.4.1"
        }
      },
      {
        "package": "InteropForGoogle",
        "repositoryURL": "https://github.com/google/interop-ios-for-google-sdks.git",
        "state": {
          "branch": null,
          "revision": "2d12673670417654f08f5f90fdd62926dc3a2648",
          "version": "100.0.0"
        }
      },
      {
        "package": "leveldb",
        "repositoryURL": "https://github.com/firebase/leveldb.git",
        "state": {
          "branch": null,
          "revision": "0706abcc6b0bd9cedfbb015ba840e4a780b5159b",
          "version": "1.22.2"
        }
      },
      {
        "package": "Lottie",
        "repositoryURL": "https://github.com/airbnb/lottie-ios",
        "state": {
          "branch": null,
          "revision": "79a0b70547f7c40ea54c67487f935fa2f2eaaadc",
          "version": "3.2.3"
        }
      },
      {
        "package": "nanopb",
        "repositoryURL": "https://github.com/firebase/nanopb.git",
        "state": {
          "branch": null,
          "revision": "819d0a2173aff699fb8c364b6fb906f7cdb1a692",
          "version": "2.30909.0"
        }
      },
      {
        "package": "PLCrashReporter",
        "repositoryURL": "https://github.com/microsoft/PLCrashReporter.git",
        "state": {
          "branch": null,
          "revision": "b1a342da19ed9b3af61ea2efa7656c2af30aeb7c",
          "version": "1.11.0"
        }
      },
      {
        "package": "Promises",
        "repositoryURL": "https://github.com/google/promises.git",
        "state": {
          "branch": null,
          "revision": "540318ecedd63d883069ae7f1ed811a2df00b6ac",
          "version": "2.4.0"
        }
      },
      {
        "package": "SwiftProtobuf",
        "repositoryURL": "https://github.com/apple/swift-protobuf.git",
        "state": {
          "branch": null,
          "revision": "0af9125c4eae12a4973fb66574c53a54962a9e1e",
          "version": "1.21.0"
        }
      },
      {
        "package": "TrustKit",
        "repositoryURL": "https://github.com/datatheorem/TrustKit",
        "state": {
          "branch": null,
          "revision": "3c953558d61fdd9b136d981764e3242bd92b2648",
          "version": "1.7.0"
        }
      }
      }
    ]
  },
  "version": 1
}


If using CocoaPods, the project's Podfile.lock

Expand Podfile.lock snippet

Replace this line with the contents of your Podfile.lock!

natemekonnen avatar Apr 22 '24 20:04 natemekonnen

I couldn't figure out how to label this issue, so I've labeled it for a human to triage. Hang tight.

google-oss-bot avatar Apr 22 '24 20:04 google-oss-bot

This may be a duplicate of #12409 in which it will be fixed in the next Firebase release. At the time, I wasn't able to reproduce the reports in #12409, are you able to provide a minimal, reproducible example?

ncooke3 avatar Apr 22 '24 21:04 ncooke3

Steps to reproduce the bug

on Xcode 15.2

  1. New Project -> iOS -> App MicrosoftTeams-image (1)
MicrosoftTeams-image (2)
  1. Add firebase dependency MicrosoftTeams-image (3)
MicrosoftTeams-image (4)

Add FirebaseRemoteConfig to target MicrosoftTeams-image (5)

package dependency version state: MicrosoftTeams-image (6)

  1. Run archive command
xcodebuild \
  -sdk iphoneos \
  -configuration Release \
  -project ./ReproduceFirebaseBug.xcodeproj \
  -scheme ReproduceFirebaseBug clean archive SWIFT_ACTIVE_COMPILATION_CONDITIONS=RELEASE

Faliure log

/Xcode/DerivedData/ReproduceFirebaseBug-aqsvoqcltntrsndflplttyxvojsl/SourcePackages/checkouts/firebase-ios-sdk/FirebaseCore/Internal/Sources/HeartbeatLogging/HeartbeatsPayload.swift:20:10: error: no such module 'GoogleUtilities'
  import GoogleUtilities
         ^
.
.
.
** ARCHIVE FAILED **

The following build commands failed:
                SwiftCompile normal arm64 Compiling\ resource_bundle_accessor.swift,\ Heartbeat.swift,\ HeartbeatController.swift,\ HeartbeatLoggingTestUtils.swift,\ HeartbeatStorage.swift
  .
  .
  ._ObjC_HeartbeatsPayload.swift (in target 'FirebaseCoreInternal' from project 'Firebase')
                CompileSwift normal arm64 (in target 'FirebaseCoreInternal' from project 'Firebase')

(2 failures)

natemekonnen avatar Apr 23 '24 15:04 natemekonnen

Thanks for the repro steps. I reproduced with Xcode 15.3 and continuing to investigate.

paulb777 avatar Apr 23 '24 22:04 paulb777

The build is successful if SWIFT_ACTIVE_COMPILATION_CONDITIONS=RELEASE is removed from the command line. It seems that it causes the SWIFT_PACKAGE to be undefined and the condition here to be compiled wrong. Is the option redundant anyway with the already specified -configuration Release?

paulb777 avatar Apr 23 '24 23:04 paulb777

Hey @natemekonnen. We need more information to resolve this issue but there hasn't been an update in 5 weekdays. I'm marking the issue as stale and if there are no new updates in the next 5 days I will close it automatically.

If you have more information that will help us get to the bottom of this, just add a comment!

google-oss-bot avatar Apr 30 '24 01:04 google-oss-bot

Since there haven't been any recent updates here, I am going to close this issue.

@natemekonnen if you're still experiencing this problem and want to continue the discussion just leave a comment here and we are happy to re-open this.

google-oss-bot avatar May 06 '24 01:05 google-oss-bot

I am experiencing the same error in Xcode when signing is not automatically managed. I receive the following error:

note: Injecting stub binary into codeless framework (in target 'Abler' from project 'Abler')
note: Signing codeless framework with --generate-pre-encrypt-hashes (in target 'Abler' from project 'Abler')
.../ios/Pods/../../node_modules/react-native/scripts/xcode/ccache-clang.sh: line 14: exec: ccache: not found
Command CodeSign failed with a nonzero exit code

Note: I am trying to build for the Simulator.

Kreshnik avatar May 10 '24 13:05 Kreshnik