I'm trying to run my first React-Native app on an ios device using xcode and keep getting this error:
ld: warning: directory not found for option '-L/Users/XXXX/Library/Developer/Xcode/DerivedData/nigh-hktjvygosupgnoaafsvgyowhzsqi/Build/Products/Debug-iphoneos/React'
ld: library not found for -lReact
clang: error: linker command failed with exit code 1 (use -v to see invocation)
I'm assuming the cause is related to the fact that React is missing in my Scheme's build targets list. React is first on the list with all the boxes checked, but it says React(missing) instead of just React:
Screenshot of build targets list
If I click the '+' button React is not an option. Here is my podfile:
platform :ios, '10.0'
require_relative '../node_modules/react-native-unimodules/cocoapods'
target 'nigh' do
# Pods for nigh
pod 'React', :path => '../node_modules/react-native', :subspecs => [
'Core',
'CxxBridge',
'DevSupport',
'RCTActionSheet',
'RCTAnimation',
'RCTBlob',
'RCTGeolocation',
'RCTImage',
'RCTLinkingIOS',
'RCTNetwork',
'RCTSettings',
'RCTText',
'RCTVibration',
'RCTWebSocket',
]
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'
pod 'RNGestureHandler', :podspec => '../node_modules/react-native-gesture-handler/RNGestureHandler.podspec'
pod 'RNReanimated', :podspec => '../node_modules/react-native-reanimated/RNReanimated.podspec'
pod 'react-native-google-maps', path: '../node_modules/react-native-maps' # Uncomment this line if you want to support GoogleMaps on iOS
pod 'GoogleMaps' # Uncomment this line if you want to support GoogleMaps on iOS
pod 'Google-Maps-iOS-Utils' # Uncomment this line if you want to support GoogleMaps on iOS
use_unimodules!
pod 'RNVectorIcons', :path => '../node_modules/react-native-vector-icons'
pod 'react-native-maps', :path => '../node_modules/react-native-maps'
pod 'RNDeviceInfo', :path => '../node_modules/react-native-device-info'
pod 'react-native-slider', :path => '../node_modules/#react-native-community/slider'
pod 'react-native-notifications', :path => '../node_modules/react-native-notifications'
pod 'react-native-cameraroll', :path => '../node_modules/#react-native-community/cameraroll'
pod 'react-native-image-picker', :path => '../node_modules/react-native-image-picker'
pod 'RNFS', :path => '../node_modules/react-native-fs'
end
post_install do |installer|
installer.pods_project.targets.each do |target|
if target.name == 'react-native-google-maps'
target.build_configurations.each do |config|
config.build_settings['CLANG_ENABLE_MODULES'] = 'No'
end
end
if target.name == "React"
target.remove_from_project
end
end
end
I've tried removing the if target.name == "React" block and still get the same error. I'm also opening xcode from .xcworkspace instead of .xcodeproject since I am using cocoapods. I've tried removing everything from the DerivedData folder and cleaning the build, and have also tried building using the Legacy Build System. The Legacy Build system shows warnings on nearly every library that read "Missing dependency target 'React'".
I needed to change my bundle name from org.reactjs.native.example.nigh to org.reactjs.native.name.nigh, so could that be responsible? I know that at some point React was not missing in the targets list. Despite React missing the app still runs fine on the xcode iphone emulator.
Also in the Pods/Products file libReact.a does not have an icon like the other .a files do
Can anyone tell me why this is happening and/or how to fix/work around it?
I fixed this issue by going System Preferences -> Security & Privacy. Under the privacy tab I allowed Xcode to access my files and folders.
What actually happened was that I upgraded my OS to Catalina. Somehow the access to files and folder is not granted to Xcode, hence xcode is not able to read the file and so you get this issue.
Related
I am able to build and run the app in a simulator. However, whenever I want to archive it (selecting any ios devices) to release the app into the AppStore, I am getting this error.
ld: warning: directory not found for option '-L/Users/bigyankarki/Library/Developer/Xcode/DerivedData/Neex-dnesybikpygafkfxhimxsgrjawis/Build/Intermediates.noindex/ArchiveIntermediates/Neex/BuildProductsPath/Release-iphoneos/React-RCTVibration'
ld: warning: directory not found for option '-L/Users/bigyankarki/Library/Developer/Xcode/DerivedData/Neex-dnesybikpygafkfxhimxsgrjawis/Build/Intermediates.noindex/ArchiveIntermediates/Neex/BuildProductsPath/Release-iphoneos/react-native-safe-area-context'
ld: library not found for -lReact-RCTVibration
clang: error: linker command failed with exit code 1 (use -v to see invocation)
I have followed this, and other multiple solutions with the same library not found error, but to no avail. I even included it to podfile,
require_relative '../node_modules/react-native/scripts/react_native_pods'
require_relative '../node_modules/#react-native-community/cli-platform-ios/native_modules'
platform :ios, '12.4'
target 'Neex' do
config = use_native_modules!
use_react_native!(
:path => config[:reactNativePath],
# to enable hermes on iOS, change `false` to `true` and then install pods
:hermes_enabled => false
)
pod 'React-RCTVibration', :path => '../node_modules/react-native/Libraries/Vibration'
pod 'RNCAsyncStorage', :path => '../node_modules/#react-native-async-storage/async-storage'
pod 'RNGestureHandler', :path => '../node_modules/react-native-gesture-handler'
pod 'RNSVG', :path => '../node_modules/react-native-svg'
target 'NeexTests' do
inherit! :complete
# Pods for testing
end
# Enables Flipper.
#
# Note that if you have use_frameworks! enabled, Flipper will not work and
# you should disable the next line.
use_flipper!()
post_install do |installer|
react_native_post_install(installer)
end
end
and even linked it in buildphase, but none works.
I solved the problem by setting 'Build setting architectures only' to Yes for both release and debug. After that, the problem seems to be resolved and I was able to archive the app.
I am stuck with an issue since past 5+ hours, I am working on a react native project of version 0.59.0, it is a 1.5 years old project and it is working fine on android, but when building it for iOS, I was facing many issues one of which was:
ld: library not found for -lFirebaseCore
So to make it work, I included arm64 in excluded architecture and my build started working on simulator but my IPA was not working on a real device, again after removing arm64 and resolving multiple issues, I am stuck with the following issue which is coming in RNFirebaseLinks.m file as :
ARC Semantic Issue Group: No known class method for selector 'componentsWithLink:domain:'
Also sharing my device specifications:
macos: Macbook pro(11.0.1), chip: Apple M1,
Xcode version: 12.4
PodFile content:
**# Uncomment the next line to define a global platform for your project**
platform :ios, '10.0'
target 'PropertiesPublisherNew' do
**# Uncomment the next line if you're using Swift or would like to use dynamic frameworks**
#use_frameworks!
**# Pods for PropertiesPublisherNew**
pod 'Firebase/Core', '6.3.0'
pod 'Firebase/Messaging'
pod 'Firebase/DynamicLinks'
pod 'Firebase/Database'
**# pod 'RNReanimated', :path => '../node_modules/react-native-reanimated'**
**# pod 'RNScreens', :path => '../node_modules/react-native-screens'**
**# pod 'react-native-netinfo', :path => '../node_modules/#react-native-community/netinfo'**
#pod 'react-native-webview', :path => '../node_modules/react-native-webview'
target 'PropertiesPublisherNewTests' do
inherit! :search_paths
**# Pods for testing**
end
end
post_install do |installer|
installer.pods_project.build_configurations.each do |config|
config.build_settings["EXCLUDED_ARCHS[sdk=iphonesimulator*]"] = "arm64"
end
end
target 'PropertiesPublisherNew-tvOS' do
**# Uncomment the next line if you're using Swift or would like to use dynamic frameworks**
**# use_frameworks!**
**# Pods for PropertiesPublisherNew-tvOS**
target 'PropertiesPublisherNew-tvOSTests' do
inherit! :search_paths
**# Pods for testing**
end
end
Can anyone please help me out with this?
Add pod 'Firebase/Core', '~> 5.15.0' in PodFile inside IOS Folder
In Xcode, I get the following error during archiving
Showing All Messages
: Directory not found for option '-L/Users/<user>/Library/Developer/Xcode/DerivedData/Mobile-ffdrrqgiyphlinerkjxrqqqeocrs/Build/Intermediates.noindex/ArchiveIntermediates/Mobile/BuildProductsPath/Release-iphoneos/React'
ld: library not found for -lRNFirebase
clang: error: linker command failed with exit code 1 (use -v to see invocation)
I get this error when I try to archive it.
When I try to build it using the command
$ react-native run-ios
in the terminal (with $ react-native start to run metro bundler), I get:
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 Mobile.xcworkspace
** BUILD FAILED **
The following build commands failed:
Ld build/Mobile/Build/Products/Debug-iphonesimulator/Mobile.app/UmappedMobile normal x86_64
(1 failure)
Podfile:
# Uncomment the next line to define a global platform for your project
platform :ios, '10.3'
target 'Mobile' do
# Uncomment the next line if you're using Swift or would like to use dynamic frameworks
# use_frameworks!
libPath = '..'
nodeModules = "#{libPath}/node_modules"
rn_path = "#{nodeModules}/react-native"
# Pods for Mobile
pod 'yoga', path: "#{rn_path}/ReactCommon/yoga"
pod 'React', path: rn_path, subspecs: [
'Core',
'CxxBridge',
'DevSupport',
'RCTActionSheet',
'RCTAnimation',
'RCTGeolocation',
'RCTImage',
'RCTLinkingIOS',
'RCTNetwork',
'RCTSettings',
'RCTText',
'RCTVibration',
'RCTWebSocket',
]
pod 'RNFBApp', :path => '../node_modules/#react-native-firebase/app'
pod 'RNFBDatabase', :path => '../node_modules/#react-native-firebase/database'
pod 'RNFBAuth', :path => '../node_modules/#react-native-firebase/auth'
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"
post_install do |installer|
installer.pods_project.targets.each do |target|
if target.name == "React"
target.remove_from_project
end
end
end
end
package.json:
"dependencies": {
"#react-native-firebase/app": "^7.2.1",
"#react-native-firebase/auth": "^8.0.5",
"#react-native-firebase/database": "^7.2.2",
"react": "16.8.3",
"react-native": "0.59.10",
...
}
I've tried clearing my node_modules and Pods folder within ios. Been trying to debug this for a while, any help is appreciated. Thanks!
I would recommend that:
Delete the package-lock.json, and do an npm install
Considering that these firebase packages have the auto-link feature, perform a pod install previously deleting the Podfile.lock.
In the xcode, carry out the Clean Build Folder.
Perform the build
I'm trying to run my first React-Native app on a device but the build always fails with the following error:
ld: warning: directory not found for option '-L/Users/XXXX/Library/Developer/Xcode/DerivedData/nigh-hktjvygosupgnoaafsvgyowhzsqi/Build/Products/Debug-iphoneos/React'
ld: warning: directory not found for option '-L/Users/XXXX/Library/Developer/Xcode/DerivedData/nigh-hktjvygosupgnoaafsvgyowhzsqi/Build/Products/Debug-iphoneos/React'
ld: warning: directory not found for option '-L/Users/XXXX/Library/Developer/Xcode/DerivedData/nigh-hktjvygosupgnoaafsvgyowhzsqi/Build/Products/Debug-iphoneos/React'
ld: warning: ignoring file /Users/XXXX/Nigh/ReactNativeNigh/Nigh/ios/build/nigh/Build/Products/Debug-iphonesimulator/React/libReact.a, file was built for archive which is not the architecture being linked (arm64): /Users/XXXX/Nigh/ReactNativeNigh/Nigh/ios/build/nigh/Build/Products/Debug-iphonesimulator/React/libReact.a
Undefined symbols for architecture arm64:
"_OBJC_CLASS_$_RCTBridge", referenced from:
objc-class-ref in AppDelegate.o
"_OBJC_CLASS_$_RCTBundleURLProvider", referenced from:
objc-class-ref in AppDelegate.o
"_OBJC_CLASS_$_RCTConvert", referenced from:
objc-class-ref in libRNGestureHandler.a(RNFlingHandler.o)
objc-class-ref in libRNGestureHandler.a(RNForceTouchHandler.o)
objc-class-ref in libRNGestureHandler.a(RNLongPressHandler.o)
objc-class-ref in libRNGestureHandler.a(RNNativeViewHandler.o)
objc-class-ref in libRNGestureHandler.a(RNPanHandler.o)
objc-class-ref in libRNGestureHandler.a(RNGestureHandlerModule.o)
objc-class-ref in libRNGestureHandler.a(RNGestureHandler.o)
...
React directory not found error
A few things up front:
The project runs fine on the XCode emulator.
I am using cocoapods and am trying to run the build from the xcWorkspace instead of project (though the full path of the target is /Users/XXXX/Nigh/ReactNativeNigh/Nigh/ios/nigh.xcodeproj which confuses me a little).
I've removed and reinstalled node-modules, linked, and done new pod installs.
It looks like all I have to do is add React to the Debug-iphoneos folder, but I'm not sure how to do that or if that's the solution. My first attempt was to make sure React was in the Scheme's Build Targets. It was the first on the list with all boxes checked, except for some reason it said React(missing). Per React Native / Xcode Upgrade and now RCTConvert.h not found I removed React(missing) from the Targets list and attempted to add React again, but React does not even show up in the list. Also, the Pods/Products folder shows libReact.a differently than the other .a files, without the Archive(?) icon:
List of Pod/Products
Here's the podfile:
require_relative '../node_modules/react-native-unimodules/cocoapods'
target 'nigh' do
# Pods for nigh
use_frameworks!
# pod 'AWSCore', '~> 2.12.0'
pod 'AWSCore', '~> 2.10.2'
pod 'AWSAppSync', '~> 2.14.2'
pod 'React', :path => '../node_modules/react-native', :subspecs => [
'Core',
'CxxBridge',
'DevSupport',
'RCTActionSheet',
'RCTAnimation',
'RCTBlob',
'RCTGeolocation',
'RCTImage',
'RCTLinkingIOS',
'RCTNetwork',
'RCTSettings',
'RCTText',
'RCTVibration',
'RCTWebSocket',
]
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'
pod 'RNGestureHandler', :podspec => '../node_modules/react-native-gesture-handler/RNGestureHandler.podspec'
pod 'RNReanimated', :podspec => '../node_modules/react-native-reanimated/RNReanimated.podspec'
pod 'react-native-google-maps', path: '../node_modules/react-native-maps' # Uncomment this line if you want to support GoogleMaps on iOS
pod 'GoogleMaps' # Uncomment this line if you want to support GoogleMaps on iOS
pod 'Google-Maps-iOS-Utils' # Uncomment this line if you want to support GoogleMaps on iOS
use_unimodules!
pod 'RNVectorIcons', :path => '../node_modules/react-native-vector-icons'
pod 'react-native-maps', :path => '../node_modules/react-native-maps'
pod 'RNDeviceInfo', :path => '../node_modules/react-native-device-info'
pod 'react-native-slider', :path => '../node_modules/#react-native-community/slider'
pod 'react-native-notifications', :path => '../node_modules/react-native-notifications'
pod 'react-native-cameraroll', :path => '../node_modules/#react-native-community/cameraroll'
pod 'react-native-image-picker', :path => '../node_modules/react-native-image-picker'
pod 'RNFS', :path => '../node_modules/react-native-fs'
end
post_install do |installer|
installer.pods_project.targets.each do |target|
if target.name == 'react-native-google-maps'
target.build_configurations.each do |config|
config.build_settings['CLANG_ENABLE_MODULES'] = 'No'
end
end
#if target.name == "React"
# target.remove_from_project
#end
end
end
I commented out the if target.name == "React" block, but the error shows up either way.
Am I right in assuming the problem is that React is not in the scheme's build targets, and if so does anyone know how to include it? If not, does anyone know what the real cause could be/how to fix/work around it?
I believe your issue is come from use_frameworks!, try to remove that line, remove DerivedData, Pods, xcworkspace, Podfile.lock and pod install again.
I got this issue last month when upgrading my RN version. This stupid thing took me 1 weeks to know the issue and 20mins to resolve.
Hope this help
I am using react-native-maps and am trying to use Google Maps for iOS and I followed the above instructions from https://github.com/airbnb/react-native-maps/issues/693 to do so I get an error from the pod install:
Unable to find a target named AirMapsExplorer
here is the podfile that I have
# You Podfile should look similar to this file. React Native currently does not support use_frameworks!
source 'https://github.com/CocoaPods/Specs.git'
platform :ios, '8.0'
# Change 'AirMapsExplorer' to match the target in your Xcode project.
target 'AirMapsExplorer' do
pod 'Yoga', :path => '../../node_modules/react-native/ReactCommon/yoga/Yoga.podspec'
pod 'React', path: '../../node_modules/react-native', :subspecs => [
'Core',
'RCTActionSheet',
'RCTAnimation',
'RCTGeolocation',
'RCTImage',
'RCTLinkingIOS',
'RCTNetwork',
'RCTSettings',
'RCTText',
'RCTVibration',
'RCTWebSocket',
'BatchedBridge'
]
pod 'GoogleMaps' # <~~ remove this line if you do not want to support GoogleMaps on iOS
pod 'react-native-maps', path: '../../'
pod 'react-native-google-maps', path: '../../' # <~~ if you need GoogleMaps support on iOS
end
post_install do |installer|
installer.pods_project.targets.each do |target|
if target.name == "react-native-google-maps"
target.build_configurations.each do |config|
config.build_settings['CLANG_ENABLE_MODULES'] = 'No'
end
end
end
end
I rebooted my device (2 times now) removed the pod folder and podfile, followed the instructions again and get the same error. I even tried doing clean build and clean folder still to no avail.
anyone have this error or run into a way to fix if you run into this. I don't use xcode regularly as I am building with React Native and try not to do much with xcode unless I absolutely have to for iOS.
If there are other things you want me to show I will to help debug this issue. Thank you
You need put in your target the name of the xcodeproj created by XCode when you start this project, you also need to check that your .podFile is in your xcodeproj file directory , also I think you are missing this line
workspace 'AirMapsExplorer'
This will create a workspace with your pods integrated
your pod file modified
# You Podfile should look similar to this file. React Native currently does not support use_frameworks!
source 'https://github.com/CocoaPods/Specs.git'
platform :ios, '8.0'
workspace 'AirMapsExplorer'
# Change 'AirMapsExplorer' to match the target in your Xcode project.
target 'AirMapsExplorer' do
pod 'Yoga', :path => '../../node_modules/react-native/ReactCommon/yoga/Yoga.podspec'
pod 'React', path: '../../node_modules/react-native', :subspecs => [
'Core',
'RCTActionSheet',
'RCTAnimation',
'RCTGeolocation',
'RCTImage',
'RCTLinkingIOS',
'RCTNetwork',
'RCTSettings',
'RCTText',
'RCTVibration',
'RCTWebSocket',
'BatchedBridge'
]
pod 'GoogleMaps' # <~~ remove this line if you do not want to support GoogleMaps on iOS
pod 'react-native-maps', path: '../../'
pod 'react-native-google-maps', path: '../../' # <~~ if you need GoogleMaps support on iOS
end
post_install do |installer|
installer.pods_project.targets.each do |target|
if target.name == "react-native-google-maps"
target.build_configurations.each do |config|
config.build_settings['CLANG_ENABLE_MODULES'] = 'No'
end
end
end
end
Hope this helps