realm-js: build failed: 'realm/util/assert.hpp' file not found
Goals
I want to build project successfully
Expected Results
build success
Actual Results
build failed: ‘realm/util/assert.hpp’ file not found
Steps to Reproduce
npm install --save realm pod install build
Version of Realm and Tooling
- Realm JS SDK Version: 3.4.2
- Node or React Native: Node 10.17.0 , React Native 0.60.5
- Client OS & Version: iOS
- Which debugger for React Native: ?/None
About this issue
- Original URL
- State: closed
- Created 5 years ago
- Reactions: 4
- Comments: 32 (13 by maintainers)
Okay - I believe I’ve found the root cause now. The RealmJS Podspec has a prepare_command which downloads Realm Core (which contains the missing header). When the repository is cloned and
pod install
is never called locally, this command is never called and the headers will be missing.A quick workaround for your project could be adding a
postinstall
script to your projectspackage.json
, runningnode node_modules/realm/scripts/download-realm.js ios --sync
:UPDATE: We’ve fixed this in the latest version of Realm JS, so there should be no reason to add ☝️ that …
@tisfeng Realm JS v3.6.0 was just released with a fix for your original issue. I would highly appreciate if you tried removing the “postinstall” hack, upgrade Realm JS to the latest version and confirm the fix?
The same goes for anyone else that might have used the “postinstall” fix: @N3TC4T, @froliveira94, @chaeunlee, @protez, @keima (judging from your reactions)
@N3TC4T Thanks for your comment! Please create an issue on the repository with a link to a repository with the least amount of code that reproduce your issue and instructions on the exact commands to run to get to the error. I would love to get rid of these header related bugs, once and for all.
@kraenhansen OK, I will try to upgrade later, but I may not have time to upgrade recently.
After I upgrade, I will inform you after confirming the result. Thank you.
@tisfeng I’m glad this fixed your immediate issue - thanks for the reproduction and your patience. I have a PR ready with a more permanent fix: https://github.com/realm/realm-js/pull/2623 - once merged and released, I would like for you to remove the “postinstall” script and test it again.
@kraenhansen Thanks, I tried the latest version (v3.6.0) but looks the issue is not fixed or at least not just for me.
Steps:
Your version of XCode should be fine 👍
Taking my fixed local branch and cloning it locally does indeed seem to bring back the error. One interesting observation is that running
pod install
will update theios/Podfile.lock
although nothing seemingly changed in theRealmJS
pod. I guess it’s from the changed paths in thenode_modules/realm/package.json
, but that doesn’t happen for other pods installed fromnode_modules
. I’ll investigate more.@kraenhansen My Xcode Version 11.2.1 (11B53)
@kraenhansen Yes, running pod install locally is a temporary workaround. . However, because our group uses Git to manage the entire cocopods file, if another colleague git pulls my commit, ideally, he should be able to compile successfully after executing npm install instead of running pod install again.
So, at the moment, I want to find a thorough solution that will allow my colleague to compile successfully without executing pod install after submitting the push code.
@tisfeng thanks for making a demo. I hope to be able to have a look at it today.
@kraenhansen I have pushed a test demo, can you please take a look https://github.com/tisfeng/RealmTestDemo/tree/realm_test_branch2
I have just run into this - appears to be a regression: #1449. pod deintegrate, pod install and rebuild appears to temporarily solve this.