JUCE and React Native - linker error "ld: library not found for -lReact"

I get this linker error using CocoaPods with React Native: ld: library not found for -lReact

I followed the guide at https://facebook.imtqy.com/react-native/docs/embedded-app-ios.html#content

I am trying to integrate with an existing iOS project, which is a JUCE C ++ project. JUCE creates the Xcode project file, so I believe that I need to use the Cocoapods method.

I am doing the following steps:

  • create or save an iOS build from the Introjucer project
  • run npm install react-native from the project root (along with the .jucer file)
  • create a subfile in Builds/iOS according to the manual (but with ../../node_modules as the path)
  • run pod install
  • open workspace in Xcode
  • configure GCC_PREPROCESSOR_DEFINITIONS to include $(inherited)
  • to build

An example project showing this problem is located at https://github.com/adamski/juce-native-navigation/tree/react-native-cocoapods

I think something is happening with the project created by Introjucer since I tried the whole process on a new new Xcode project and it works great.

I also tried adding libReact.a to the "Linking binaries to libraries" section, but it didn't seem to help.

+2
source share
4 answers

I was looking for differences between a project generated by Introjucer and generated by Xcode.

One significant difference was CONFIGURATION_BUILD_DIR or "Per-configuration Build Products Path"

I copied the setting from the generated Xcode project $(BUILD_DIR)/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)

This allowed to complete the connection and give a successful build :)

+2
source

Some steps may not be required and cause problems with other, larger problems that are hidden. In particular:

 adjust GCC_PREPROCESSOR_DEFINITIONS to include $(inherited) 

Namely, pod install scripts should use the magic of $(inherited) for you.

Can a reset configuration help?

+1
source

Go to your project -> Your goal -> Build settings -> Link the binaries to the libraries, and you can see some red entries there, referencing the React library files here. Just delete these red entries and you should be good to go.

+1
source

Go to your Project -> Your Target -> Build Phases -> Link Binary With Libraries, and you can see some red entries referring to the React library files here. Just delete these red entries and you should be good to go.

If there are no red entries, then just check to see if there are any items in the list of links in the Binary Links with Libraries list that you deleted from the React project using the "npm uninstall lib_name" command.

0
source

Source: https://habr.com/ru/post/1216313/


All Articles