Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

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

I have followed the guide at https://facebook.github.io/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 generates the Xcode project file so I believe I need to use the Cocoapods method.

The steps I'm doing are:

  • create or save iOS build from Introjucer project
  • run npm install react-native from root of project (alongside the .jucer file)
  • create Podfile in Builds/iOS as per the guide (but with ../../node_modules as the path)
  • run pod install
  • open workspace in Xcode
  • adjust GCC_PREPROCESSOR_DEFINITIONS to include $(inherited)
  • build

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

I think there is something going on with the Introjucer generated project, as I tried the whole process on a fresh new Xcode project and it builds fine.

I have also tried adding libReact.a to the 'Link Binary With Libraries' section but that does not seem to have helped.

like image 457
Adamski Avatar asked Jan 06 '23 20:01

Adamski


1 Answers

I looked for differences between the Introjucer generated project and the Xcode generated one.

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

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

This allowed the linking to complete and gave a successful build :)

like image 161
Adamski Avatar answered Jan 16 '23 22:01

Adamski