ReactNativeのプロジェクトでiOSを立ち上げた時に、xcodebuildに失敗したのでメモに残す
環境
- react-native 0.61.5
- react. 16.9.0
- Xcode 12.5.1. Build version 12E507
エラーログ
$ npx react-native run-ios info Found Xcode workspace "MyApp.xcworkspace" info Building (using "xcodebuild -workspace MyApp.xcworkspace -configuration Debug -scheme MyApp -destination id=C02764CC-B351-4F6C-B2B2-C484D9AE7F13") .................. error Failed to build iOS project. We ran "xcodebuild" command but it exited with error code 65. To debug build logs further, consider building your app with Xcode.app, by opening MyApp.xcworkspace. Run CLI with --verbose flag for more details. Command line invocation: /Applications/Xcode.app/Contents/Developer/usr/bin/xcodebuild -workspace MyApp.xcworkspace -configuration Debug -scheme MyApp -destination id=C02764CC-B351-4F6C-B2B2-C484D9AE7F13 User defaults from command line: IDEPackageSupportUseBuiltinSCM = YES note: Using new build system note: Planning build note: Analyzing workspace note: Using build description from disk note: Build preparation complete CompileC /Users/t-sugiyama/Library/Developer/Xcode/DerivedData/MyApp-bizjhaupfywrfrahprmufcykpuhp/Build/Intermediates.noindex/Pods.build/Debug-iphonesimulator/React-Core.build/Objects-normal/x86_64/RCTCxxBridge.o /Users/t-sugiyama/MyApp/node_modules/react-native/React/CxxBridge/RCTCxxBridge.mm normal x86_64 objective-c++ com.apple.compilers.llvm.clang.1_0.compiler (in target 'React-Core' from project 'Pods') cd /Users/t-sugiyama/MyApp/ios/Pods export LANG\=en_US.US-ASCII /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang -x objective-c++ -target x86_64-apple-ios9.0-simulator -fmessage-length\=0 -fdiagnostics-show-note-include-stack -fmacro-backtrace-limit\=0 -std\=gnu++14 -stdlib\=libc++ -fobjc-arc -fobjc-weak -fmodules -fmodules-cache-path\=/Users/t-sugiyama/Library/Developer/Xcode/DerivedData/ModuleCache.noindex -fmodules-prune-interval\=86400 -fmodules-prune-after\=345600 -fbuild-session-file\=/Users/t-sugiyama/Library/Developer/Xcode/DerivedData/ModuleCache.noindex/Session.modulevalidation -fmodules-validate-once-per-build-session -Wnon-modular-include-in-framework-module -Werror\=non-modular-include-in-framework-module -Wno-trigraphs -fpascal-strings -O0 -fno-common -Wno-missing-field-initializers -Wno-missing-prototypes -Werror\=return-type -Wdocumentation -Wunreachable-code -Wno-implicit-atomic-properties -Werror\=deprecated-objc-isa-usage -Wno-objc-interface-ivars -Werror\=objc-root-class -Wno-arc-repeated-use-of-weak -Wimplicit-retain-self -Wno-non-virtual-dtor -Wno-overloaded-virtual -Wno-exit-time-destructors -Wduplicate-method-match -Wno-missing-braces -Wparentheses -Wswitch -Wunused-function -Wno-unused-label -Wno-unused-parameter -Wunused-variable -Wunused-value -Wempty-body -Wuninitialized -Wconditional-uninitialized -Wno-unknown-pragmas -Wno-shadow -Wno-four-char-constants -Wno-conversion -Wconstant-conversion -Wint-conversion -Wbool-conversion -Wenum-conversion -Wno-float-conversion -Wnon-literal-null-conversion -Wobjc-literal-conversion -Wshorten-64-to-32 -Wno-newline-eof -Wno-selector -Wno-strict-selector-match -Wundeclared-selector -Wdeprecated-implementations -Wno-c++11-extensions -DPOD_CONFIGURATION_DEBUG\=1 -DDEBUG\=1 -DCOCOAPODS\=1 -DOBJC_OLD_DISPATCH_PROTOTYPES\=0 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator14.5.sdk -fasm-blocks -fstrict-aliasing -Wprotocol -Wdeprecated-declarations -Winvalid-offsetof -g -Wno-sign-conversion -Winfinite-recursion -Wmove -Wcomma -Wblock-capture-autoreleasing -Wstrict-prototypes -Wrange-loop-analysis -Wno-semicolon-before-method-body -Wunguarded-availability -fobjc-abi-version\=2 -fobjc-legacy-dispatch -index-store-path /Users/t-sugiyama/Library/Developer/Xcode/DerivedData/MyApp-bizjhaupfywrfrahprmufcykpuhp/Index/DataStore -iquote /Users/t-sugiyama/Library/Developer/Xcode/DerivedData/MyApp-bizjhaupfywrfrahprmufcykpuhp/Build/Intermediates.noindex/Pods.build/Debug-iphonesimulator/React-Core.build/React-Core-generated-files.hmap -I/Users/t-sugiyama/Library/Developer/Xcode/DerivedData/MyApp-bizjhaupfywrfrahprmufcykpuhp/Build/Intermediates.noindex/Pods.build/Debug-iphonesimulator/React-Core.build/React-Core-own-target-headers.hmap -I/Users/t-sugiyama/Library/Developer/Xcode/DerivedData/MyApp-bizjhaupfywrfrahprmufcykpuhp/Build/Intermediates.noindex/Pods.build/Debug-iphonesimulator/React-Core.build/React-Core-all-target-headers.hmap -iquote /Users/t-sugiyama/Library/Developer/Xcode/DerivedData/MyApp-bizjhaupfywrfrahprmufcykpuhp/Build/Intermediates.noindex/Pods.build/Debug-iphonesimulator/React-Core.build/React-Core-project-headers.hmap -I/Users/t-sugiyama/Library/Developer/Xcode/DerivedData/MyApp-bizjhaupfywrfrahprmufcykpuhp/Build/Products/Debug-iphonesimulator/React-Core/include -I/Users/t-sugiyama/MyApp/ios/Pods/Headers/Private -I/Users/t-sugiyama/MyApp/ios/Pods/Headers/Private/React-Core -I/Users/t-sugiyama/MyApp/ios/Pods/Headers/Public -I/Users/t-sugiyama/MyApp/ios/Pods/Headers/Public/DoubleConversion -I/Users/t-sugiyama/MyApp/ios/Pods/Headers/Public/React-Core -I/Users/t-sugiyama/MyApp/ios/Pods/Headers/Public/React-cxxreact -I/Users/t-sugiyama/MyApp/ios/Pods/Headers/Public/React-jsi -I/Users/t-sugiyama/MyApp/ios/Pods/Headers/Public/React-jsiexecutor -I/Users/t-sugiyama/MyApp/ios/Pods/Headers/Public/React-jsinspector -I/Users/t-sugiyama/MyApp/ios/Pods/Headers/Public/Yoga -I/Users/t-sugiyama/MyApp/ios/Pods/Headers/Public/glog -I/Users/t-sugiyama/MyApp/node_modules/react-native/ReactCommon -I/Users/t-sugiyama/MyApp/ios/Pods/boost-for-react-native -I/Users/t-sugiyama/MyApp/ios/Pods/DoubleConversion -I/Users/t-sugiyama/MyApp/ios/Pods/Folly -I/Users/t-sugiyama/Library/Developer/Xcode/DerivedData/MyApp-bizjhaupfywrfrahprmufcykpuhp/Build/Intermediates.noindex/Pods.build/Debug-iphonesimulator/React-Core.build/DerivedSources-normal/x86_64 -I/Users/t-sugiyama/Library/Developer/Xcode/DerivedData/MyApp-bizjhaupfywrfrahprmufcykpuhp/Build/Intermediates.noindex/Pods.build/Debug-iphonesimulator/React-Core.build/DerivedSources/x86_64 -I/Users/t-sugiyama/Library/Developer/Xcode/DerivedData/MyApp-bizjhaupfywrfrahprmufcykpuhp/Build/Intermediates.noindex/Pods.build/Debug-iphonesimulator/React-Core.build/DerivedSources -F/Users/t-sugiyama/Library/Developer/Xcode/DerivedData/MyApp-bizjhaupfywrfrahprmufcykpuhp/Build/Products/Debug-iphonesimulator/React-Core -DFOLLY_NO_CONFIG -DFOLLY_MOBILE\=1 -DFOLLY_USE_LIBCPP\=1 -Wno-comma -Wno-shorten-64-to-32 -Wno-documentation -include /Users/t-sugiyama/MyApp/ios/Pods/Target\ Support\ Files/React-Core/React-Core-prefix.pch -MMD -MT dependencies -MF /Users/t-sugiyama/Library/Developer/Xcode/DerivedData/MyApp-bizjhaupfywrfrahprmufcykpuhp/Build/Intermediates.noindex/Pods.build/Debug-iphonesimulator/React-Core.build/Objects-normal/x86_64/RCTCxxBridge.d --serialize-diagnostics /Users/t-sugiyama/Library/Developer/Xcode/DerivedData/MyApp-bizjhaupfywrfrahprmufcykpuhp/Build/Intermediates.noindex/Pods.build/Debug-iphonesimulator/React-Core.build/Objects-normal/x86_64/RCTCxxBridge.dia -c /Users/t-sugiyama/MyApp/node_modules/react-native/React/CxxBridge/RCTCxxBridge.mm -o /Users/t-sugiyama/Library/Developer/Xcode/DerivedData/MyApp-bizjhaupfywrfrahprmufcykpuhp/Build/Intermediates.noindex/Pods.build/Debug-iphonesimulator/React-Core.build/Objects-normal/x86_64/RCTCxxBridge.o /Users/t-sugiyama/MyApp/node_modules/react-native/React/CxxBridge/RCTCxxBridge.mm:330:34: error: cannot initialize a parameter of type 'NSArray<id<RCTBridgeModule>> *' with an rvalue of type 'NSArray<Class> *' (void)[self _initializeModules:RCTGetModuleClasses() withDispatchGroup:prepareBridge lazilyDiscovered:NO]; ^~~~~~~~~~~~~~~~~~~~~ /Users/t-sugiyama/MyApp/node_modules/react-native/React/CxxBridge/RCTCxxBridge.mm:770:82: note: passing argument to parameter 'modules' here - (NSArray<RCTModuleData *> *)_initializeModules:(NSArray<id<RCTBridgeModule>> *)modules ^ /Users/t-sugiyama/MyApp/node_modules/react-native/React/CxxBridge/RCTCxxBridge.mm:775:79: error: cannot initialize a parameter of type 'NSArray<Class> *' with an lvalue of type 'NSArray<id<RCTBridgeModule>> *__strong' NSArray<RCTModuleData *> *moduleDataById = [self _registerModulesForClasses:modules lazilyDiscovered:lazilyDiscovered]; ^~~~~~~ /Users/t-sugiyama/MyApp/node_modules/react-native/React/CxxBridge/RCTCxxBridge.mm:617:76: note: passing argument to parameter 'moduleClasses' here - (NSArray<RCTModuleData *> *)_registerModulesForClasses:(NSArray<Class> *)moduleClasses ^ /Users/t-sugiyama/MyApp/node_modules/react-native/React/CxxBridge/RCTCxxBridge.mm:826:69: error: cannot initialize a parameter of type 'NSArray<id<RCTBridgeModule>> *' with an lvalue of type 'NSArray<Class> *__strong' NSArray<RCTModuleData *> *newModules = [self _initializeModules:modules withDispatchGroup:NULL lazilyDiscovered:YES]; ^~~~~~~ /Users/t-sugiyama/MyApp/node_modules/react-native/React/CxxBridge/RCTCxxBridge.mm:770:82: note: passing argument to parameter 'modules' here - (NSArray<RCTModuleData *> *)_initializeModules:(NSArray<id<RCTBridgeModule>> *)modules ^ 3 errors generated. /Users/t-sugiyama/MyApp/ios/Pods/Pods.xcodeproj: warning: The iOS Simulator deployment target 'IPHONEOS_DEPLOYMENT_TARGET' is set to 8.0, but the range of supported deployment target versions is 9.0 to 14.5.99. (in target 'boost-for-react-native' from project 'Pods') ** BUILD FAILED ** The following build commands failed: CompileC /Users/t-sugiyama/Library/Developer/Xcode/DerivedData/MyApp-bizjhaupfywrfrahprmufcykpuhp/Build/Intermediates.noindex/Pods.build/Debug-iphonesimulator/React-Core.build/Objects-normal/x86_64/RCTCxxBridge.o /Users/t-sugiyama/MyApp/node_modules/react-native/React/CxxBridge/RCTCxxBridge.mm normal x86_64 objective-c++ com.apple.compilers.llvm.clang.1_0.compiler (1 failure)
解決法
以下の記事のようにPodfileに追記して、バグのでたライブラリにパッチを当てる必要がある。
なお、すでに修正のPRがマージされているのでreact-nativeのバージョンを上げれば解決はしそうである。