Reputation: 705
I have been facing this lingering issue. When I try to Build the project by selecting iOS device in my Xcode it builds the code with out any error but when I trying the same with iOS simulator it shows me the following error. Is there any way to avoid this library file when I build in Simulator? I have tried the following Link as well but i couldn't figure the exact solution.
Thanks In Advance.
6 duplicate symbols for architecture i386
ld: warning: ignoring file /Users/iOS-MobileTeam/Downloads/iOS/LibraryFiles/libANMobilePaymentLib.a, missing required architecture i386 in file /Users/iOS-MobileTeam/Downloads/iOS/LibraryFiles/libANMobilePaymentLib.a (2 slices)
duplicate symbol _des_set_key in:
/Users/iOS-MobileTeam/Downloads/iOS/LineaSDK/libdtdev.a(des-524F6BE9122BCA82.o)
/Users/iOS-MobileTeam/Downloads/iOS/LineaSDK/libdtdev.a(des-D9CE0CBEE0B3BA81.o)
duplicate symbol _des_encrypt in:
/Users/iOS-MobileTeam/Downloads/iOS/LineaSDK/libdtdev.a(des-524F6BE9122BCA82.o)
/Users/iOS-MobileTeam/Downloads/iOS/LineaSDK/libdtdev.a(des-D9CE0CBEE0B3BA81.o)
duplicate symbol _des_decrypt in:
/Users/iOS-MobileTeam/Downloads/iOS/LineaSDK/libdtdev.a(des-524F6BE9122BCA82.o)
/Users/iOS-MobileTeam/Downloads/iOS/LineaSDK/libdtdev.a(des-D9CE0CBEE0B3BA81.o)
ld: 3 duplicate symbols for architecture i386
clang: error: linker command failed with exit code 1 (use -v to see invocation)
Ignoring file /Users/iOS-MobileTeam/Downloads/iOS/LibraryFiles/libANMobilePaymentLib.a, missing required architecture i386 in file /Users/iOS-MobileTeam/Downloads/iOS/LibraryFiles/libANMobilePaymentLib.a (2 slices)
Upvotes: 0
Views: 1571
Reputation: 23651
The issue is that your libANMobilePaymentLib.a static archive was not built properly. If that is a 3rd party library, you should ask the author to provide an updated version which addresses this issue, and trojanfoe's instructions on unpacking and repacking the archive without one of the des implementations is probably your best bet for a temporary workaround.
If you built the library yourself or want to pass on information to the author, the issue is that the library's i386 slice contains duplicates of the des_set_key, des_encrypt, and des_decrypt symbols. I suspect that this was caused by accidentally including des.c twice when building libANMobilePaymentLib.a. Another possibility is that the author of libANMobilePaymentLib.a intended those functions to be static and not exported.
Upvotes: 0
Reputation: 705
Finally I found the fix for the above issue. all credit goes to @Khanh
How to ignore some static library for iOS simulator
The above link helped me to fix the issue.
Steps to Fix The Issue:
Upvotes: -1
Reputation: 122458
The static library is broken as it contains two separate object files containing the same symbols (functions).
It must be rebuilt, or if you don't have the source you could unpack it, remove the offending file, and then re-pack it (untested):
$ mv libdtdev.a libdtdev-old.a
$ mkdir xxx
$ cd xxx
$ ar x ../libdtdev-old.a
$ rm des-D9CE0CBEE0B3BA81.o
$ ar cr ../libdtdev.a *.o
$ cd ..
$ rm -rf xxx
However if the static library contains multiple architectures, this becomes much more complicated.
Upvotes: 2