Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Podspec value for spec.libraries should not be added to OTHER_LIBTOOLFLAGS #2765

Closed
kanstantsin opened this issue Oct 31, 2014 · 8 comments
Closed
Labels
d1:easy An easy ticket that is a good start for first-time contributors s2:confirmed Issues that have been confirmed by a CocoaPods contributor

Comments

@kanstantsin
Copy link

I've encountered an issue while building static library target which depends on a pod with dynamic library dependencies. That's needed for running tests on the library.
In this case cocoapods add these dynamic libraries flags to my static library's OTHER_LD_FLAGS which is copied to OTHER_LIBTOOLFLAGS, which produces errors like this:
error: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/libtool: can't locate file for: -lsqlite3
while build.

This happens because dynamic libraries should only be linked to the app, and should not be linked to static library.
So, values, specified in spec.libraries should go to OTHER_LD_FLAGS but not to OTHER_LIBTOOLFLAGS.

Here is the sample project to demonstrate the issue.
Replacing
pod 'AFNetworking'
with
pod 'AFNetworking', :podspec => '.'
and running pod install or pod update reproduces that.

@alloy
Copy link
Member

alloy commented Oct 31, 2014

Indeed. Is this something you will want to look into to create a patch for?

@alloy
Copy link
Member

alloy commented Oct 31, 2014

Looking back at the ticket that was about the need to specify OTHER_LIBTOOLFLAGS, it seems we should only need to specify the individual Pods targets there and any vendored_libraries (assuming they are static libraries).

@kanstantsin
Copy link
Author

Sounds like a solution.
Unfortunately I'm not familiar to cocoapods project and not very good in ruby.
I've made a temporal workaround in my project by removing $(inherited) from OTHER_LD_FLAGS and specifying all of the pods flags manually.

It would be great if someone could fix that in a meantime.

@segiddins segiddins added d1:easy An easy ticket that is a good start for first-time contributors s2:confirmed Issues that have been confirmed by a CocoaPods contributor labels Nov 5, 2014
@k0nserv
Copy link
Member

k0nserv commented Nov 10, 2014

I was looking briefly at this and it seems like it would require changing the way that Xcodeproj::Config works to differentiate between OTHER_LD_FLAGS and OTHER_LIBTOOLFLAGS

@themackworth
Copy link
Contributor

@k0nserv Is that really need? I have no idea what I am doing, but would something like this work?
themackworth@29aed5c

@themackworth
Copy link
Contributor

@alloy I was messing around with your suggestion this past thanksgiving break, and I ran into an issue with a few pods using your suggestion.

For example, the GoogleAds-IMA-iOS-SDK podspec doesn't use vendored_libraries but instead uses:

"preserve_paths": "GoogleIMASDK3/libGoogleIMA3.a",
"libraries": "GoogleIMA3",

This means that if you add only the pod target and vendored_libraries, then it won't link in their library. I assume that this is a bug in their podspec but I am sure others are doing it also.

@bamx23
Copy link

bamx23 commented Jun 2, 2015

Will this issue be solved?

@segiddins
Copy link
Member

This was fixed by #3677.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
d1:easy An easy ticket that is a good start for first-time contributors s2:confirmed Issues that have been confirmed by a CocoaPods contributor
Projects
None yet
Development

No branches or pull requests

6 participants