Skip to content
This repository has been archived by the owner on Jan 12, 2019. It is now read-only.

not able to use CardIO.framework , gives linker error #276

Open
jamehta opened this issue Jan 23, 2018 · 10 comments
Open

not able to use CardIO.framework , gives linker error #276

jamehta opened this issue Jan 23, 2018 · 10 comments

Comments

@jamehta
Copy link

jamehta commented Jan 23, 2018

General information

  • Using xcode 8.3.3., ios 9.3, cocoapods 1.0.1

Issue description

I have a ios App X which uses my ios Framework Y as dependency.

Framework Y uses CardIO. i have altered the CardIO.podspec to include .m files to make it use as framework in my Frameowork Y.

Compilation is fine but then i get a linker error as shows in attached snapshot.

If i go to framework Y, add all the 3 *.a files in linked binaries and frameworks section of framework Y, which CardIO gives then error goes away.

But now if i use framework Y in ios App X where Y comes as dependency, then i dont know what i should write in my podspec so that my framework Y builds while building app X.

Ideally i would expect that there should be no need to add the 3 *.a files of CardIO in linked framework and binarries. It should just link having CardIO.framework in linked framework and binaries section of build setting.

@jamehta
Copy link
Author

jamehta commented Jan 23, 2018

@keith

@keith
Copy link
Contributor

keith commented Jan 24, 2018

Can you add a sample project that reproduces the issue?

@jamehta
Copy link
Author

jamehta commented Jan 24, 2018

@keith please find the test project here - https://github.com/jamehta/Modules - Here TestProjTestApp uses framework TestProjFramework which uses CardIO framework.

When you build the TestProjTestApp, you will see below linker error. My end goal is both TestProjFramework and TestProjTestApp build should succeed.

screen shot 2018-01-24 at 3 17 45 pm

@keith
Copy link
Contributor

keith commented Jan 26, 2018

The problem here is that since you want CardIO to be a dependency of both your app, and a dynamic framework, CocoaPods will refuse to do this since that would result in 2 copies of CardIO being bundled with your app.

The solution to this is to either remove the dependency on CardIO from one of the places, or to change your dynamic framework into a static framework or static library. As of CocoaPods 1.4.0 they now support a spec attribute for forcing your pod to use a static framework instead of a dynamic library, this should help. http://blog.cocoapods.org/CocoaPods-1.4.0/

@jamehta
Copy link
Author

jamehta commented Jan 26, 2018

Thanks @keith for getting back. But if you see my TestApp, i dont have any dependency CardIO
. infact i can remove the files accessing cardio libraries (UseCardio.swift) which comes thru pods. still i get this linking error.

@keith
Copy link
Contributor

keith commented Jan 26, 2018

You have the dependency on it in 2 places though, TestProj (in the podspec) and TestProjFramework (in the Podfile)

@jamehta
Copy link
Author

jamehta commented Jan 26, 2018

Podfile:

target 'TestProjTestApp' do
pod 'TestProj', :path => '.' //this is indirect dependency on TestProjFramework and not CardIO
end

Podspec:

s.dependency 'CardIO', '5.5.5' //this is TestProjFramework depeneding on cardio

@jamehta
Copy link
Author

jamehta commented Jan 26, 2018

i dont have something like:

target 'TestProjTestApp' do
pod 'TestProj', :path => '.' //this is indirect dependency on TestProjFramework and not CardIO
pod 'CardIO', '5.5.5' - //this is the case you are suggesting which i dont have this line
end

@jamehta
Copy link
Author

jamehta commented Jan 27, 2018

I got temporary solution to this issue. In my framework, i used the Xcode9's “Linking” setting namely Mach-O Type and set it to “Static Library”. This resolves the linker error which we are getting for CardIO when we use it as framework

@JeffBoggis
Copy link

@jamehta Hi there. Did you find any solution apart from setting Mach-O type to "Static Library" ?
Thanks!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants