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

Eliminate Use of all_load #239

Closed
blakewatters opened this Issue Jul 24, 2011 · 1 comment

Comments

Projects
None yet
1 participant
@blakewatters
Member

blakewatters commented Jul 24, 2011

Blake,

I love your library. Well done.

I am looking for a way to link with your library and not use -all_load for a variety of reasons including debugging purposes with other dependent libraries that I use (our own). I haven't looked into it, but i'm assuming that you do the -all_load to fix the catalog bug / linke bug with LCC. The linker fails when you have multiple architectures (armv6 and armv7) and you use the -ObjC linker flag.

Something like this error

=====8<=====8<=====8<=====8<

ld: duplicate symbol OBJC_METACLASS$_RKJSONParser in /Users/ryanconnelly/Documents/pps/mxpos/ThirdParty/RestKit/libRestKitJSONParserSBJSON.a(RKJSONParser+SBJSON.o) and /Users/ryanconnelly/Documents/pps/mxpos/ThirdParty/RestKit/libRestKitJSONParserYAJL.a(RKJSONParser+YAJL.o) for architecture armv6
collect2: ld returned 1 exit status
Command /Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/llvm-gcc-4.2 failed with exit code 1
=====8<=====8<=====8<=====8<=====8<

I know three20 came up with a creative way to avoid using the -all_load. They wrote an doc about it here:

http://blog.binaryfinery.com/universal-static-library-problem-in-iphone-sd

Look at "Update2" for the "dummy class" solution which I find is the best option.

If you look in their source code on github you can see exactly how the used it.

Here is an example:
https://github.com/JaredCrawford/iWVU/blob/51eb3b0b7d77d14d21e950fe91e75f1b486c6ed5/Libraries/Three20/src/Three20Core/Sources/NSMutableArrayAdditions.m

Basically, you include a macro for each object file that only contains a category extension which fixes the link errors without using the -all_load linker flag.

Anyway, just thought I'd share that info. Thanks.

Reply to this email directly or view it on GitHub:
http://github.com/inbox/10441436#reply

@blakewatters

This comment has been minimized.

Show comment
Hide comment
@blakewatters

blakewatters Aug 30, 2011

Member

Looks like we just need to adapt this macro and use around all the categories, including the Vendor/ ones. Then we can drop -all_load.


#define FIX_CATEGORY_BUG(name)
@interface FIXCATEGORYBUG ## name;
@end
@implementation FIXCATEGORYBUG ## name;
@end
Member

blakewatters commented Aug 30, 2011

Looks like we just need to adapt this macro and use around all the categories, including the Vendor/ ones. Then we can drop -all_load.


#define FIX_CATEGORY_BUG(name)
@interface FIXCATEGORYBUG ## name;
@end
@implementation FIXCATEGORYBUG ## name;
@end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment