run pod spec lint --verbose
Validation successfully.
Error when running xcodebuild
CocoaPods : 1.4.0.rc.1
Ruby : ruby 2.3.3p222 (2016-11-21 revision 56859) [universal.x86_64-darwin17]
RubyGems : 2.5.2
Host : Mac OS X 10.13.3 (17D102)
Xcode : 9.2 (9C40b)
Git : git version 2.16.2
Ruby lib dir : /System/Library/Frameworks/Ruby.framework/Versions/2.3/usr/lib
Executable Path: /usr/local/bin/pod
cocoapods-deintegrate : 1.0.1
cocoapods-plugins : 1.0.0
cocoapods-search : 1.0.0
cocoapods-stats : 1.0.0
cocoapods-trunk : 1.3.0
cocoapods-try : 1.1.0
Cannot add a link to the project because it is a private one. The problem is that I added a library using s.vendored_libraries that was generated using lipo command. It has symbols and everything for archs i386, x86_64, armv7 and arm64, but I always get the same error when validating the podspec: ld: library not found for -l for both i386 and x86_64 architectures.
We cannot easily reproduce or provide and suggestions with the information given here. Would love to see an example demonstrating the issue.
By default, Cocoapods only looks up to https://github.com/CocoaPods/Specs.git (Public) for libraries podspecs. For Cocoapod to look at your private ones, you have to pass your private Specs path in lint command line.
If You don't have Specs repo (a list of all your podspecs) - https://guides.cocoapods.org/making/private-cocoapods.html
pod lib lint [YOUR_LIB.podspec] sources='https://github.com/CocoaPods/Specs.git, your_spec_repo'`
Then in You project Podfile, make sure you have those on top of your podfile:
# If you use public pod libraries
source 'https://github.com/CocoaPods/Specs.git'
# Your Specs address as SSH or HTTPS.
# If You use CI (like Jenkins), I suggest SSH link with set up keys in your CI machine
# unless you find a way how to pass your login details to CI
source 'YOUR_SPEC_REPO'
So at the end your Podfile should look something like
source 'https://github.com/CocoaPods/Specs.git'
source 'https://github.com/MyTeam/Specs.git'
pod 'Google/Analytics'
pod 'MyPrivateLib'
I already did that, but thanks anyway for the info.
I tried to reproduce the error with the creation of a new static library but this one seems to work. I don't know why the project I'm working in right now has this issue. It's like it does not detect simulator architectures for some reason when running xcodebuild during podspec validation and the universal .a was created the same way.
Best way to catch build errors is make sure your example project (somewhere in your lib repo) is running fine which uses Podfile with your dev pod inserted like pod 'YourLibrary', :path => '../'.
Note: Make sure You don't have direct links to your library files as compiler might take that and ignore dev pod.
Thank you for helping. Issue solved.
It seems that when loading the libraries xcode looks for files with the name of the library and the prefix "lib". For example, if your library is named "Test.a", xcode will look for "libTest.a" and it will failed when loading the library. So in order for it to work you'll have to name it "libTest.a", so that when xcode runs ld to load -lTest it will be able to find it.
I'm closing the issue. Thank you for helping.
@ulayuno Thanks for the workaround, but I think this is still a problem.
Hey @0x5e , it is not a problem actually, at least not from CocoaPods contributors :)
It has been a standard behaviour in C for many years. With "-lname" option, linker looks for library named "libname", not "name".
Here is a piece from gcc man page:
-l library ... ... surrounds library with lib and .a and searches several directories.
@MertCelik Thanks for the explanation 😄
Most helpful comment
Hey @0x5e , it is not a problem actually, at least not from CocoaPods contributors :)
It has been a standard behaviour in C for many years. With "-lname" option, linker looks for library named "libname", not "name".
Here is a piece from gcc man page: