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

Carthage Firebase.framework does not contain bitcode. #911

Closed
mpaulsonco opened this issue Mar 12, 2018 · 13 comments · Fixed by #917
Closed

Carthage Firebase.framework does not contain bitcode. #911

mpaulsonco opened this issue Mar 12, 2018 · 13 comments · Fixed by #917
Assignees
Labels

Comments

@mpaulsonco
Copy link

mpaulsonco commented Mar 12, 2018

When installed through Carthage, Firebase.framework/Firebase' does not contain bitcode.

My Environment

  • Xcode version: 9.2
  • Firebase SDK version: 4.9.0 (Carthage)
  • Firebase Component: Core, Analytics, Messaging
  • Component version: 4.9.0

Steps to reproduce:

  1. Install Firebase from Carthage following the steps outlined in the guide.
  2. Try and build to a physical device or create an Archive
  3. Encounter error:
ld: '........../Carthage/Build/iOS/Firebase.framework/Firebase' 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 '........./Carthage/Build/iOS/Firebase.framework/Firebase' for architecture arm64
clang: error: linker command failed with exit code 1 (use -v to see invocation)

Additional Details:

  • This is only a problem with Firebase.framework (the other Carthage-installed dependencies I have in the same project do not have this issue)
@paulb777
Copy link
Member

@mpaulsonco Thanks for the report! The Firebase.framework is only needed to provide build time access to the Firebase module and Firebase.h. It is not needed for linking. Thus a workaround is to delete Firebase.framework from the Link Binary With Libraries Build Phase.

I'll leave this open until I make this requirement clearer in the documentation or update the Firebase framework.

screen shot 2018-03-12 at 1 38 41 pm

@mpaulsonco
Copy link
Author

@paulb777 I can confirm this solved it for me, thanks!

@npocmo
Copy link

npocmo commented Mar 13, 2018

Hello!

I run into same issue, so I also deleted Firebase.framework from the Link Binary With Libraries Build Phase.

I am still getting errors like:
Ld .../Library/Developer/Xcode/DerivedData/CarthageFirebaseTest-gcmfvqeteiovpadbjrrhdofxjsbi/Build/Products/Debug-iphoneos/CarthageFirebaseTest.app/CarthageFirebaseTest normal arm64 cd .../carthage_firebase_test/CarthageFirebaseTest

Undefined symbols for architecture arm64: "___cxa_guard_acquire", referenced from: leveldb::crc32c::Extend(unsigned int, char const*, unsigned long) in leveldb-library(crc32c.o) "___cxa_guard_abort", referenced from: leveldb::crc32c::Extend(unsigned int, char const*, unsigned long) in leveldb-library(crc32c.o) ...

I tried to add additional Linker Flags, which were suggested in another threads and also added libraries like "libicucore.dylib" but it didnt helped. I am only getting different errors.

I am using Xcode 9.2 and macOS Sierra 10.12.6.

@paulb777, Do you have any suggestion to fix this problem?

@paulb777
Copy link
Member

@npocmo Try adding libc++ to the Link Binary With Libraries Build Phase.

screen shot 2018-03-13 at 7 01 07 am

@npocmo
Copy link

npocmo commented Mar 13, 2018

libc++ resolved some errors, but not all of them. I also added libssqlite3.tbd and some others libraries which helped but I still couldnt build my sample project successfuly.

After a while I decided to only use frameworks I absolutely needed and for a build to be successful.
image

And it worked.

@unixb0y
Copy link

unixb0y commented Apr 15, 2019

I would like to mention that I had this error:
Screenshot 2019-04-16 at 01 45 53

This is the content of my Cartfile:

binary "https://dl.google.com/dl/firebase/ios/carthage/FirebaseAnalyticsBinary.json"
binary "https://dl.google.com/dl/firebase/ios/carthage/FirebaseMessagingBinary.json"

I resolved it by adding "StoreKit" in "Link Binary With Libraries":
Screenshot 2019-04-16 at 01 47 37

@paulb777
Copy link
Member

paulb777 commented Apr 15, 2019

@unixb0y Thanks for sharing. I've seen another report that this same issue was resolved by rm -rf ~/Library/Developer/Xcode/DerivedData/ . Presumably the Xcode ModuleCache wasn't properly updating.

@unixb0y
Copy link

unixb0y commented Apr 15, 2019

@unixb0y Thanks for sharing. I've seen another report that this same issue was resolved by rm -rf ~/Library/Developer/Xcode/DerivedData/ . Presumably the Xcode ModuleCache wasn't properly updating.

You're right! No need for StoreKit, then 😊 I was just following the error message, but the classic "clean caches" worked too, thanks man 👍

@reggian
Copy link

reggian commented Apr 17, 2019

@paulb777 Thank you for putting an effort into Carthage solution. Much appreciated.
But there is a problem combining Firebase with Crashlytics.
After I add the Crashlytics/Fabric frameworks I get the error:

Could not find auto-linked framework 'Firebase'

Any ideas here?

@paulb777
Copy link
Member

@reggian From https://github.com/firebase/firebase-ios-sdk/blob/master/Carthage.md, Delete Firebase.framework from the Link Binary With Libraries Build Phase.

@reggian
Copy link

reggian commented Apr 17, 2019

@paulb777 I forgot to mention, I did and Firebase alone works 👍
But after I add the Crashlytics/Fabric frameworks I get the error:

Could not find auto-linked framework 'Firebase'

I do not know if things are related, since I can not add the Firebase.framework due to the bitcode error I can not test.

The full log:

ld: warning: Could not find auto-linked framework 'Firebase'
Undefined symbols for architecture arm64:
  "vtable for __cxxabiv1::__vmi_class_type_info", referenced from:
      typeinfo for std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > in Crashlytics(CLSException.o)
  NOTE: a missing vtable usually means the first non-inline virtual member function has no definition.
  "vtable for __cxxabiv1::__class_type_info", referenced from:
      typeinfo for std::__1::__basic_string_common<true> in Crashlytics(CLSException.o)
  NOTE: a missing vtable usually means the first non-inline virtual member function has no definition.
  "typeinfo for std::exception", referenced from:
      GCC_except_table1 in Crashlytics(CLSException.o)
      typeinfo for std::exception const* in Crashlytics(CLSException.o)
  "typeinfo for std::bad_alloc", referenced from:
      GCC_except_table1 in Crashlytics(CLSException.o)
  "typeinfo for char const*", referenced from:
      _CLSExceptionRaiseTestCppException in Crashlytics(CLSException.o)
      GCC_except_table1 in Crashlytics(CLSException.o)
  "___cxa_begin_catch", referenced from:
      CLSTerminateHandler() in Crashlytics(CLSException.o)
      ___clang_call_terminate in Crashlytics(CLSException.o)
  "std::get_terminate()", referenced from:
      _CLSExceptionCheckHandlers in Crashlytics(CLSException.o)
  "vtable for __cxxabiv1::__pointer_type_info", referenced from:
      typeinfo for std::exception const* in Crashlytics(CLSException.o)
  NOTE: a missing vtable usually means the first non-inline virtual member function has no definition.
  "___cxa_throw", referenced from:
      _CLSExceptionRaiseTestCppException in Crashlytics(CLSException.o)
  "___cxa_current_exception_type", referenced from:
      CLSTerminateHandler() in Crashlytics(CLSException.o)
  "___cxa_rethrow", referenced from:
      CLSTerminateHandler() in Crashlytics(CLSException.o)
  "___cxa_end_catch", referenced from:
      CLSTerminateHandler() in Crashlytics(CLSException.o)
  "std::set_terminate(void (*)())", referenced from:
      _CLSExceptionInitialize in Crashlytics(CLSException.o)
      CLSTerminateHandler() in Crashlytics(CLSException.o)
  "___cxa_allocate_exception", referenced from:
      _CLSExceptionRaiseTestCppException in Crashlytics(CLSException.o)
  "std::terminate()", referenced from:
      ___clang_call_terminate in Crashlytics(CLSException.o)
  "___cxa_demangle", referenced from:
      +[CLSDemangleOperation demangleCppSymbol:] in Crashlytics(CLSDemangleOperation.o)
  "___gxx_personality_v0", referenced from:
      +[CLSDemangleOperation demangleBlockInvokeCppSymbol:] in Crashlytics(CLSDemangleOperation.o)
      -[CLSDemangleOperation main] in Crashlytics(CLSDemangleOperation.o)
      ___28-[CLSDemangleOperation main]_block_invoke in Crashlytics(CLSDemangleOperation.o)
ld: symbol(s) not found for architecture arm64
clang: error: linker command failed with exit code 1 (use -v to see invocation)

Also there is no error if I "forget" to add the $(OTHER_LDFLAGS) -ObjC flags. But then obviously Firebase does not work.

@paulb777
Copy link
Member

It looks like missing the Firebase framework is only a warning. The error is not linking the C++ library. See #911 (comment) above.

@reggian
Copy link

reggian commented Apr 17, 2019

@paulb777 I am sorry I missed that and have wasted your time.
Thanks a lot for your help and patience.

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

Successfully merging a pull request may close this issue.

5 participants