I recently updated a React Native project to version 0.59, and the built-in AsyncStorage is now deprecated. So I installed the #react-native-community/react-native-async-storage package instead as advised, and linked the packages by running react-native link #react-native-community/async-storage.
The build now succeeds when running it in Xcode locally. However, when I try to run the build in my CI pipeline in Azure DevOps, it fails during linking:
# ...
▸ Compiling main.m
▸ Linking MyApp
⚠️ ld: directory not found for option '-L/Users/vsts/agent/2.149.2/work/1/s/ios/MyApp/System/Library/Frameworks'
❌ ld: library not found for -lRNCAsyncStorage
❌ clang: error: linker command failed with exit code 1 (use -v to see invocation)
▸ Linking MyApp
⚠️ ld: directory not found for option '-L/Users/vsts/agent/2.149.2/work/1/s/ios/MyApp/System/Library/Frameworks'
❌ ld: library not found for -lRNCAsyncStorage
❌ clang: error: linker command failed with exit code 1 (use -v to see invocation)
** BUILD FAILED **
The following build commands failed:
Ld /Users/vsts/Library/Developer/Xcode/DerivedData/MyApp-asjjausbybqgpsdjodrbvoyzaeqx/Build/Intermediates.noindex/MyApp.build/BetaRelease-iphoneos/MyApp.build/Objects-normal/armv7/MyApp normal armv7
Ld /Users/vsts/Library/Developer/Xcode/DerivedData/MyApp-asjjausbybqgpsdjodrbvoyzaeqx/Build/Intermediates.noindex/MyApp.build/BetaRelease-iphoneos/MyApp.build/Objects-normal/arm64/MyApp normal arm64
(2 failures)
##[error]Error: /usr/bin/xcodebuild failed with return code: 65
##[section]Finishing: Xcode build, sign and export
Further up it does look like it has been built:
# ...
▸ Building RNCAsyncStorage/RNCAsyncStorage [(Release)]
▸ Check Dependencies
▸ Building library libRNCAsyncStorage.a
▸ Building library libRNCAsyncStorage.a
▸ Copying RNCAsyncStorage.h
▸ Copying RNCAsyncStorageDelegate.h
# ...
Any ideas what might cause this?
Try setting the Deployment Target to 11.0 in Build Settings / Deployment / iOS Deployment Target.
What might be happening
I was having the exact same issue with a different library and this worked for me.
Adding this ${PODS_CONFIGURATION_BUILD_DIR}/RNCAsyncStorage to Library Search Paths worked for me.
Related
I am facing the above issue with New Mac M1 with Xcode 13.1.
I am running fastlane and getting this error
** TEST BUILD FAILED **
[21:03:58]: ▸ The following build commands failed:
[21:03:58]: ▸ MergeSwiftModule normal x86_64
[21:03:58]: ▸ CompileSwiftSources normal x86_64 com.apple.xcode.tools.swift.compiler
[21:03:58]: ▸ (2 failures)
❌ error: merge-module command failed with exit code 1 (use -v to see invocation)
Select your project in Xcode, and go to "Build Settings". Scroll down until you see "Search Paths", and finally, "Library Search Paths". Replace "$(TOOLCHAIN_DIR)/usr/lib/swift-5.0/$(PLATFORM_NAME)" with "$(SDKROOT)/usr/lib/swift".
I want to add unit test target to my Xcode project which consist of lots of sub-projects. I'm adding test target to my main project. After I add it, I can't build it from test target (I can successfully build app target, just can't build test target).
Some settings are not default;
Build Active Architecture Only -> Yes (On my main target)
Test Target iOS Deployment Target -> 10.3
I'm getting below error
ld: can't link with a main executable file '/Users/emreonder/Library/Developer/Xcode/DerivedData/MyAppWorkspace-gdwblguzoliffpbypfnfrxayzvpe/Build/Products/Debug-iphonesimulator/MyApp.app/MyApp' for architecture i386
clang: error: linker command failed with exit code 1 (use -v to see invocation
Linker command failed with exit code 1 (use -v to see invocation)
I'm using Xcode 11.
I m using starcore_for_ios to run python scripts.
What i m doing is:
flutter clean
export STARCORE_PATH='/Users/brijeshlakkad'
export STARCORE_PYTHONVERSION='3.6'
export STARCORE_PYTHONLIBRARY='star_python36,python3.6m'
flutter build ios --no-codesign
and i am getting this error:
when i run flutter build ios --no-codesign
Xcode's output:
↳
=== BUILD TARGET Runner OF PROJECT Runner WITH CONFIGURATION Release ===
ld: warning: directory not found for option
'-L/Users/brijeshlakkad/starcore_for_ios/python.files/python-3.6'
ld: library not found for -lpython3.6m
clang: error: linker command failed with exit code 1 (use -v to see
invocation)
ld: warning: directory not found for option
'-L/Users/brijeshlakkad/starcore_for_ios/python.files/python-3.6'
ld: library not found for -lpython3.6m
clang: error: linker command failed with exit code 1 (use -v to see
invocation)
Encountered error while building for device.
2.9s
Python version: _3.6.5_1_
flutter version: 1.0.0
What i have done:
1. Build Active Architecture Only : YES
and
2. Targets >> Build Settings >> Linking >> Other Linker Flags: $(inherited)
As you can see error below
I'm getting the library not found for -lGoogleToolboxForMac while running the xcodebuild command from commandline.
Most of the suggestions for this issue is resolving using xcode project. The pipeline calls the Cloud based MacOS agent and doesn't have any physical access to Mac system.
I tried this suggestion command line option but no luck. How do I include lGoogleToolboxForMac part of the build command?
2018-12-10T01:51:35.9852980Z
2018-12-10T01:51:35.9853530Z ▸ Compiling main.m
2018-12-10T01:51:35.9854040Z ▸ Compiling UniversalAnalyticsPlugin.m
2018-12-10T01:51:35.9854790Z ▸ Compiling TouchID.m
2018-12-10T01:51:35.9855390Z ▸ Compiling TextResponseSerializer.m
2018-12-10T01:51:35.9856130Z ▸ Compiling TextRequestSerializer.m
2018-12-10T01:51:35.9856920Z ▸ Linking MyApp
2018-12-10T01:51:35.9857780Z ⚠️ ld: directory not found for option '-L/Users/vsts/Library/Developer/Xcode/DerivedData/MyApp-hjgdkeujtihqvvhkvkijivuagzlb/Build/Products/Release-iphoneos/GoogleToolboxForMac'
2018-12-10T01:51:35.9858710Z ⚠️ ld: directory not found for option '-L/Users/vsts/Library/Developer/Xcode/DerivedData/MyApp-hjgdkeujtihqvvhkvkijivuagzlb/Build/Products/Release-iphoneos/Protobuf'
2018-12-10T01:51:35.9859570Z ⚠️ ld: directory not found for option '-L/Users/vsts/Library/Developer/Xcode/DerivedData/MyApp-hjgdkeujtihqvvhkvkijivuagzlb/Build/Products/Release-iphoneos/nanopb'
2018-12-10T01:51:35.9860760Z ⚠️ ld: directory not found for option '-Liphoneos'
2018-12-10T01:51:35.9861030Z
2018-12-10T01:51:35.9861860Z ❌ ld: library not found for -lGoogleToolboxForMac
2018-12-10T01:51:35.9861920Z
2018-12-10T01:51:35.9862190Z
2018-12-10T01:51:35.9862290Z
2018-12-10T01:51:35.9862870Z ❌ clang: error: linker command failed with exit code 1 (use -v to see invocation)
My code pipeline includes the below steps:
Install Apple Certificate
Install Mobile Provision file
Install Node JS
Install Ionic
Install Cordova
Install NPM
Install Pod
Ionic Cordova Platform Add ios
Ionic Cordova Build ios
What I'm missing here?
I have the same situation, but I have an extra step between 6 and 7 to install cocoapods.
I had fixed a similar problem by running the command pod install in the platforms/ios/ directory after iOS has been added.
I am doing a Release scheme react-native build in Xcode and I get the following error:
ld: warning: directory not found for option '-L/Users/username/Library/Developer/Xcode/DerivedData/ProjectName-qwfopvasfnhysedskapbaefsdwer/Build/Products/Release-iphonesimulator/React' ld: library not found for -lReact clang: error: linker command failed with exit code 1 (use -v to see invocation)
I tried to add libReact.a in Link Binary With Libraries section in Build Phases but I can't find the library in my workspace.
Thanks in advance