我正在将我的应用程序升级到React Native v0.60.4。我完成了文档和升级帮助程序中的所有步骤,但是当尝试为iOS构建应用程序时,glog
的构建失败,并出现以下错误:
.../app/ios/Pods/glog/src/base/mutex.h:147:3: error: Need to implement mutex.h for your architecture, or #define NO_THREADS
# error Need to implement mutex.h for your architecture, or #define NO_THREADS
^
.../app/ios/Pods/glog/src/base/mutex.h:188:3: error: unknown type name 'MutexType'
MutexType mutex_;
找不到任何解决问题的方法。
我的Podfile:
platform :ios, '9.0'
require_relative '../node_modules/@react-native-community/cli-platform-ios/native_modules'
target '...app' do
# Uncorm mment the next line if you're using Swift or would like to use dynamic frameworks
# use_frameworks!
pod 'React', :path => '../node_modules/react-native/'
pod 'React-Core', :path => '../node_modules/react-native/React'
pod 'React-DevSupport', :path => '../node_modules/react-native/React'
pod 'React-fishhook', :path => '../node_modules/react-native/Libraries/fishhook'
pod 'React-RCTActionSheet', :path => '../node_modules/react-native/Libraries/ActionSheetIOS'
pod 'React-RCTAnimation', :path => '../node_modules/react-native/Libraries/NativeAnimation'
pod 'React-RCTBlob', :path => '../node_modules/react-native/Libraries/Blob'
pod 'React-RCTImage', :path => '../node_modules/react-native/Libraries/Image'
pod 'React-RCTLinking', :path => '../node_modules/react-native/Libraries/LinkingIOS'
pod 'React-RCTNetwork', :path => '../node_modules/react-native/Libraries/Network'
pod 'React-RCTSettings', :path => '../node_modules/react-native/Libraries/Settings'
pod 'React-RCTText', :path => '../node_modules/react-native/Libraries/Text'
pod 'React-RCTVibration', :path => '../node_modules/react-native/Libraries/Vibration'
pod 'React-RCTWebSocket', :path => '../node_modules/react-native/Libraries/WebSocket'
pod 'React-cxxreact', :path => '../node_modules/react-native/ReactCommon/cxxreact'
pod 'React-jsi', :path => '../node_modules/react-native/ReactCommon/jsi'
pod 'React-jsiexecutor', :path => '../node_modules/react-native/ReactCommon/jsiexecutor'
pod 'React-jsinspector', :path => '../node_modules/react-native/ReactCommon/jsinspector'
pod 'yoga', :path => '../node_modules/react-native/ReactCommon/yoga'
pod 'DoubleConversion', :podspec => '../node_modules/react-native/third-party-podspecs/DoubleConversion.podspec'
pod 'glog', :podspec => '../node_modules/react-native/third-party-podspecs/glog.podspec'
pod 'Folly', :podspec => '../node_modules/react-native/third-party-podspecs/Folly.podspec'
# Pods for ...app
pod 'Firebase/Core', '~> 5.15.0'
pod 'Firebase/Performance'
pod 'Firebase/Storage'
target '...appTests' do
inherit! :search_paths
# Pods for testing
end
use_native_modules!
end
答案 0 :(得分:0)
我通过在define NO_THREADS
中文件config.h
的底部添加iOS/Pods/glog/src/config.h
解决了这个问题。但是我仍然有另一个与glog相关的问题。我不确定这是否是解决问题的正确方法。
答案 1 :(得分:0)
对于将来的Google员工来说,发生这种情况是因为(据我所知)RN在pod install
期间生成的配置脚本无法正确检测macOS是否包含pthreads支持。这似乎是由于Xcode 11和Xcode 12之间存在一些差异,因为降级的人说问题已经消失了。
无论如何,以下对我有用:
ios/Pods/Flipper-Glog/src/config.h
并在文件中的任意位置添加#define HAVE_PTHREAD 1
,并将HAVE_RWLOCK
标志也更改为#define HAVE_RWLOCK 1
ios/Pods/glog/src/config.h
并执行相同的操作。您需要同时使用这两个库。进行此更改使事情对我有用。这不仅是迫使它起作用,还在于纠正以前起作用的问题。我在较早的项目中验证了这些字段的设置正确(并且pthread支持在macOS,模拟器和iOS中广泛存在)。