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

"FirebaseAnalyticsTarget.o' does not contain bitcode" when trying to build iOS app for real device with Xcode 14

Open jcharr1 opened this issue 3 years ago • 10 comments

Description

After updating to Xcode 14.0, our iOS app suddenly started failing to link when building or achiving for a real device saying that FirebaseAnalyticsTarget.o does not contain bitcode. Cleaning the project multiple times didn't help. Disabling bitcode for the main target fixes this error. I included the full error message from Xcode in the log output section. Thanks!

Reproducing the issue

No response

Firebase SDK Version

9.6.0

Xcode Version

14.0

Installation Method

Swift Package Manager

Firebase Product(s)

Analytics, Crashlytics, In-App Messaging, Messaging

Targeted Platforms

iOS

Relevant Log Output

'/Users/jason/Library/Developer/Xcode/DerivedData/Innovative-abqfqjfwtzbefhduuuxbilbqqyay/Build/Intermediates.noindex/ArchiveIntermediates/Innovative/BuildProductsPath/Release-iphoneos/FirebaseAnalyticsTarget.o' does not contain bitcode. You must rebuild it with bitcode enabled (Xcode setting ENABLE_BITCODE), obtain an updated library from the vendor, or disable bitcode for this target. file '/Users/jason/Library/Developer/Xcode/DerivedData/Innovative-abqfqjfwtzbefhduuuxbilbqqyay/Build/Intermediates.noindex/ArchiveIntermediates/Innovative/BuildProductsPath/Release-iphoneos/FirebaseAnalyticsTarget.o' for architecture arm64

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

Expand Package.resolved snippet

{
  "pins" : [
    {
      "identity" : "abseil-cpp-swiftpm",
      "kind" : "remoteSourceControl",
      "location" : "https://github.com/firebase/abseil-cpp-SwiftPM.git",
      "state" : {
        "revision" : "583de9bd60f66b40e78d08599cc92036c2e7e4e1",
        "version" : "0.20220203.2"
      }
    },
    {
      "identity" : "afnetworking",
      "kind" : "remoteSourceControl",
      "location" : "https://github.com/AFNetworking/AFNetworking.git",
      "state" : {
        "revision" : "ffae2391ab0c29dc88eb0a58d2f5b2c2c27cadbf",
        "version" : "4.0.1"
      }
    },
    {
      "identity" : "boringssl-swiftpm",
      "kind" : "remoteSourceControl",
      "location" : "https://github.com/firebase/boringssl-SwiftPM.git",
      "state" : {
        "revision" : "dd3eda2b05a3f459fc3073695ad1b28659066eab",
        "version" : "0.9.1"
      }
    },
    {
      "identity" : "firebase-ios-sdk",
      "kind" : "remoteSourceControl",
      "location" : "https://github.com/firebase/firebase-ios-sdk",
      "state" : {
        "revision" : "7e80c25b51c2ffa238879b07fbfc5baa54bb3050",
        "version" : "9.6.0"
      }
    },
    {
      "identity" : "googleappmeasurement",
      "kind" : "remoteSourceControl",
      "location" : "https://github.com/google/GoogleAppMeasurement.git",
      "state" : {
        "revision" : "c1cfde8067668027b23a42c29d11c246152fe046",
        "version" : "9.6.0"
      }
    },
    {
      "identity" : "googledatatransport",
      "kind" : "remoteSourceControl",
      "location" : "https://github.com/google/GoogleDataTransport.git",
      "state" : {
        "revision" : "5056b15c5acbb90cd214fe4d6138bdf5a740e5a8",
        "version" : "9.2.0"
      }
    },
    {
      "identity" : "googleutilities",
      "kind" : "remoteSourceControl",
      "location" : "https://github.com/google/GoogleUtilities.git",
      "state" : {
        "revision" : "22907832079d808e82f1182b21af58ef3880666f",
        "version" : "7.8.0"
      }
    },
    {
      "identity" : "grpc-ios",
      "kind" : "remoteSourceControl",
      "location" : "https://github.com/grpc/grpc-ios.git",
      "state" : {
        "revision" : "8440b914756e0d26d4f4d054a1c1581daedfc5b6",
        "version" : "1.44.3-grpc"
      }
    },
    {
      "identity" : "gtm-session-fetcher",
      "kind" : "remoteSourceControl",
      "location" : "https://github.com/google/gtm-session-fetcher.git",
      "state" : {
        "revision" : "d4289da23e978f37c344ea6a386e5546e2466294",
        "version" : "2.1.0"
      }
    },
    {
      "identity" : "leveldb",
      "kind" : "remoteSourceControl",
      "location" : "https://github.com/firebase/leveldb.git",
      "state" : {
        "revision" : "0706abcc6b0bd9cedfbb015ba840e4a780b5159b",
        "version" : "1.22.2"
      }
    },
    {
      "identity" : "mbprogresshud",
      "kind" : "remoteSourceControl",
      "location" : "https://github.com/jdg/MBProgressHUD.git",
      "state" : {
        "revision" : "bca42b801100b2b3a4eda0ba8dd33d858c780b0d",
        "version" : "1.2.0"
      }
    },
    {
      "identity" : "nanopb",
      "kind" : "remoteSourceControl",
      "location" : "https://github.com/firebase/nanopb.git",
      "state" : {
        "revision" : "819d0a2173aff699fb8c364b6fb906f7cdb1a692",
        "version" : "2.30909.0"
      }
    },
    {
      "identity" : "openssl",
      "kind" : "remoteSourceControl",
      "location" : "https://github.com/krzyzanowskim/OpenSSL.git",
      "state" : {
        "revision" : "9429bf89fe0df2d2f25f3a9a51cbf7092e69640f",
        "version" : "1.1.1700"
      }
    },
    {
      "identity" : "promises",
      "kind" : "remoteSourceControl",
      "location" : "https://github.com/google/promises.git",
      "state" : {
        "revision" : "3e4e743631e86c8c70dbc6efdc7beaa6e90fd3bb",
        "version" : "2.1.1"
      }
    },
    {
      "identity" : "swift-protobuf",
      "kind" : "remoteSourceControl",
      "location" : "https://github.com/apple/swift-protobuf.git",
      "state" : {
        "revision" : "b8230909dedc640294d7324d37f4c91ad3dcf177",
        "version" : "1.20.1"
      }
    },
    {
      "identity" : "swiftsoup",
      "kind" : "remoteSourceControl",
      "location" : "https://github.com/scinfu/SwiftSoup.git",
      "state" : {
        "revision" : "6778575285177365cbad3e5b8a72f2a20583cfec",
        "version" : "2.4.3"
      }
    }
  ],
  "version" : 2
}


If using CocoaPods, the project's Podfile.lock

Expand Podfile.lock snippet

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

jcharr1 avatar Sep 13 '22 18:09 jcharr1

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 Sep 13 '22 18:09 google-oss-bot

Just to add, building for the simulator with bitcode enabled still works fine with Xcode 14.

jcharr1 avatar Sep 13 '22 19:09 jcharr1

We removed bitcode from binary distributions in response to the bitcode deprecation in Xcode 14 (see the release notes here). If you're building your app via Xcode 14, you can turn off bitcode in your app target.

morganchen12 avatar Sep 13 '22 20:09 morganchen12

Got it. Thanks!

jcharr1 avatar Sep 13 '22 20:09 jcharr1

Apologies, my comment was in error and the bitcode should still be in the binary. Reopening while our team investigates.

morganchen12 avatar Sep 13 '22 22:09 morganchen12

The only pre-built binary in the listed dependencies is Analytics, which should have bitcode in it (I tested the release candidate via the instructions in this StackOverflow post). Can you try checking to see if the binary you downloaded via SPM has bitcode?

morganchen12 avatar Sep 13 '22 22:09 morganchen12

If I'm checking the right files (sorry, I'm really new to SPM), yes. I see bitcode in the native iOS and tvOS binaries.

$ otool -l /Users/jason/Library/Developer/Xcode/DerivedData/Innovative-abqfqjfwtzbefhduuuxbilbqqyay/SourcePackages/artifacts/firebase-ios-sdk/FirebaseAnalytics.xcframework/ios-arm64_armv7/FirebaseAnalytics.framework/FirebaseAnalytics | grep __LLVM
   segname __LLVM
   segname __LLVM
   segname __LLVM
   segname __LLVM
[...and lots more]
otool -l /Users/jason/Library/Developer/Xcode/DerivedData/Innovative-abqfqjfwtzbefhduuuxbilbqqyay/SourcePackages/artifacts/firebase-ios-sdk/FirebaseAnalytics.xcframework/tvos-arm64/FirebaseAnalytics.framework/FirebaseAnalytics | grep __LLVM
   segname __LLVM
   segname __LLVM
   segname __LLVM
   segname __LLVM
   segname __LLVM
[...and more]

jcharr1 avatar Sep 13 '22 22:09 jcharr1

I am also seeing something similar while archiving. For me FirebasePerfromaceTarget dependency is having problems:

Error log: ld: '/.../Debug-iphoneos/FirebasePerformanceTarget.o' does not contain bitcode. You must rebuild it with bitcode enabled (Xcode setting ENABLE_BITCODE), obtain an updated library from the vendor, or disable bitcode for this target

puneet25 avatar Sep 14 '22 12:09 puneet25

@puneet25, you can check if the built Performance binary contains bitcode per the instructions above as well. I suspect it does and the error is not actually caused by bitcode missing from the library, so more investigation is required.

Nonetheless disabling bitcode in your app target remains a valid workaround in Xcode 14 since it's deprecated for iOS targets.

morganchen12 avatar Sep 14 '22 22:09 morganchen12

Thanks @morganchen12 for the reply. Disabling bitcode works.

puneet25 avatar Sep 15 '22 13:09 puneet25