WatermelonDB icon indicating copy to clipboard operation
WatermelonDB copied to clipboard

React Native iOS build failed because "'simdjson.h' file not found"

Open backmeupplz opened this issue 3 years ago • 16 comments

I'm not sure what's going on. My RN version is 0.64.2, watermelondb version is 0.23.0-9

Screen Shot 2021-06-24 at 8 52 06 AM

backmeupplz avatar Jun 24 '21 15:06 backmeupplz

Same happens on watermelondb version 0.23.0-11

backmeupplz avatar Jun 24 '21 15:06 backmeupplz

Here's my Podfile in case you need it:

platform :ios, '12.0'
require_relative '../node_modules/react-native/scripts/react_native_pods'
require_relative '../node_modules/@react-native-community/cli-platform-ios/native_modules'

inhibit_all_warnings!

target 'Todorant' do
  # React native
  config = use_native_modules!
  use_react_native!(:path => config["reactNativePath"])

  # The rest
  use_native_modules!
  pod 'RNReanimated', :path => '../node_modules/react-native-reanimated'

  pod 'RNGestureHandler', :path => '../node_modules/react-native-gesture-handler'
  pod 'react-native-camera', :path => '../node_modules/react-native-camera'
  
  permissions_path = '../node_modules/react-native-permissions/ios'
  pod 'Permission-Camera', :path => "#{permissions_path}/Camera.podspec"
  pod 'Permission-Siri', :path => "#{permissions_path}/Siri.podspec"
  
  pod 'RNVectorIcons', :path => '../node_modules/react-native-vector-icons'

  pod 'React-jsi', :path => '../node_modules/react-native/ReactCommon/jsi', :modular_headers => true
end

target 'TodorantToday' do
  pod 'Alamofire', '~> 5.0'
  pod 'SwiftKeychainWrapper'
end

target 'TodorantHomescreen' do
  pod 'Alamofire', '~> 5.0'
  pod 'SwiftKeychainWrapper'
end

target 'TodorantIntents' do
  pod 'Alamofire', '~> 5.0'
  pod 'SwiftKeychainWrapper'
end

target 'Todorant-watchOS Extension' do
  platform :watchos, '7.0'
  pod 'Alamofire', '~> 5.0'
  pod 'KeychainAccess'
end

post_install do |pi|
  pi.pods_project.targets.each do |t|
    t.build_configurations.each do |config|
      config.build_settings['IPHONEOS_DEPLOYMENT_TARGET'] = '12.0'
    end
  end
end

And my bridging header:

#import <React/RCTBundleURLProvider.h>
#import <React/RCTRootView.h>
#import <React/RCTViewManager.h>
#import <React/RCTBridgeModule.h>

#import "../../node_modules/@nozbe/watermelondb/native/ios/WatermelonDB/SupportingFiles/Bridging.h"

backmeupplz avatar Jun 24 '21 16:06 backmeupplz

I've got the dependency in the yarn.lock, but not in the podfile lock 🤔

Screen Shot 2021-06-24 at 9 02 05 AM

backmeupplz avatar Jun 24 '21 16:06 backmeupplz

Hm, it doesn't look like simdjson.h is a part of the binary

backmeupplz avatar Jun 24 '21 16:06 backmeupplz

Version 0.22.0 works well though.

backmeupplz avatar Jun 24 '21 16:06 backmeupplz

@backmeupplz Please read the changelog-unreleased & installation guide more carefully, and then tell me if you still run into troubles

radex avatar Jun 24 '21 16:06 radex

did you get fix friend?? i have same issue with expo

"@nozbe/watermelondb": "^0.23.0", "react-native": "~0.63.4", "expo": "~42.0.1",

pod 'React-jsi', :path => '../node_modules/react-native/ReactCommon/jsi', :modular_headers => true

pod 'simdjson', path: '../node_modules/@nozbe/simdjson'

rodrigogaraujo avatar Aug 25 '21 20:08 rodrigogaraujo

@rodrigogaraujo, have you run pod install in your ios directory?

kevinwcyu avatar Sep 15 '21 11:09 kevinwcyu

Hi,

My Environment:

React native: 0.65.1 Watermelon: 0.23.0

I was having the same problem. For me the problem was gone when i did two steps:

First: in the project_name-Bridging-Header.h i changed this part:

#import "../../node_modules/@nozbe/watermelondb/native/ios/WatermelonDB/SupportingFiles/Bridging.h"

for this

#import "../node_modules/@nozbe/watermelondb/native/ios/WatermelonDB/SupportingFiles/Bridging.h"

Second: i open projectname.xcworkspace with xcode and run my project with success.

Before I was opening the project file projectname.xcodeproj and i did receiving this error.

or you can compile the project with success running the command:

yarn ios or npm run ios in the root folder project

ebnersilva avatar Sep 18 '21 22:09 ebnersilva

I followed steps from installation guide and I've got the same problem using watermelondb version 0.24.0, any solution for that?

aleksandraszpila avatar Nov 02 '21 09:11 aleksandraszpila

+1

tom-krusch avatar Nov 08 '21 13:11 tom-krusch

Same problem here.

AndreCosta101 avatar Nov 09 '21 21:11 AndreCosta101

Hello guys,

This is what's worked for me:

  1. Go to node_modules/@nozbe/simdjson/src

    • Copy those 2 files “simdjson.cpp” and “simdjson.h”

Captura de Tela 2021-12-02 às 00.41.08.png

  1. Go to node_modules/@nozbe/watermelondb/native/shared

    • Paste the files that you copied above “simdjson.cpp” and “simdjson.h”

Captura de Tela 2021-12-02 às 00.39.50.png

  1. Execute the comand yarn run ios , for me worked.

Make sure that you edited your podfile and write the 2 lines below:

    pod 'React-jsi', :path => '../node_modules/react-native/ReactCommon/jsi', :modular_headers => true
    pod 'simdjson', path: '../node_modules/@nozbe/simdjson'

Font: https://nozbe.github.io/WatermelonDB/Installation.html

Some erros shows up, and this is how I fix:

  • In the first time, I got a message (fatal error: malformed or corrupted AST file…), with this, I have to go in the /Users/YOURUSERNAME/Library/Developer/Xcode/DerivedData and clean all the files in this folder before a try to make a new compilation.

  • To make sure that everything will works well, I deleted my folder Pods inside tha "ios" folder, and after I execute the command pod install to build this folder again. (Make sure you have the backup)

  • I deleted my folder node_modules to and download again with the command yarn install.

I hope this helps someone, bye bye ;)

jamesjlv avatar Dec 02 '21 03:12 jamesjlv

+1

meedwire avatar May 25 '22 18:05 meedwire

Here's my Podfile in case you need it:

platform :ios, '12.0'
require_relative '../node_modules/react-native/scripts/react_native_pods'
require_relative '../node_modules/@react-native-community/cli-platform-ios/native_modules'

inhibit_all_warnings!

target 'Todorant' do
  # React native
  config = use_native_modules!
  use_react_native!(:path => config["reactNativePath"])

  # The rest
  use_native_modules!
  pod 'RNReanimated', :path => '../node_modules/react-native-reanimated'

  pod 'RNGestureHandler', :path => '../node_modules/react-native-gesture-handler'
  pod 'react-native-camera', :path => '../node_modules/react-native-camera'
  
  permissions_path = '../node_modules/react-native-permissions/ios'
  pod 'Permission-Camera', :path => "#{permissions_path}/Camera.podspec"
  pod 'Permission-Siri', :path => "#{permissions_path}/Siri.podspec"
  
  pod 'RNVectorIcons', :path => '../node_modules/react-native-vector-icons'

  pod 'React-jsi', :path => '../node_modules/react-native/ReactCommon/jsi', :modular_headers => true
end

target 'TodorantToday' do
  pod 'Alamofire', '~> 5.0'
  pod 'SwiftKeychainWrapper'
end

target 'TodorantHomescreen' do
  pod 'Alamofire', '~> 5.0'
  pod 'SwiftKeychainWrapper'
end

target 'TodorantIntents' do
  pod 'Alamofire', '~> 5.0'
  pod 'SwiftKeychainWrapper'
end

target 'Todorant-watchOS Extension' do
  platform :watchos, '7.0'
  pod 'Alamofire', '~> 5.0'
  pod 'KeychainAccess'
end

post_install do |pi|
  pi.pods_project.targets.each do |t|
    t.build_configurations.each do |config|
      config.build_settings['IPHONEOS_DEPLOYMENT_TARGET'] = '12.0'
    end
  end
end

And my bridging header:

#import <React/RCTBundleURLProvider.h>
#import <React/RCTRootView.h>
#import <React/RCTViewManager.h>
#import <React/RCTBridgeModule.h>

#import "../../node_modules/@nozbe/watermelondb/native/ios/WatermelonDB/SupportingFiles/Bridging.h"

You are missing the other two required pod lines - from the installation guide, section 3. : https://nozbe.github.io/WatermelonDB/Installation.html

pod 'WatermelonDB', :path => '../node_modules/@nozbe/watermelondb'

pod 'React-jsi', :path => '../node_modules/react-native/ReactCommon/jsi', :modular_headers => true

pod 'simdjson', path: '../node_modules/@nozbe/simdjson'

hope that helps. Also. I had the same error but was because I had the pod install outside of the correct target . Once I put all 3 of those inside the main target, yarn install / cd ios && pod install worked as expected.

programminPete avatar Jul 08 '22 20:07 programminPete

Building simdjson as a static library fixed it for me:

pre_install do |installer|
  Pod::Installer::Xcode::TargetValidator.send(:define_method, :verify_no_static_framework_transitive_dependencies) {}
  installer.pod_targets.each do |pod|
    staticPods = ['simdjson']
    if staticPods.include?(pod.name) then
      puts "Fixing " + pod.name + " build type..."
      def pod.build_type;
        Pod::BuildType.static_library
      end
    end
  end
end

mfbx9da4 avatar Jul 28 '22 11:07 mfbx9da4

Hello guys,

This is what's worked for me:

  1. Go to node_modules/@nozbe/simdjson/src

    • Copy those 2 files “simdjson.cpp” and “simdjson.h”

Captura de Tela 2021-12-02 às 00.41.08.png

  1. Go to node_modules/@nozbe/watermelondb/native/shared

    • Paste the files that you copied above “simdjson.cpp” and “simdjson.h”

Captura de Tela 2021-12-02 às 00.39.50.png

  1. Execute the comand yarn run ios , for me worked.

Make sure that you edited your podfile and write the 2 lines below:

    pod 'React-jsi', :path => '../node_modules/react-native/ReactCommon/jsi', :modular_headers => true
    pod 'simdjson', path: '../node_modules/@nozbe/simdjson'

Font: https://nozbe.github.io/WatermelonDB/Installation.html

Some erros shows up, and this is how I fix:

  • In the first time, I got a message (fatal error: malformed or corrupted AST file…), with this, I have to go in the /Users/YOURUSERNAME/Library/Developer/Xcode/DerivedData and clean all the files in this folder before a try to make a new compilation.
  • To make sure that everything will works well, I deleted my folder Pods inside tha "ios" folder, and after I execute the command pod install to build this folder again. (Make sure you have the backup)
  • I deleted my folder node_modules to and download again with the command yarn install.

I hope this helps someone, bye bye ;)

Hi @jamesjlv thanks a lot by the solution. I have added a little command at xcode that did the same that you did.

Captura de Tela 2022-10-19 às 10 45 59

renatobentorocha avatar Oct 20 '22 21:10 renatobentorocha

For those looking to copy pasta the script in the above screenshot:

cp "${PROJECT_DIR}/../node_modules/@nozbe/simdjson/src/simdjson.cpp" "${PROJECT_DIR}/../node_modules/@nozbe/watermelondb/native/shared/simdjson.cpp"

cp "${PROJECT_DIR}/../node_modules/@nozbe/simdjson/src/simdjson.h" "${PROJECT_DIR}/../node_modules/@nozbe/watermelondb/native/shared/simdjson.h"

chiubaka avatar Dec 12 '22 07:12 chiubaka

Should be fixed in 0.26

radex avatar Feb 03 '23 22:02 radex