Cocoapods: Development Pods - No Such Module Found while Example project is okay

Created on 19 May 2016  Â·  49Comments  Â·  Source: CocoaPods/CocoaPods

ℹ Please fill out this template when filing an issue.
All lines beginning with an ℹ symbol instruct you with
what info we expect.
Please remove this line and all above before submitting.

Report

What did you do?

  1. I ran pod lib create RxFirebase
  2. I included the dependencies RxSwift and Firebase
  3. In the Development pods RxSwift's module was OK, Firebase's however was not able to be detected. The build breaks with No such module Firebase.
  4. In the Example Project, Firebase is imported correctly and has no problem.

    What did you expected to happen?

I expected that both RxSwift and Firebase to be available within the ReplaceMe.swift template file.

What happened instead?

  1. Example Target builds fine, Both Firebase and RxSwift are available.
  2. The Development Pods does cannot find the Firebase module. RxSwift is okay.

    CocoaPods Environment

Stack

   CocoaPods : 1.0.0
        Ruby : ruby 2.2.2p95 (2015-04-13 revision 50295) [x86_64-darwin14]
    RubyGems : 2.4.8
        Host : Mac OS X 10.11.4 (15E65)
       Xcode : 7.3.1 (7D1014)
         Git : git version 2.7.4 (Apple Git-66)
Ruby lib dir : /Users/maximilianalexander/.rvm/rubies/ruby-2.2.2/lib
Repositories : master - https://github.com/CocoaPods/Specs.git @ 8f697da055908c5bf354411506e535555e13e178

Installation Source

Executable Path: /Users/maximilianalexander/.rvm/rubies/ruby-2.2.2/bin/pod

Plugins

cocoapods-deintegrate : 1.0.0
cocoapods-plugins     : 1.0.0
cocoapods-search      : 1.0.0
cocoapods-stats       : 1.0.0
cocoapods-trunk       : 1.0.0
cocoapods-try         : 1.0.0

Project that demonstrates the issue

https://github.com/RxSwiftCommunity/RxFirebase

awaiting input

Most helpful comment

I don't know if this may be of any help, but I stumbled into a very similar problem (the build breaks with Missing required module Firebase) while working on a cocoapod that is shipped with a vendored_frameworks that eventually uses import Firebase.

In the end, the (kind of brute force) workaround I found was to add the following to my .podspec:

s.dependency 'Firebase'
s.xcconfig = { 'SWIFT_INCLUDE_PATHS' => '$(PODS_ROOT)/Firebase/Core/Sources' }

with this, the final application using my cocoapod compiles fine and is able to resolve the import Firebase statement. :)

All 49 comments

It looks to me as if this might be an issue with the Firebase podspec itself. There seems to be a custom module map, but it is not set as spec.module_map nor is SWIFT_INCLUDE_PATHS ever set. Their "DatabaseExample" seems to override FRAMEWORK_SEARCH_PATHS in the user target, but still doesn't actually compile so ¯_(ツ)_/¯

I guess the custom module map is supposed to be found via HEADER_SEARCH_PATHS which they are setting by spec.user_target_xcconfig — this might be the root of the problem here.

Hey @mcdonamp
I don't think this has much to do with dynamic frameworks. It looks like you guys need specify module maps and include paths. This way you can support iOS7 static frameworks and dynamic frameworks.

I think Twitter Fabric's podspec has the same support.

@neonichu Do you think it's possible to weak link the frameworks? I'm struggling to find an example of a pod that uses weak linked frameworks to use as an example. Any pointers?

Not entirely sure what you're trying to do. There's weak_frameworks for weak linking system frameworks.

Oh it can only be used for System Frameworks? But it can't be used for
vendored_frameworks?

On Sun, May 22, 2016 at 12:58 AM Boris Bügling [email protected]
wrote:

Not entirely sure what you're trying to do. There's weak_frameworks for
weak linking system frameworks.

—
You are receiving this because you authored the thread.
Reply to this email directly or view it on GitHub
https://github.com/CocoaPods/CocoaPods/issues/5368#issuecomment-220819513

Maximilian Alexander
[email protected]
http://blog.edenmsg.com

Nope, I don't really see how that would make sense. What are you trying to do?

I'm trying to create 3rd party helper library around the new Firebase. But since their podspec is mangled incorrectly, I'm trying to see how I can continue development. I can download the SDK and include them as vendored frameworks. If someone has this

pod 'Firebase'
pod 'RxFirebase`       //this is my library which depends on firebase

Will installing Firebase and RxFirebase, double include the frameworks?

Yes, I think it would even refuse to install because you would be trying to depend on two different frameworks with the same module name as there is no way for CP to know if they're the same binary or not (and likely they wouldn't, different versions and such).

Alright I see. Thank you!

On Sun, May 22, 2016 at 1:15 AM Boris Bügling [email protected]
wrote:

Yes, I think it would even refuse to install because you would be trying
to depend on two different frameworks with the same module name as there is
no way for CP to know if they're the same binary or not (and likely they
wouldn't, different versions and such).

—
You are receiving this because you authored the thread.
Reply to this email directly or view it on GitHub
https://github.com/CocoaPods/CocoaPods/issues/5368#issuecomment-220820069

Maximilian Alexander
[email protected]
http://blog.edenmsg.com

Hi, @mbalex99 do you find solution for this problem ? It seems that if a pod using new version of Firebase, development pod cannot find module Firebase, but in the "Example"/demo for the pod it works

Using the old firebase (before integrating with google play services) works just fine

No it looks like I have to package it with Firebase as a framework i just
need some actual free time to address it!
On Sun, May 29, 2016 at 6:10 PM x4080 [email protected] wrote:

Hi, @mbalex99 https://github.com/mbalex99 do you find solution for this
problem ? It seems that if a pod using new version of Firebase, development
pod cannot find module Firebase, but in the "Example"/demo for the pod it
works

Using the old firebase (before integrating with google play services)
works just fine

—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
https://github.com/CocoaPods/CocoaPods/issues/5368#issuecomment-222394233,
or mute the thread
https://github.com/notifications/unsubscribe/ACFSMev-cM5fd_J0DH-8KyJjuuet-mW9ks5qGjj1gaJpZM4Ih7cm
.

Maximilian Alexander
[email protected]
http://blog.edenmsg.com

Has anyone found a solution to this?

Not sure, but I doubt it. Not sure if it's the Firebase pod that doesn't handle being used in development pods correctly, or the behavior of development pods doesn't mirror normal pods. Do we have any docs on the behavior of development pods vs regular pods, or is it all supposed to Just Workâ„¢?

The only solution I have found for this at the moment is to work with CocoaPods version 0.39.0. You can do so by simply adding _0.39.0_ after the pod command. (i.e. pod _0.39.0_ install, etc.). Of course you just need to make sure you have that version installed. Hope this helps. Frustrated with Firebase for this.

I think I had that problem with linking other pod than Firebase. And it was also closed framework.

It seems like cocoaPods links to development pods only those frameworks that are pods building products. There's no target for Firebase in Pods project.
cocoapods targets with firebase as dependency of development pod
pod s sources

@neonichu can you confirm the above change in behavior from 0.x to 1.x? Seems like the behavior of closed source development pods has changed in a potentially unexpected way (or we don't know what development pods are). Is there any documentation on how development pods work?

@mcdonamp There shouldn't be a change in how targets are generated for vendored frameworks — we have stopped generating targets for them in 0.37 when we implemented dynamic framework support, IIRC (could also have been 0.38).

I didn't realise Firebase was a static framework initially, transitively depending on those while also using use_frameworks! has always been unsupported by CocoaPods. The difference between 0.39 and 1.0 here might be #5789, where folks might have gotten a more explicit error for this scenario before, but seemingly not anymore in some situations.

Awesome, thanks for the pointer. Yes, we're (unfortunately) still shipping as a static framework, so this makes sense that it's a "transitive deps on static binaries" issue. It would be nice to see that error again :)

In general, we're comfortable with CP's decision to not support this (given that this is the direction that Apple has pushed folks). That said, dynamic has a huge potential performance issue (+10ms load time before main() for each dynamic framework loaded, and Apple recommends using no more than six dynamic libs per app), which makes use_frameworks! as default super problematic for apps that take on a number of dependencies (pulling in all the pieces of Firebase, for instance). This is, I assume, why SPM currently only builds static libs, and since there's no Swift ABI compatibility, requires open source.

Seems like the options for folks vendoring sets of frameworks are pretty bad: don't support a package manager, hit the transitive deps issue, devs take a performance hit on app start, or open source everything. Or keep everything in Obj-C and do static only ;)

Am I missing something here?

I agree that there isn't a great solution here, mostly because the tooling reality dictates that using Swift means also using dynamic libraries (Xcode doesn't really support it any other way and also dylibs are required for ObjC interoperability to work).

An option for you might be to offer two separate Pods, so that Pods written in Swift could depend on a dynamic version of Firebase. There would still be the issue that using ObjC Pods transitively depending on the static version wouldn't be supported if the app opts into use_frameworks!, but that's already the case in the current setup.

The tooling outside of SPM does, yes. SPM will likely change the way developers do this since it can build the proper static libs :)

Yep, this is generally our current plan, though it's likely that we'll actually just switch our Pod to be dynamic only and provide static frameworks as a download outside of dependency managers that more conscious developers can include if performance is a serious issue for them.

Are there any workarounds for using firebase as a dependency of a third party library? I guess one way would be to install firebase manually by dragging the firebase framework files into the project instead of relying on cocoa pods?

@simonbengtsson the only solution I have found so far is to link all the deps statically and ship a vendored framework in the third party framework (this is what FirebaseUI does, and why it takes us so long to release).

Instead of:

  s.source       = { :git => 'https://github.com/firebase/firebaseui-ios.git' }

We have:

  s.source       = { :http => 'https://dl.google.com/firebase/firebaseui/ios/0_4_0/FirebaseUIFrameworks.zip' }

Not great, but it works...

@mcdonamp Can you elaborate a bit for me on how you link the debs and ship the vendors framework? I'm having a similar problem with the SplunkMint pod that I am trying to wrap up as a dependency in another framework that my app will use.

@codeman9 The easiest way to show it is to look at the differences between https://github.com/firebase/FirebaseUI-iOS/blob/master/FirebaseUI.podspec (what we ship, as a vendored framework--basically we wrap all the built frameworks up into a zip) and https://github.com/firebase/FirebaseUI-iOS/blob/master/FirebaseUI_dev.podspec (we build from source locally).

Guys, I'm asking your help. Already some days trying to add Firebase into my first framework. I tried via dependencies and via downloading framework manually and trying to link it. No success.
Can you please help, how to link it?
https://github.com/YauheniYarotski/YourApps

Some of the Firebase modules have other static dependencies which you have to include as well. It all kind depends on which modules you want. This is what I did to link Firebase into a pod:

  s.source_files = 'MyPod/Classes/**/*'

  # Specify what libraries this depends on.
  s.libraries = [
    'c++', # FirebaseAnalytics.
    'icucore', # FirebaseDatabase.
    'sqlite3', # FirebaseAnalytics.
    'z', # FirebaseAnalytics.
  ]

  # Specify what frameworks this depends on.
  s.frameworks = [
    'AddressBook', # FirebaseAnalytics.
    'AdSupport', # FirebaseAnalytics.
    'CFNetwork', # FirebaseDatabase.
    'CoreGraphics',
    'SafariServices', # FirebaseAnalytics.
    'Security', # FirebaseAnalytics, FirebaseAuth, FirebaseDatabase.
    'StoreKit', # FirebaseAnalytics.
    'SystemConfiguration', # FirebaseAnalytics, FirebaseDatabase.
    'UIKit',
  ]

  # Specify the frameworks we are providing.
  # The app using this Pod should _not_ link these Frameworks,
  # they are bundled as a part of this Pod for technical reasons.
  s.vendored_frameworks = [
    # Firebase Analytics.
    'MyPod/Frameworks/Firebase/Analytics/FirebaseAnalytics.framework',
    'MyPod/Frameworks/Firebase/Analytics/FirebaseInstanceID.framework',
    'MyPod/Frameworks/Firebase/Analytics/GoogleInterchangeUtilities.framework',
    'MyPod/Frameworks/Firebase/Analytics/GoogleSymbolUtilities.framework',
    'MyPod/Frameworks/Firebase/Analytics/GoogleUtilities.framework',

    # FirebaseAuth.
    'MyPod/Frameworks/Firebase/Auth/FirebaseAuth.framework',
    'MyPod/Frameworks/Firebase/Auth/GoogleNetworkingUtilities.framework',
    'MyPod/Frameworks/Firebase/Auth/GoogleParsingUtilities.framework',

    # FirebaseDatabase.
    'MyPod/Frameworks/Firebase/Database/FirebaseDatabase.framework',

    # FirebaseMessaging.
    'MyPod/Frameworks/Firebase/Messaging/FirebaseMessaging.framework',
    'MyPod/Frameworks/Firebase/Messaging/GoogleIPhoneUtilities.framework',
  ]

  # LDFLAGS required by Firebase dependencies.
  s.pod_target_xcconfig = {
    'OTHER_LDFLAGS' => '$(inherited) -ObjC',
  }

This is so limiting I'm spending way too much time on this. This broke in Cocoapods 1.0. It was working fine in Cocoapods 0.39.0. I should be spending this time developing.

In the example project for my pod, I added "${PODS_ROOT}" (with recursive enabled), to the Framework Search Paths build setting of the Pods project, and now my example project is building fine. Any thoughts? Is this a proper fix?

Ok so I finally found a solution that seems to be working for me. I added the following post install hook to my example project Podfile and ran a pod install.

post_install do |installer|
    installer.pods_project.targets.each do |target|
        if target.name == "MyAwesomePod"
            target.build_configurations.each do |config|
                config.build_settings['FRAMEWORK_SEARCH_PATHS'] = '${PODS_ROOT}/**'
            end
        end
    end
end

This hook would simply need to be added to the end of your Podfile (i.e. example project, main app project, etc.) when you want to use your pod.

Let me know what you guys think about this as a solution. I'm not sure why Cocoapods is not including this automatically.

Even with the above workaround, I still need to manually add all of the firebase frameworks to "link binary with libraries" phase (and the google frameworks that firebase depends on as well). Obviously not ideal.

Is there an ETA for fixing support for this?

@cezarywojcik you're welcome to take a shot at making a PR for this, it doesn't look like there are any PRs around this yet.

Any updates on this issue? This has been causing me grief for days. All of the posted workarounds cause numerous runtime errors along the lines of
objc[56634]: Class FIRAAppEnvironmentUtil is implemented in both /Users/user/Library/Developer/CoreSimulator/Devices/14AFCA37-612C-4B1B-B1DC-78741E1A070C/data/Containers/Bundle/Application/0D563A7E-4C45-4E01-858D-A6E2EE7E8E2F/MyApp.app/Frameworks/MyFramework.framework/MyFramework (0x1098e96d0) and /Users/user/Library/Developer/CoreSimulator/Devices/14AFCA37-612C-4B1B-B1DC-78741E1A070C/data/Containers/Bundle/Application/0D563A7E-4C45-4E01-858D-A6E2EE7E8E2F/MyApp.app/MyApp (0x1088b8688). One of the two will be used. Which one is undefined.
which seems to cause an FIRAppNotConfigured exception.

Those who suffers from it. My problem was like this,

I was having trouble with swift and xcode 8 build times. So i changed my scheme Edit Scheme -> Build -> Find Implicit Dependencies (Uncheck). I was not get trouble with simulator i was having trouble with device. So when i change it to check again it worked. And then made uncheck or vice versa.

@dbburgess Do you have a repository with a working example of your workaround? I could not make it work in my own project. Maybe I missed something.

edit: Here is a very simple podlib depending on firebase. Its only code is import Firebase. What can I do to get the command pod lib lint succeed?

Obviously for the moment it stops on the Firebase import. But with your piece of code it stays the same.

-> FoobarLib (0.1.0)
    - ERROR | [iOS] xcodebuild: Returned an unsuccessful exit code. You can use `--verbose` for more information.
    - ERROR | [iOS] xcodebuild:  ~/FoobarLib/Classes/Foobar.swift:1:8: error: no such module 'Firebase'

@mcdonamp Could you have a clue ?

@azmeuk No, unfortunately, the repo I implemented it in is private. I took a quick look at the repo you provided, and it's not statically linking Firebase at all. Check out the instructions for integrating without CocoaPods in the docs. That was my starting point.

Essentially, I created a Frameworks/Firebase folder in my lib (just in the directory structure, not in Xcode) and added each Firebase component I needed from the zip file provided by Firebase in it's own folder (for example, Frameworks/Firebase/FirebaseDatabase/FirebaseDatabase.framework). The code I posted above is what my .podspec file looks like that ensures each Firebase component and it's dependencies are statically linked.

It took a little bit of fiddling, but once it was all setup, everything seemed to be working happily for the most part. I hope that's helpful!

My minimal lib repository has been updated and now embeds Firebase. I tried to play with the FRAMEWORK_SEARCH_PATHS, USER_HEADER_SEARCH_PATHS, SWIFT_INCLUDE_PATHS... options, but I could not manage to have something that worked.

I feel that It would take a few configuration lines to get it work, but I truly do not know what to do.

Would anyone take some minutes to help me? A PR would be great. I think it would benefits several people since this thread is becoming long and old and no simple solution has emerged so far.

Any Updates ?

@azmeuk @OnurVar See my PR on your repo. I hope it's helpful.

I just tested. It seems to work. I think the tricky part was the fact that import Firebase did not work, but import FirebaseDatabase did. Thanks a lot!

edit: There are sometimes one might want to import Firebase, for instance, in order to access the FIRApp object, that is needed to initialize FirebaseMessaging. At the moment it still does not work. Thanks anyway.

I'm pretty sure import Firebase is just referencing a header / module map that imports all of the dependent modules, but doesn't actually provide any code itself. FIRApp is defined in FirebaseAnalytics, so that's all you need to import to run FIRApp.configure().

You are right. This time it works! Thank you.

I have some news :) The following code works well with a swift application, but does not compile with an Objective-C application. I have updated my repository.

import FirebaseAnalytics
import FirebaseMessaging

open class FooStuff : NSObject {
    open func foo () {
        print("Firebase \(FIRApp.version())")
    }
}

extension FooStuff : FIRMessagingDelegate {
    public func applicationReceivedRemoteMessage(_ remoteMessage: FIRMessagingRemoteMessage) {}
}

The import FirebaseMessaging line in FoobarLib-Swift.h complains that it does not find the FirebaseMessaging module. Does anyone have an idea?

Some answers about Dynamic Framework : url

There hasn't been any activity on this issue recently. Due to the high number of incoming GitHub notifications, we have to clean some of the old issues, as many of them have already been resolved with the latest updates.

Is there a true workaround ?
I tried every method i could find and this cannot build my framework with my main project, so annoying ! (and yes it is firebase related)
The worse thing is that if i remove firebase from my framework now it is crashlytics that will not be imported, i don't get it

@azmeuk i don't understand your podfile, i thought pods add to be specified there AND in the podspec, did i miss something?

There hasn't been any activity on this issue recently. Due to the high number of incoming GitHub notifications, we have to clean some of the old issues, as many of them have already been resolved with the latest updates.

This issue will be auto-closed because there hasn't been any activity for a few months. Feel free to open a new one if you still experience this problem :+1:

I don't know if this may be of any help, but I stumbled into a very similar problem (the build breaks with Missing required module Firebase) while working on a cocoapod that is shipped with a vendored_frameworks that eventually uses import Firebase.

In the end, the (kind of brute force) workaround I found was to add the following to my .podspec:

s.dependency 'Firebase'
s.xcconfig = { 'SWIFT_INCLUDE_PATHS' => '$(PODS_ROOT)/Firebase/Core/Sources' }

with this, the final application using my cocoapod compiles fine and is able to resolve the import Firebase statement. :)

Was this page helpful?
0 / 5 - 0 ratings

Related issues

soleares picture soleares  Â·  3Comments

luhui picture luhui  Â·  3Comments

pronebird picture pronebird  Â·  3Comments

dawnnnnn picture dawnnnnn  Â·  3Comments

evermeer picture evermeer  Â·  3Comments