Realm-cocoa: [RealmSwift] CocoaPods cannot find Realm.h when resolving RealmSwift's private modulemap

Created on 12 May 2015  Â·  39Comments  Â·  Source: realm/realm-cocoa

Firstly, awesome product, guys, it's really a joy to use!

Context:
Using Cocoapods 0.37.1
Targeting iOS 8.0
Language: Swift

I was using Realm cocoa until I upgraded to 0.92.2 two days ago. Everything was working great until the upgrade. Now I get the above error when building.

I read the new, updated instructions for RealmSwift, altered my Podfile to use that instead of Realm, and changed my imports from Realm to RealmSwift (and RLMRealm to Realm, etc).

T-Bug

All 39 comments

same here. needed to downgrade back again.

Have you tried forcing the reinstallation of Realm & Realm Swift?

rm -r Pods/Realm*
rm -r ~/Library/Caches/CocoaPods/Pods/Released/Realm*
pod install

I did try that, yes. No joy.

Perhaps your Xcode project is set up differently than what we're using to test this on our end?

We verify our that our installation methods (including CocoaPods) work every time we push code to the master branch and those tests continue to pass.

Can you try running pod install with the following project and let us know if it works for you? https://github.com/realm/realm-cocoa-installation-samples/tree/master/ios/swift/CocoaPodsExample

If it does, I suspect your Xcode project's configuration is preventing Realm Swift from being installed properly. If it doesn't, I suspect there's something wrong with your local version of CocoaPods.

That example project worked fine for me.

I'll take another look at my project to see if I can spot anything suspicious.

I am having same issue. Downgrading to 0.92.2 also didn't work for me. Have you found any solution? Why has this issue been removed from pending?

So far, the only solution I found is to downgrade to 0.91. Still trying to find another one though.

Cloning my project afresh and installing 0.92.3 worked for me. (Pods directory was in .gitignore, so wasn't synced)

That didn't work for me, unfortunately.

@e7hz3r0 can you please share a project with us that reproduces the issue you were seeing?

I'm now also getting this problem with the newest version.
Made me start new project from scratch.. but as soon as I included import RealmSwift and hit build got this error.
[...]/Pods/Realm/Realm/module.modulemap:2:21: Umbrella header 'Realm.h' not found
Cleaning / purging / rebuilding wouldn't help.
I also tried including a bridging file (something I don't have to do since RealmSwift came out), but to no avail. I'm using cocoapods installation as usual

I recommend that everyone who is having trouble installing Realm Swift via CocoaPods try our installation example as noted in my previous comment (https://github.com/realm/realm-cocoa/issues/1918#issuecomment-101467542). This should help you (and us) narrow down why it's not working on your machine or in your project.

I did some digging and here's what I have found.
I had two new projects which were identical (both using cocoapods), but with the difference that one (project 1) contained a bunch of cocoa pods and the other (project 2) just RealmSwift (and Realm as dependency).

Project 2 would build right away. Project 1 wouldn't. Long story short:
I managed to build Project 1 AFTER I stopped using obj-c header file and removed these two options from target Build Settings:
screen_shot_2015-05-23_at_08_59_57

The main pain being User Header Search Paths (which is installed when adding obj-c header file and looks something line this $(SRCROOT)) but I guess I still need this for non swift pods to play along?

Hope that helps fixing this.

Thanks for posting those steps, @staticdreams. I can't necessarily confirm that they're appropriate, but then again I haven't been able to reproduce this issue myself, so it's worth a shot.

I'll be closing this issue for the time being, but will reopen if we see more reports of Umbrella header Realm.h not found from module.modulemap.

I've recreated the issue in a new project (sorry, I would have done this sooner except is was a long weekend in the US): https://github.com/e7hz3r0/RealmSwift-Test-App

Ok, we'll take a look, thanks!

I believe I've identified the problem and have filed a PR against your sample project here: https://github.com/e7hz3r0/RealmSwift-Test-App/pull/1. Let's continue the conversation there, as I don't believe this is an issue with Realm, but rather a CoocaPods limitation.

Okay, interesting. After merging that PR, I played around a little and found that I could only use RealmSwift and Evernote (necessary for the project that I originally found the problem in) if I:

  1. Didn't use CocoaPods at all and included both frameworks manually
  2. Used CocoaPods for Evernote, but included RealmSwift manually

So using CocoaPods for RealmSwift and _not_ for Evernote, resulted in the same issue as above. This is unfortunate because Realm updates more frequently than Evernote.

You could also update Evernote's podspec to support building with use_frameworks!.

I algo got this error, installed realm the first time, v.0.93.2, XCode 6.3.2, cocoapods 0.37.2

I have a multitarget project (OSX/iOS) and I'm using a bridging header for both (need it for other pods).

User Header Search Paths has Pods/**, I need this to get my pods working.

This is my podfile:

def shared
    use_frameworks!
    pod 'Alamofire', '~> 1.2'
    pod 'Valet', '~> 1.3'
    pod 'RealmSwift'
end

target ‘myproj_osx' do
    platform :osx, '10.10'
    shared
end

target 'myproj_ios’ do
    platform :ios, '8.0'
    pod 'WYPopoverController', '~> 0.2.2'
    shared
end

target 'myproj_tests' do
    platform :osx, '10.10'
    shared
    pod 'Quick', '~> 0.3.0'
    pod 'Nimble', '~> 0.4.0'

end

Before adding realm everything was working...

Besides of that it's maybe worth adding here that the manual installation dragging into embedded frameworks also doesn't seem to work for multitarget. Dragging to the iOS target works, but when I drag after it the OSX framework to the OSX target XCode shows unknown error.

I found the issue - it was the Pods/** in the User Header Search Paths. I added this to fix an issue I had in the past with the multitarget setup, but it seems to be gone now. I removed it and everything works.

I also cleaned up the pods installation directories as @segiddins suggested in the mailing list, which probably is the reason that it works now without Pods/**.

@i-schuetz I faced the same issue just now. Pods/** just worked for me like a charm! Thanks!

I have the same problem, i just switch between branches in my project, run pod install and this error appear the Pods/**. didn't work for me because i did't do anything with my project build config.
The error appeared just by creating another branch and run pod install.
I have reviewed other solutions like delete the pods cache and pod folder, and run pod install again but still no luck

CocoaPods doesn't support mixing frameworks with non-frameworks in your Podfile. Please use only frameworks or none at all.

I've got the same issue and can't fix it. Even with all hints and tips described here in the comments I can't fix it. Same when using the framework binary instead.

@frgmt: Which version of the toolchain and CocoaPods do you use?

I solved the problem by deleting the cocoapods gem


# remove all old versions of the gem
gem cleanup cocoapods

# choose which ones you want to remove
gem uninstall cocoapods

and deleting all the pods folders, then i run

sudo gem install cocoapods

and finally

pod install

@jplazcano87: Thanks for reporting that here. Note that you can always use pod --version to validate which version of CocoaPods will be executed, if you have multiple versions installed at different paths, so it depends on your environment. You can select one specific by running e.g. pod _0.39.0_ install.

I got it work with updating to beta version 1.0.0.beta.6 of CocoaPods.
Everything else wasn't working for me.

It worked for me.
1.sudo gem uninstall cocoapods -v 0.39
2.sudo gem install cocoapods -v 0.38.2

maybe this will help someone else, but I had to use Pods/**/** (Notice the extra /**).

Spent a whole day debugging this! :@

If that can help... contrary to other pods, Realm doesn't expose its public headers in the public section, but in the project one.
Putting them back in the correct section solves the issue.

@rdlopes, if you're seeing problems integrating Realm using CocoaPods, please file a new issue with information about which version of Realm you're attempting to use and with which version of CocoaPods you're seeing the problem with. To the best of our knowledge both Realm and RealmSwift work correctly with CocoaPods v0.39 and the 1.0.0 betas (from beta 4 onwards). If there are problems we'd like to hear about them and address them.

FWIW I just had the same issue and after some head scratching, moved Realm-iOS and Realm-OSX headers from the Project Headers section to the Public Headers section and that did the trick.

Note that the project was previously working perfectly fine, built with CP 0.39.0 and Realm 0.98.x. But then I decided it was time for The Great Migrationâ„¢ (CP 1.0 and latest Realm) and boom...

@bdash I don't have problems with Realm cause I stopped using it, felt too unstable.

But you do have a problem, and I was providing you with the solution.

Simple.

PS: first time I get a "file a bug" reply when I'm providing help.

@rdlopes we appreciate the time you've taken to share the issues you've faced and the workarounds that worked for you. The reality is that we get a large number of reports that omit crucial details like the versions of Realm and other relevant tools like CocoaPods and in these cases we encourage users to file more detailed bug reports so we can better help you.

@fpillet I think you may have been bit by CocoaPods/CocoaPods#5313 which, despite our best efforts to support CocoaPods 1.0 in its RC phase, snuck in before the official release 😬 . @mrackwitz has already submitted a fix to CocoaPods (CocoaPods/CocoaPods#5352) which should be included in CocoaPods 1.0.1. Until then, we recommend OS X builders to use CocoaPods 0.39.0. I apologize for the inconvenience.

@jpsim thanks for the additional info. Yes it looks like that's what happened! Not complaining though, I assumed that this was an issue with CP rather than with Realm itself.

@jpsim sorry I'm stranger to bullshit especially when I get a "I don't know any problem with Realm" while we're discussing a problem with Realm...

Again, I'm not sharing my "problems", I'm providing the users with the workaround, while you're still figuring out why you don't have your headers in the public section.

The rest is white noise, cause that's not my problem if you're struggling with issues management.

So stop the "thanks for sharing but bla bla bla and eventually f*ck off" line and don't assert you don't have any problems at all when we're discussing a problem.

That would be a perfect start and would avoid flaming by posters when they get replied with handful of bullshit.

I'm sorry for not being more clear, we appreciate you sharing your workaround, which is likely necessary due to CocoaPods/CocoaPods#5313, which has since been fixed in CocoaPods.

I'm afraid this conversation is no longer civil and am forced to lock this conversation. We encourage any further problems with CocoaPods integration to be filed as a new issue.

Was this page helpful?
0 / 5 - 0 ratings