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

[RealmSwift] CocoaPods cannot find Realm.h when resolving RealmSwift's private modulemap #1918

Closed
e7hz3r0 opened this issue May 12, 2015 · 39 comments
Assignees
Labels

Comments

@e7hz3r0
Copy link

e7hz3r0 commented May 12, 2015

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).

@alexdd55
Copy link

same here. needed to downgrade back again.

@jpsim
Copy link
Contributor

jpsim commented May 12, 2015

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

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

@jpsim jpsim added the pending label May 12, 2015
@e7hz3r0
Copy link
Author

e7hz3r0 commented May 13, 2015

I did try that, yes. No joy.

@realm-ci realm-ci removed the pending label May 13, 2015
@jpsim
Copy link
Contributor

jpsim commented May 13, 2015

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.

@jpsim jpsim added the pending label May 13, 2015
@e7hz3r0
Copy link
Author

e7hz3r0 commented May 15, 2015

That example project worked fine for me.

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

@kapoorsahil
Copy link

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?

@e7hz3r0
Copy link
Author

e7hz3r0 commented May 20, 2015

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

@kapoorsahil
Copy link

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

@e7hz3r0
Copy link
Author

e7hz3r0 commented May 20, 2015

That didn't work for me, unfortunately.

@segiddins
Copy link
Contributor

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

@staticdreams
Copy link

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

@realm-ci realm-ci removed the pending label May 22, 2015
@jpsim
Copy link
Contributor

jpsim commented May 22, 2015

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

@staticdreams
Copy link

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.

@jpsim
Copy link
Contributor

jpsim commented May 26, 2015

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.

@jpsim jpsim closed this as completed May 26, 2015
@e7hz3r0
Copy link
Author

e7hz3r0 commented May 27, 2015

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

@jpsim
Copy link
Contributor

jpsim commented May 27, 2015

Ok, we'll take a look, thanks!

@jpsim jpsim reopened this May 27, 2015
@jpsim jpsim self-assigned this May 28, 2015
@jpsim jpsim changed the title [RealmSwift] Umbrella header Realm.h not found from module.modulemap [RealmSwift] CocoaPods cannot find Realm.h when resolving RealmSwift's private modulemap May 28, 2015
@jpsim
Copy link
Contributor

jpsim commented May 28, 2015

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

@jpsim jpsim closed this as completed May 28, 2015
@jpsim jpsim removed the P1 label May 28, 2015
@e7hz3r0
Copy link
Author

e7hz3r0 commented May 29, 2015

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.

@jpsim
Copy link
Contributor

jpsim commented May 29, 2015

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

@ivnsch
Copy link

ivnsch commented Jul 13, 2015

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.

@ivnsch
Copy link

ivnsch commented Jul 13, 2015

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/**.

@karzler
Copy link

karzler commented Jan 6, 2016

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

@jplazcano87
Copy link

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

@jpsim
Copy link
Contributor

jpsim commented Feb 15, 2016

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

@lennartstein
Copy link

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.

@mrackwitz
Copy link
Contributor

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

@jplazcano87
Copy link

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

@mrackwitz
Copy link
Contributor

@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.

@lennartstein
Copy link

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

@wishsoul
Copy link

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

@lakhman
Copy link

lakhman commented Apr 13, 2016

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

Spent a whole day debugging this! :@

@rdlopes
Copy link

rdlopes commented Apr 19, 2016

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.

@bdash
Copy link
Contributor

bdash commented Apr 19, 2016

@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.

@fpillet
Copy link

fpillet commented May 26, 2016

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...

@rdlopes
Copy link

rdlopes commented May 26, 2016

@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.

@jpsim
Copy link
Contributor

jpsim commented May 26, 2016

@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.

@fpillet
Copy link

fpillet commented May 26, 2016

@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.

@rdlopes
Copy link

rdlopes commented May 26, 2016

@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.

@jpsim
Copy link
Contributor

jpsim commented May 26, 2016

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.

@realm realm locked and limited conversation to collaborators May 26, 2016
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests