2

One of the components that I use for my app demands that I use -all_load as one of its linker flags. But when I add this flag, I get an errors from another library that I use in my app. When I archive the app, I get the following errors:

Apple Mach-O Linker Error 64 duplicate symbols for architecture armv7s

What is the solution for this situation?

Bijoy Thangaraj
  • 5,434
  • 4
  • 43
  • 70
  • 1
    If you are trying to add AdMob v6.2 to your project read this: http://googleadsdeveloper.blogspot.com/2012/09/migrating-to-admob-v62-for-ios.html that helped me yesterday. – krafter Oct 01 '12 at 13:17

3 Answers3

1

Just remove that flag and try without it. If still doesn't work try using --force-load per library.

1

Do not try to run your code with no load flag. The reason for the flag is to deal with an Apple linker problem where categories in ObjectiveC libraries do not get processed properly. Try switching to this:

-force_load $(BUILD_PRODUCTS_DIR)/libfoo.a 

EDIT: I have read but not verified that as of Xcode 4.6 this is no longer necessary.

David H
  • 40,852
  • 12
  • 92
  • 138
0

David H's answer is basically correct but has two typos in the code sample. The linker parameters should be as follows for the library that requires the special load behavior:

-force_load $(BUILT_PRODUCTS_DIR)/libfoo.a 

Note: I have encountered a similar situation in my project (using Xcode 4.6.1), but the app still wouldn't link when neither -all_load nor -force_load were specified (targeting both iOS5 and iOS6).

  • Something else must be wrong, since you should not get linker errors. Both flags tell the runtime to take some action when the app launches. All_load forces every linked in library to load, whether its used by the app or not. The force_load flag lets you only load a single library. However, even thought it would link, it would crash since the categories were never loaded. – David H Mar 25 '13 at 23:37
  • In my case, I use both Apptentive and AdMob. Apptentive requires `-all_load` to be on, AdMob requires it to be off. The only solution that works in my case is to add `-force_load /path/to/libApptentiveConnect.a` to linker flags. This is with Xcode 4.6.1. All other options won't link. – Eugene Scherba Mar 26 '13 at 05:50
  • You should request from Apptentive a selective force_load directive. Telling you to use all_load is ridiculous. You are using the -ObjC flag, right? http://stackoverflow.com/a/6630019/1633251 – David H Mar 26 '13 at 11:54