Watermelondb: Cannot compile on iOS: RCTBridgeModule not found

Created on 30 Jan 2019  Â·  11Comments  Â·  Source: Nozbe/WatermelonDB

After importing i have this error on compilation: React/RCTBridgeModule.h file not found on /node_modules/@nozbe/watermelondb/native/ios/WatermelonDB/SupportingFiles/Bridging.h

Env

 "@nozbe/watermelondb": "0.10.0",
 "react": "16.7.0",
 "react-native": "0.57.8",

Error detailed

fatal error: file '/Users/roger/Documents/Workspace/MyApp-mobile/node_modules/@nozbe/watermelondb/native/ios/WatermelonDB/SupportingFiles/Bridging.h' has been modified since the precompiled header '/Users/roger/Library/Developer/Xcode/DerivedData/MyAppApp-edmewkjuqvjtfbefdabgnihcaibg/Build/Intermediates.noindex/PrecompiledHeaders/Bridging-swift_2Y45WZBKC0E5K-clang_1NVIN0G7H4M8K.pch' was built
note: please rebuild precompiled header '/Users/roger/Library/Developer/Xcode/DerivedData/MyAppApp-edmewkjuqvjtfbefdabgnihcaibg/Build/Intermediates.noindex/PrecompiledHeaders/Bridging-swift_2Y45WZBKC0E5K-clang_1NVIN0G7H4M8K.pch'
/Users/roger/Documents/Workspace/MyApp-mobile/node_modules/@nozbe/watermelondb/native/ios/WatermelonDB/SupportingFiles/Bridging.h:2:9: error: 'React/RCTBridgeModule.h' file not found
#import <React/RCTBridgeModule.h>
        ^
1 error generated.
<unknown>:0: error: failed to emit precompiled header '/Users/roger/Library/Developer/Xcode/DerivedData/MyAppApp-edmewkjuqvjtfbefdabgnihcaibg/Build/Intermediates.noindex/PrecompiledHeaders/Bridging-swift_2Y45WZBKC0E5K-clang_1NVIN0G7H4M8K.pch' for bridging header '/Users/roger/Documents/Workspace/MyApp-mobile/node_modules/@nozbe/watermelondb/native/ios/WatermelonDB/SupportingFiles/Bridging.h'

I tried cleaning buld folder and derived data.

React is linked via cocoapods

  pod 'React', :path => '../node_modules/react-native', :subspecs => [
  'Core',
  'CxxBridge',
  'DevSupport',
  'RCTActionSheet',
  'RCTAnimation',
  'RCTGeolocation',
  'RCTText',
  'RCTWebSocket',
  'RCTNetwork',
  'RCTVibration',
  'RCTSettings',
  'RCTAnimation',
  'RCTLinkingIOS',
  'RCTImage',
  'RCTWebSocket'
  ]

Most helpful comment

@andr3a88 I think your problem is that since you link React using CocoaPods instead of "traditionally", React is in a different place. check out the latest pre-release of Watermelon. It has this fix for expo projects: https://github.com/Nozbe/WatermelonDB/pull/227/files — if that doesn't work, play with header search paths in Xcode, and make sure it has the path to where React resides for you. If such change is necessary, please send a quick PR with the fix

All 11 comments

Have you tried disabling New build system in Xcode?

Yes, still not working.

@andr3a88 Is this project an ejected Expo project?

No, i used react-native init

Exactly same problem here. Followed all the instructions!

"@nozbe/watermelondb": "^0.10.0",
"react": "^16.5.2",
"react-native": "^0.57.1",

@banduk have you tried upgrading react-native to latest version?

@andr3a88 I think your problem is that since you link React using CocoaPods instead of "traditionally", React is in a different place. check out the latest pre-release of Watermelon. It has this fix for expo projects: https://github.com/Nozbe/WatermelonDB/pull/227/files — if that doesn't work, play with header search paths in Xcode, and make sure it has the path to where React resides for you. If such change is necessary, please send a quick PR with the fix

Thanks for the quick reply @radex !
I tried with no luck.

  • I also linked react native using cocoa pods, so I tried to add the path as in the patch ou sent. No luck
    The thing is that I cant find RCTBridgeModule.h in that location.

  • I then tried something I don't really know if should work: adding node_modules/react-native/React/Base to the Header Search Paths. There I can find RCTBridgeModule.h. But had no luck again

Any other clue?

@radex Actually I was trying to add the headers path to my project Header Search Paths.
When added to Watermelon Header Search Paths the error changed to

Undefined symbols for architecture arm64:
  "type metadata for Swift.Int32", referenced from:
      WatermelonDB.Database.count(Swift.String, [Any]) throws -> Swift.Int in libWatermelonDB.a(Database.o)
  "protocol witness table for Swift.Int : Swift.FixedWidthInteger in Swift", referenced from:
...
[a lot of Swift Types errors here]
...
ld: symbol(s) not found for architecture arm64
clang: error: linker command failed with exit code 1 (use -v to see invocation)

@banduk please send the patch with the header search path fix, and as for the other error — you didn't follow all the installation steps ;) https://github.com/Nozbe/WatermelonDB/blob/master/docs/Installation.md

@radex Sure, I forgot to get back to the docs, you're right!
I'll get back to this later today and send the PR.
Thanks!

Was this page helpful?
0 / 5 - 0 ratings