CocoaPods: use static lib into a pod - ios

I have a pod that depends on a static lib (precompiled, source code not available).
In this pod project, i drag and drop the folder containing the ".a" file and some other C, Obj-c files.
When i try to include this pod in an application, Cocoapods copy all that pod files but not the ".a" file.
In the Podspec, im using this to include the precompiled library to my pod
s.ios.vendored_frameworks = 'path/a_staticLib.a'
The line above copy the file in frameworks (Pods folder), this is normal as it is called "vendored_frameworks", but i can't found any solution to work with static library.
the error i have :
ld: framework not found -framework
clang: error: linker command failed with exit code 1 (use -v to see invocation)
Thank you.

As said in CocoaPods Podspec documentation, you need to use vendored_libraries for static libraries.
So this line:
s.ios.vendored_frameworks = 'path/a_staticLib.a'
should be:
s.ios.vendored_libraries = 'path/a_staticLib.a'

Related

ld: library not found for -lFirebaseCore error on release

I've react native app, which I want to release to app store connect. When I build app to simulator, it's all ok, but when I choose 'Generic iOS Device', and click 'Product' -> 'Archive', final I've error:
ld: warning: directory not found for option '-L/Users/__/Library/Developer/Xcode/DerivedData/--butmameeeywydzhbrsswxxghtgte/Build/Intermediates.noindex/ArchiveIntermediates/-/BuildProductsPath/Release-iphoneos/FirebaseCore'
ld: warning: directory not found for option '-L/Users/__/Library/Developer/Xcode/DerivedData/--butmameeeywydzhbrsswxxghtgte/Build/Intermediates.noindex/ArchiveIntermediates/-/BuildProductsPath/Release-iphoneos/FirebaseInstanceID'
ld: warning: directory not found for option '-L/Users/__/Library/Developer/Xcode/DerivedData/--butmameeeywydzhbrsswxxghtgte/Build/Intermediates.noindex/ArchiveIntermediates/-/BuildProductsPath/Release-iphoneos/FirebaseMessaging'
ld: warning: directory not found for option '-L/Users/__/Library/Developer/Xcode/DerivedData/--butmameeeywydzhbrsswxxghtgte/Build/Intermediates.noindex/ArchiveIntermediates/-/BuildProductsPath/Release-iphoneos/GoogleUtilities'
ld: warning: directory not found for option '-L/Users/__/Library/Developer/Xcode/DerivedData/--butmameeeywydzhbrsswxxghtgte/Build/Intermediates.noindex/ArchiveIntermediates/-/BuildProductsPath/Release-iphoneos/Protobuf'
ld: warning: directory not found for option '-L/Users/__/Library/Developer/Xcode/DerivedData/--butmameeeywydzhbrsswxxghtgte/Build/Intermediates.noindex/ArchiveIntermediates/-/BuildProductsPath/Release-iphoneos/nanopb'
ld: warning: directory not found for option '-F/Users/__/Desktop/Projects/-/react-client-app/ios/../ios/RNFirebase'
ld: library not found for -lFirebaseCore
clang: error: linker command failed with exit code 1 (use -v to see invocation)
I tried everything, but error still showing when I try to release app.
I tried:
removing node_modules, package-lock.json, pods folder, podfile.lock and install dependencies again
add RNFirebase in Target dependencies
add $(SRCROOT)/../node_modules/react-native-firebase/ios/RNFirebase in Framework/Header/Library search paths in Build Settings
add libFirebaseCore.a, libFirebaseInstanceID.a, libFirebaseMessaging.a in 'Linked Frameworks and Libraries'
check show and shared checkboxes with Firebase, FirebaseAnalytics, FirebaseCore, FirebaseInstanceID, FirebaseMessaging on 'Product' -> 'Scheme' -> 'Manage Schemes'
add Firebase, FirebaseCore, FirebaseAnalytics, FirebaseAnalyticsInterop, FirebaseInstanceID, FirebaseMessaging, RNFirebase in 'Product' -> 'Scheme' -> 'Edit Scheme'
Podfile
platform :ios, '11'
target '__' do
pod 'Fabric'
pod 'Crashlytics'
pod 'Firebase/Core'
pod 'Firebase/Messaging'
end
I wan't to archive app to App Store Connect and Crashlytics. Please, help. Many hours spent on this have had no effect
Firstly, you're opening the .xcworkspace file and not .xcodeproject correct?
You're probably ahead of me but something that worked when I had issues:
Close XCode
rm -rf ~/Library/Developer/Xcode/DerivedData
Delete node_modules, Pods folder, podfile.lock AND your app.xcworkspace file
Remove everything from podfile except Firebase/Core
pod install
Open new xcworkspace file
Run build (not archive)
Wait for completion (or error)
Add other pods back to podfile
pod install
Clean build folder
Archive
Also ensure path in header search paths is set to recursive

Framework not found error when using Cocoapods in a framework inside parent project

I have a MyApp.xcodeworkspace that uses a homegrown MyAppKit iOS framework.
MyAppKit is included as xcodeproject inside the parent MyApp project.
When I include Firebases and Google Tag Manager via Cocoapods in MyAppKit framework and compile the parent project, I get this error.
ld: framework not found Pods_MyAppKit
and a bunch of warnings:-
ld: warning: directory not found for option '-F/Users/this.user/Library/Developer/Xcode/DerivedData/MyApp-enzvpdzsyhjszqbnwiclnpszlyri/Build/Products/Debug-iphonesimulator/FirebaseCore'
ld: warning: directory not found for option '-F/Users/this.user/Library/Developer/Xcode/DerivedData/MyApp-enzvpdzsyhjszqbnwiclnpszlyri/Build/Products/Debug-iphonesimulator/FirebaseInstanceID'
ld: warning: directory not found for option '-F/Users/this.user/Library/Developer/Xcode/DerivedData/MyApp-enzvpdzsyhjszqbnwiclnpszlyri/Build/Products/Debug-iphonesimulator/GTMSessionFetcher'
ld: warning: directory not found for option '-F/Users/this.user/Library/Developer/Xcode/DerivedData/MyApp-enzvpdzsyhjszqbnwiclnpszlyri/Build/Products/Debug-iphonesimulator/GoogleToolboxForMac'
ld: warning: directory not found for option '-F/Users/this.user/Library/Developer/Xcode/DerivedData/MyApp-enzvpdzsyhjszqbnwiclnpszlyri/Build/Products/Debug-iphonesimulator/GoogleUtilities'
ld: warning: directory not found for option '-F/Users/this.user/Library/Developer/Xcode/DerivedData/MyApp-enzvpdzsyhjszqbnwiclnpszlyri/Build/Products/Debug-iphonesimulator/Protobuf'
ld: warning: directory not found for option '-F/Users/this.user/Library/Developer/Xcode/DerivedData/MyApp-enzvpdzsyhjszqbnwiclnpszlyri/Build/Products/Debug-iphonesimulator/nanopb'
Background...
Came the need to import Firebase and Google Tag Manager as Cocoapods in MyAppKit framework.
I've done the required pod init, pod install in MyAppKit without any errors.
MyAppKit.xcworkspace on its own builds and compiles successfully.
The Podfile in MyAppKit looks like this:-
# Uncomment the next line to define a global platform for your project
platform :ios, '11.0'
target 'MyAppKit' do
# Comment the next line if you're not using Swift and don't want to use dynamic frameworks
use_frameworks!
# Pods for MyAppKit
pod 'Firebase/Core', '~> 5.19'
pod 'Firebase/ABTesting'
pod 'Firebase/Performance'
pod 'Firebase/RemoteConfig'
pod 'Firebase/Analytics'
pod 'GoogleTagManager', '~> 7.1'
pod 'Google-Mobile-Ads-SDK'
end
I expect there to be minimal changes to the parent project and ideally don't want to include the same Pods (as in the framework MyAppKit) in the main project as well.
Is there anything incorrect in the way I'm including the Pods in MyAppKit framework.
Is there something additional that I need to do in my parent project MyApp to make this work ?
Thanks,
Tas

ld: library not found for -lCocoaLumberjack

I updated pods for SalesforceSDKCore 4.3.1 and SalesforceRESTApi 4.3.1. When I did pod install it in turn installed cocoaLumberjack library which is a dependent library I suppose. After successful install of Pods, I couldn't build successfully, as I am getting this error -
ld: library not found for -lCocoaLumberjack
clang: error: linker command failed with exit code 1 (use -v to see invocation)
I deleted my Library search paths, added/deleted inerited in Other linker Flags, nothing seem to work. These are my search path and other linker flag settings.
My Pod file -
# platform :ios, '8.0'
target 'Custom' do
# Uncomment the next line if you're using Swift or would like to use dynamic frameworks
# use_frameworks!
# Pods for Custom
source 'https://github.com/forcedotcom/SalesforceMobileSDK-iOS-Specs.git'
source 'https://github.com/CocoaPods/Specs.git'
pod 'SalesforceSDKCore'
pod 'XMLDictionary', '~> 1.4'
pod 'SalesforceNetwork'
pod 'SmartStore'
pod 'SmartSync'
end
I had the same problem. I tried many solutions, some of them are:
File/Workspace Settings/Derived Data Arrow -> Delete DerivedData folder, empty trash
Terminal -> pod deintegrate , pod install
If you renamed your target's name, then:
Target/Build Settings/Test Host :: $(BUILT_PRODUCTS_DIR)/TargetName.app/TargetName
I really hate this linker command failed problem. I get it all the time and every time I need to follow another solution to solve this. I must have given over 30 hours of my life to this s#$t.

ld: framework not found for architecture x86_64

ld: framework not found QorumLogs for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
I'm getting this in my test files which used to work for months now. This is my header in the file:
import XCTest
import QorumLogs
#testable import MyAppName
The only thing I've changed recently is, update cocoapods, (QorumLogs is a pod), then installed Smooch.io pod, then for the first time added objective-c bridging header, created some Obj-C files and imported smooch.io framework.
Using Xcode 7.3, what can be the problem?
In your podfile, you should include the framework thats causing problems inside the AppTests as well.
target 'MyApp' do
pod 'FBSDKCoreKit'
end
target 'MyAppTests' do
pod 'FBSDKCoreKit'
end
After this:
Clean
Delete Derived Data

how to add cocos2d together with AFNetworking in Xcode

My project start with cocos2d v3 and run smooth. However, when I add AFNetworking to my project,
the problem
"ld: library not found for -lPods-AFNetworking
clang: error: linker command failed with exit code 1 (use -v to see invocation)" happen.
I used pod install and pod file is
platform :ios, ‘7.0’
pod 'AFNetworking', '~> 2.0'
during the installing, below messages show out
[!] The abc [Debug] target overrides the HEADER_SEARCH_PATHS build setting defined in `Pods/Target Support Files/Pods/Pods.debug.xcconfig'. This can lead to problems with the CocoaPods installation
[!] The abc [Release] target overrides the HEADER_SEARCH_PATHS build setting defined in `Pods/Target Support Files/Pods/Pods.release.xcconfig'. This can lead to problems with the CocoaPods installation
so I go to project->target->build setting-> header search paths and put $(inherited) inside, then it can install success.
However, the cocos2d library wasn't call. So I go to Pods.debug.xcconfig and Pods.release.xcconfig to add
HEADER_SEARCH_PATHS = "${PODS_ROOT}/Headers/Public" "${PODS_ROOT}/Headers/Public/AFNetworking" "$(SRCROOT)/$(PROJECT_NAME)/Libraries/kazmath/include" "$(SRCROOT)/$(PROJECT_NAME)/Libraries/Chipmunk/chipmunk/include" "$(SRCROOT)/$(PROJECT_NAME)/Libraries/Chipmunk/objectivec/include"
finally the problem "ld: library not found for -lPods-AFNetworking
clang: error: linker command failed with exit code 1 (use -v to see invocation)" still happen.
Are the above steps not correct? Or is there any other way to add cocos2d and AFNetworking together? Thank you.

Resources