Skip to content
This repository

Include -fobjc-arc linker flag if any pods are arc enabled #142

Closed
subdigital opened this Issue February 27, 2012 · 5 comments

3 participants

Ben Scheirman Luke Redpath Eloy Durán
Ben Scheirman
Collaborator

I ran into this bug today. I have 2 pods that are arc enabled, but my project is not. When running on a 4.3 device, I'd get errors like this:

Undefined symbols for architecture armv7:
"_objc_storeStrong", referenced from

There's some detail on this issue here:
http://stackoverflow.com/questions/8756418/static-library-with-arc-support-linked-to-non-arc-project-causing-linker-errors

Apparently there's a bug in LLVM, and it may not automatically include the library that gives support to 4.3 devices. You can force it by including the linker flag -fobjc-arc (note: linker flag for the target, not for an individual files).

I think CocoaPods could detect this scenario and add the appropriate setting in Pods.xcconfig.

I don't believe this is an issue if the main project is configured to use ARC.

Luke Redpath lukeredpath closed this in ea918cd March 04, 2012
Luke Redpath
Owner

Please re-open if this hasn't fixed your issue.

Luke Redpath
Owner

May have to revert this one. It may be that -fobjc-arc as a linker flag was unsupported as it appears to no longer work with the latest version of Xcode. I get this. Can anybody else confirm this?

Luke Redpath lukeredpath reopened this March 26, 2012
Luke Redpath
Owner

I'm going to re-implement this such that this workaround needs to be explicitly enabled. As its a workaround for a compiler bug, it might be worth investigating to see if the original issue you were having is fixed in the latest version of Xcode too.

Luke Redpath lukeredpath closed this issue from a commit March 26, 2012
Luke Redpath Looks like the -fobj-arc flag we added to OTHER_LD_FLAGS in ea918cd was
an unsupported feature as it has now been removed from Xcode 4.3.2, 
causing lib tool to complain about an unrecognised flag.

I considered removing this entirely but have decided to keep it around 
as an option for the time being. You can get the previous behaviour by
adding set_arc_compatibility_flag! to your Podfile.

I'd like to get rid of this entirely eventually. Re-closes #142 unless
anybody has any objections.
3a4344b
Luke Redpath lukeredpath closed this in 3a4344b March 26, 2012
Eloy Durán
Owner
alloy commented March 26, 2012

@lukeredpath Could you add a note to the CHANGELOG about this?

Luke Redpath
Owner

Done

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.