简体   繁体   English

JUCE和React Native - 链接器错误“ld:找不到-lReact的库”

[英]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 我使用CactPods与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 我已按照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. 我正在尝试与现有的iOS项目集成,这是一个JUCE C ++项目。 JUCE generates the Xcode project file so I believe I need to use the Cocoapods method. JUCE生成Xcode项目文件,所以我相信我需要使用Cocoapods方法。

The steps I'm doing are: 我正在做的步骤是:

  • create or save iOS build from Introjucer project Introjucer项目创建或保存iOS版本
  • run npm install react-native from root of project (alongside the .jucer file) 从项目的根目录运行npm install react-native (与.jucer文件一起)
  • create Podfile in Builds/iOS as per the guide (but with ../../node_modules as the path) 根据指南在Builds/iOS创建Podfile(但以../../node_modules作为路径)
  • run pod install 运行pod install
  • open workspace in Xcode 在Xcode中打开工作区
  • adjust GCC_PREPROCESSOR_DEFINITIONS to include $(inherited) 调整GCC_PREPROCESSOR_DEFINITIONS以包含$(inherited)
  • build 建立

An example project displaying this issue is at https://github.com/adamski/juce-native-navigation/tree/react-native-cocoapods 显示此问题的示例项目位于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. 我认为Introjucer生成的项目正在发生一些事情,因为我在一个全新的Xcode项目上尝试了整个过程并且构建良好。

I have also tried adding libReact.a to the 'Link Binary With Libraries' section but that does not seem to have helped. 我也尝试将libReact.a添加到'Link Binary With Libraries'部分,但这似乎没有帮助。

I looked for differences between the Introjucer generated project and the Xcode generated one. 我查找了Introjucer生成的项目与Xcode生成的项目之间的差异。

One significant difference was the CONFIGURATION_BUILD_DIR or "Per-configuration Build Products Path" 一个显着的区别是CONFIGURATION_BUILD_DIR或“按配置构建产品路径”

I copied over the setting from the Xcode generated project $(BUILD_DIR)/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME) 我从Xcode生成的项目$(BUILD_DIR)/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)复制了设置

This allowed the linking to complete and gave a successful build :) 这允许链接完成并成功构建:)

Go to your Project -> Your Target -> Build Phases -> Link Binary With Libraries and you might see some red entries there referring to the React library files here. 转到您的项目 - >您的目标 - > 构建阶段 - >使用库链接二进制文件,您可能会在此处看到一些红色条目引用React库文件。 Just remove those red entries and you should be good to go. 只需删除那些红色条目,你应该好好去。

If there are no red entries, then just check that the list of libs in Link Binary With Libraries list has no items which you removed from React project using 'npm uninstall lib_name' command. 如果没有红色条目,那么只需检查Link Binary With Libraries列表中的lib列表没有使用'npm uninstall lib_name'命令从React项目中删除的项目。

Some steps may not be necessary and bring concerns of other, larger issues being hidden. 某些步骤可能没有必要,并且会隐藏其他更大问题。 Specifically: 特别:

adjust GCC_PREPROCESSOR_DEFINITIONS to include $(inherited)

Namely, pod install scripts are supposed to do the $(inherited) magic for you. 也就是说, pod install脚本应该为你做$(inherited)魔术。

Could a configuration reset be of help? 配置重置是否有帮助?

Go to your Project -> Your Target -> Build Settings -> Link Binary With Libraries and you might see some red entries there referring to the React library files here. 转到您的项目 - >您的目标 - >构建设置 - >链接二进制文件库,您可能会看到一些红色条目,这里引用了React库文件。 Just remove those red entries and you should be good to go. 只需删除那些红色条目,你应该好好去。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM