-
Notifications
You must be signed in to change notification settings - Fork 36
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
ARC restriction errors even with -fno-objc-arc #15
Comments
No - that doesn't seem to solve the problem. |
I've created the simplest possible project with handlebars-objc and cocoapods 0.37.0 and it fails. So this is a legitimate problem. See here. Hopefully someone will have some ideas... |
This is because Cocoapods apply the A solution is to add the flags added by Cocoapods (eg Please note however that these will be removed after each |
Hello, sorry, I’m busy working on another project right now, but I will look into this as soon as I can. — bertrand.
|
@guillaume-algis - will pod update also remove them? Or just pod install? Also, thanks for taking the time to make a screenshot :-) |
Great fix, but as you said - temporary. Still, it's nice to have a workaround until this is addressed. Thanks again. |
Yes, thank you for that work around, nice sleuthing. 👍 |
@guillaume-algis - do you think it would be possible to use a post_install script to re-add these flags after pod install runs? Something like this. It makes sense to me conceptually, but I'm not sure which files would need altering. After adding the flags you recommended, I don't see them in any of the xcconfig files... |
They are added in the But until the bug is addressed in Cocoapods, yes it should probably work. |
I don't have a I just have a top level .xcodeproj and a Pods.xcodeproj, and neither of them have the Am I missing something? Also, this bug (or issue) has existed in Cocoapods for a long time. I'm not holding my breath for them to address it. So a hacky script might be a good thing to have around... |
Oops, they are there like you said. In |
That's the beauty of open source: you can fix it yourself and open a PR ;) |
After looking into Cocoapods XCodeproj, I decided to write a cocoapods Basically, it lets me run the latest version of Cocoapods (0.37.0) while using handlebars-objc. But it should be pretty good at setting any build settings that you might need to modify. Hopefully it will help someone out... Here's the git repo for the script. |
So, how would I go about adding handlebars-objc as a dependency in my podpsec? The post-install hook works in a podfile, but I don't think you can add that in a podspec (at least, not in a third party one). That said, props for having it work with Carthage :) |
@Bertrand - will this ever be addressed on your side? Now that we are forced to |
@ExoticObjects we're using the following
|
Excellent! You saved me some time! Thanks. EDIT: Well, I spoke too soon. After running your post_install hook, I'm getting the same errors as before. I pushed a simple demo project to github that describes the problem. Basically, using the simplest possible Podfile with the post install hook above will allow handlebars-objc to compile (hence my early enthusiasm...). But as soon as I attempt to use handlebars in any way, I get the same old errors.
results in:
Hopefully I'm missing something simple! |
Is it a very large undertaking to update the code for ARC? Or are there other interests at play here? |
@ExoticObjects comment out the line that is throwing the error. Not a perfect solution (by any means) but it works. |
I submitted a pull request. @Bertrand, please have a look! I can't think of any reason that this tiny change would break anything, but... |
@ExoticObjects Just use Also, your example project overrides the (Cocoapods complain about this after a
|
@schell ARC slightly slows down code when a lot of objects are created. It's totally fine to use it in an application, but since in objc we have a choice, it's better to not use it in libraries. In swift of course it's a different story :) |
I respectfully disagree. Not using ARC today is a major downside for 99.99% of the libraries (only exceptions are maybe performance-critical libs and, let's be honest, handlebars-objc isn't one of them). ARC "performance downside" (if this is even a thing) is largely compensated by what it brings to the table. Let me also use this as an occasion to remind you that I had a PR (#12) opened for more than a year to fix multiple memory leaks in this lib. Leaks which would have never existed with ARC enabled. |
@guillaume-algis In my experience, on (big) real-life projects, moving to ARC incurrs at least 20% performance loss scattered all over the code and thus very hard to fix (due mostly to additional retain-release + atomic RC by default). Performance loss may be fine for some apps (I generally use ARC for apps), but as a library, handlebars-objc cannot make that choice on behalf of developers. GRMustache made the same choice, for exactly the same reason. "handlebars-objc is not performance critical" Regarding the leaks, I'm sorry for that. I was away from all this this last year. I'm looking at your PR asap. |
I'm glad your lib has the performance that it does!
|
Hmm, did not mean to close this one. |
I just released v1.4.3, still based on Handlebars 2.0 but which should fix the issue. |
@ExoticObjects is the issue solved on your side with the new pod version? |
Yes, thanks! |
It seems I'm getting ARC restriction errors even when the files involved are being compiled with -fno-objc-arc. I'm guessing some other related files also need to be compiled with -fno-objc-arc.
The text was updated successfully, but these errors were encountered: