duplicate symbols for architecture armv7

你离开我真会死。 提交于 2019-11-26 12:56:18

问题


Getting following error when try to use Layar SDK in my existing app. How can I solve this?

Ld /Users/pnawale/Library/Developer/Xcode/DerivedData/hub-afxxzaqisdfliwbzxbixsaifljcl/Build/Products/Debug-iphoneos/hub.app/hub normal armv7
    cd /Users/pnawale/Documents/Paresh/Yamaha_iPhone/Code/Final/hub
    setenv IPHONEOS_DEPLOYMENT_TARGET 5.0
    setenv PATH \"/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin:/Applications/Xcode.app/Contents/Developer/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin\"
    /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang -arch armv7 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS6.1.sdk -L/Users/pnawale/Library/Developer/Xcode/DerivedData/hub-afxxzaqisdfliwbzxbixsaifljcl/Build/Products/Debug-iphoneos -L/Users/pnawale/Documents/Paresh/Yamaha_iPhone/Code/Final/hub/ZBarSDK -L/Users/pnawale/Documents/Paresh/Yamaha_iPhone/Code/Final/hub/Infosound/Lib -L/Users/pnawale/Documents/Paresh/Yamaha_iPhone/Code/Final/hub/CrittercismSDK -L/Users/pnawale/Documents/Paresh/Yamaha_iPhone/Code/Final/hub -L/Users/pnawale/Documents/Paresh/Yamaha_iPhone/Code/Final/hub/UserVoiceSDK-2.0.4 -L/Users/pnawale/Documents/Paresh/Yamaha_iPhone/Code/Final/hub/Libraries -F/Users/pnawale/Library/Developer/Xcode/DerivedData/hub-afxxzaqisdfliwbzxbixsaifljcl/Build/Products/Debug-iphoneos -F/Users/pnawale/Documents/Paresh/Yamaha_iPhone/Code/Final/hub -filelist /Users/pnawale/Library/Developer/Xcode/DerivedData/hub-afxxzaqisdfliwbzxbixsaifljcl/Build/Intermediates/hub.build/Debug-iphoneos/hub.build/Objects-normal/armv7/hub.LinkFileList -dead_strip -ObjC -all_load -fobjc-arc -fobjc-link-runtime -miphoneos-version-min=5.0 -lMPOAuthMobile -lsbjson-ios -framework LayarSDK -framework Social -framework AddressBook -framework AddressBookUI -framework UIKit -framework QuartzCore -framework Twitter -framework SystemConfiguration -framework Security -framework OpenAL -framework OpenGLES -framework MessageUI -framework MediaPlayer -framework Foundation -framework CoreGraphics -lc++ -framework CoreTelephony -framework CoreVideo -framework CoreMotion -framework CoreMedia -framework CoreLocation -framework CoreData -framework CoreAudio -framework CFNetwork -framework AVFoundation -framework AudioToolbox -lxml2 -liconv -lz -framework MobileCoreServices -lzbar -linfosound -lCrittercism_v3_4_6 -lUserVoice -o /Users/pnawale/Library/Developer/Xcode/DerivedData/hub-afxxzaqisdfliwbzxbixsaifljcl/Build/Products/Debug-iphoneos/hub.app/hub

duplicate symbol _jpeg_free_large in:
    /Users/pnawale/Documents/Paresh/Yamaha_iPhone/Code/Final/hub/LayarSDK.framework/LayarSDK(jmemansi.o)
    /Users/pnawale/Documents/Paresh/Yamaha_iPhone/Code/Final/hub/LayarSDK.framework/LayarSDK(jmemname.o)
duplicate symbol _jpeg_free_small in:
    /Users/pnawale/Documents/Paresh/Yamaha_iPhone/Code/Final/hub/LayarSDK.framework/LayarSDK(jmemansi.o)
    /Users/pnawale/Documents/Paresh/Yamaha_iPhone/Code/Final/hub/LayarSDK.framework/LayarSDK(jmemname.o)
duplicate symbol _jpeg_get_large in:
    /Users/pnawale/Documents/Paresh/Yamaha_iPhone/Code/Final/hub/LayarSDK.framework/LayarSDK(jmemansi.o)
    /Users/pnawale/Documents/Paresh/Yamaha_iPhone/Code/Final/hub/LayarSDK.framework/LayarSDK(jmemname.o)
duplicate symbol _jpeg_get_small in:
    /Users/pnawale/Documents/Paresh/Yamaha_iPhone/Code/Final/hub/LayarSDK.framework/LayarSDK(jmemansi.o)
    /Users/pnawale/Documents/Paresh/Yamaha_iPhone/Code/Final/hub/LayarSDK.framework/LayarSDK(jmemname.o)
duplicate symbol _jpeg_mem_available in:
    /Users/pnawale/Documents/Paresh/Yamaha_iPhone/Code/Final/hub/LayarSDK.framework/LayarSDK(jmemansi.o)
    /Users/pnawale/Documents/Paresh/Yamaha_iPhone/Code/Final/hub/LayarSDK.framework/LayarSDK(jmemname.o)
duplicate symbol _jpeg_mem_init in:
    /Users/pnawale/Documents/Paresh/Yamaha_iPhone/Code/Final/hub/LayarSDK.framework/LayarSDK(jmemansi.o)
    /Users/pnawale/Documents/Paresh/Yamaha_iPhone/Code/Final/hub/LayarSDK.framework/LayarSDK(jmemname.o)
duplicate symbol _jpeg_mem_term in:
    /Users/pnawale/Documents/Paresh/Yamaha_iPhone/Code/Final/hub/LayarSDK.framework/LayarSDK(jmemansi.o)
    /Users/pnawale/Documents/Paresh/Yamaha_iPhone/Code/Final/hub/LayarSDK.framework/LayarSDK(jmemname.o)
duplicate symbol _jpeg_open_backing_store in:
    /Users/pnawale/Documents/Paresh/Yamaha_iPhone/Code/Final/hub/LayarSDK.framework/LayarSDK(jmemansi.o)
    /Users/pnawale/Documents/Paresh/Yamaha_iPhone/Code/Final/hub/LayarSDK.framework/LayarSDK(jmemname.o)
duplicate symbol _jpeg_free_large in:
    /Users/pnawale/Documents/Paresh/Yamaha_iPhone/Code/Final/hub/LayarSDK.framework/LayarSDK(jmemansi.o)
    /Users/pnawale/Documents/Paresh/Yamaha_iPhone/Code/Final/hub/LayarSDK.framework/LayarSDK(jmemnobs.o)
duplicate symbol _jpeg_free_small in:
    /Users/pnawale/Documents/Paresh/Yamaha_iPhone/Code/Final/hub/LayarSDK.framework/LayarSDK(jmemansi.o)
    /Users/pnawale/Documents/Paresh/Yamaha_iPhone/Code/Final/hub/LayarSDK.framework/LayarSDK(jmemnobs.o)
duplicate symbol _jpeg_get_large in:
    /Users/pnawale/Documents/Paresh/Yamaha_iPhone/Code/Final/hub/LayarSDK.framework/LayarSDK(jmemansi.o)
    /Users/pnawale/Documents/Paresh/Yamaha_iPhone/Code/Final/hub/LayarSDK.framework/LayarSDK(jmemnobs.o)
duplicate symbol _jpeg_get_small in:
    /Users/pnawale/Documents/Paresh/Yamaha_iPhone/Code/Final/hub/LayarSDK.framework/LayarSDK(jmemansi.o)
    /Users/pnawale/Documents/Paresh/Yamaha_iPhone/Code/Final/hub/LayarSDK.framework/LayarSDK(jmemnobs.o)
duplicate symbol _jpeg_mem_available in:
    /Users/pnawale/Documents/Paresh/Yamaha_iPhone/Code/Final/hub/LayarSDK.framework/LayarSDK(jmemansi.o)
    /Users/pnawale/Documents/Paresh/Yamaha_iPhone/Code/Final/hub/LayarSDK.framework/LayarSDK(jmemnobs.o)
duplicate symbol _jpeg_mem_init in:
    /Users/pnawale/Documents/Paresh/Yamaha_iPhone/Code/Final/hub/LayarSDK.framework/LayarSDK(jmemansi.o)
    /Users/pnawale/Documents/Paresh/Yamaha_iPhone/Code/Final/hub/LayarSDK.framework/LayarSDK(jmemnobs.o)
duplicate symbol _jpeg_mem_term in:
    /Users/pnawale/Documents/Paresh/Yamaha_iPhone/Code/Final/hub/LayarSDK.framework/LayarSDK(jmemansi.o)
    /Users/pnawale/Documents/Paresh/Yamaha_iPhone/Code/Final/hub/LayarSDK.framework/LayarSDK(jmemnobs.o)
duplicate symbol _jpeg_open_backing_store in:
    /Users/pnawale/Documents/Paresh/Yamaha_iPhone/Code/Final/hub/LayarSDK.framework/LayarSDK(jmemansi.o)
    /Users/pnawale/Documents/Paresh/Yamaha_iPhone/Code/Final/hub/LayarSDK.framework/LayarSDK(jmemnobs.o)
duplicate symbol _main in:
    /Users/pnawale/Library/Developer/Xcode/DerivedData/hub-afxxzaqisdfliwbzxbixsaifljcl/Build/Intermediates/hub.build/Debug-iphoneos/hub.build/Objects-normal/armv7/main.o
    /Users/pnawale/Documents/Paresh/Yamaha_iPhone/Code/Final/hub/LayarSDK.framework/LayarSDK(jpegtran.o)
ld: 17 duplicate symbols for architecture armv7
clang: error: linker command failed with exit code 1 (use -v to see invocation)

回答1:


This can happen if you accidentally #import a .m file instead of the .h!




回答2:


Generally, this kind of error occurs due to duplicate classes and xibs in your project folder. For example, in my project I had some class files duplicated(.h/.m files). You can see these duplicate classes under target->Build phases->compile sources.

Just look and remove extra classes. Problem will be solved.




回答3:


Happens with static variables in a header file (header file included in more than one implementations file).




回答4:


I was getting this error because I used the Xcode recommended warning flags. GCC_NO_COMMON_BLOCKS = YES was causing the issue. Setting this back to NO fixed it for me.




回答5:


This error can also be caused if you have cyclic imports.... lets suppose you have VC1.h, VC2.h, and VC3.h

examples that will cause the error: (all are the .h files)

  • If VC2 imports VC1 and VC1 imports VC2
  • If VC1 imports VC2 and VC2 imports VC3 and VC3 imports VC1

solution:

  • import inside the .m instead of the .h
  • if the .h needs that class use @class (nameOfClass); instead of importing the .h

Be careful when using #import, only import what you need.




回答6:


Be careful if you're using Cordova iOS 4.5.0, an error of this kind may happen

duplicate symbol _OBJC_METACLASS_$_CDVLogger in:
   /Users/toto/Library/Developer/Xcode/DerivedData/imp-hkzujazvkracgugyxunzwnzpeiqx/Build/Intermediates/imp.build/Debug-iphoneos/imp.build/Objects-normal/armv7/CDVLogger.o
   /Users/toto/Library/Developer/Xcode/DerivedData/imp-hkzujazvkracgugyxunzwnzpeiqx/Build/Products/Debug-iphoneos/libCordova.a(CDVLogger.o)

ld: 2 duplicate symbols for architecture armv7
clang: error: linker command failed with exit code 1 (use -v to see invocation)

It can be due to the use of cordova-plugin-console, which is not useful anymore in Cordova iOS 4.5.0 (and breaks the build too!).

To fix it

cordova plugin remove cordova-plugin-console

See reference : https://cordova.apache.org/announcements/2017/09/08/ios-release.html




回答7:


I have faced this problem once before. The reason is that I copied some methods and variables declared in the implementation body from one class to another. So rename these methods and moved these variable to the interface declaration area => solved.




回答8:


I was seeing the same issue, but with different libraries. The fix was the following:

Target -> Build Phases -> Linked Binary With Libraries

Make sure the libraries included make sense. In my case, my project had libPods*.a (I am using CocoaPods for dependency mgmt) but also a few libraries that were included in my pod shared libraries, and that was causing the duplicates.




回答9:


I just fixed this error. I had CocoaPods installing a few frameworks (AWS, SDWebImage, AFNetworking. I manually dragged in 2 frameworks, Facebook and ImageIO. Most of my "duplicate symbol" errors were caught on Facebook classes. I deleted the framework and added it to the Podfile. Must have been an error or duplication in the libraries required by Facebook.




回答10:


My problem was... odd. I'm not sure how it happened, but at some point, Xcode decided to include some ancient .m file one more time in its .pbxproj file. The only way I found it was by comparing my changes in git, looking at the version of the code where the build first failed.

Simply removing this line solved my issue:




回答11:


I had duplicate files in my Xcode. Physically there were one m-file and one h-file. But in project it were doubled causing duplicates in compile sources. After deleting duplicate m and h file problem was solved.




回答12:


Its because the iPhone simulator got duplicate .h & .m references. I struggled for hours for this bug.

My solution was simple. I copied the project to my pen drive and erased from computer memory.

Opened a new project, copied the storyboard and added the .h &.m files. Some errors fixed by selecting classes again in the storayboard view..




回答13:


I also had duplicate symbols. I just renamed the procedure (app -> app1, app2) and the associated fields app.XXX -> app1.XXX . and it worked !

See : (in a .m file)

AppDelegate* app1;

- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
{
    self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
    if (self) {
        // Custom initialization
        app1 = (AppDelegate *)[[UIApplication sharedApplication] delegate];
    }
    return self;
}

(...)

- (int) getLimit
{
    if (app1.product2buyed)
        return MAXID;
    else if (app1.product1buyed)
        return 70;
    else
        return 10;



回答14:


Please check if you have added any framework more then once, remove all framework if added multiple times and then drag and drop again.

Hope this will resolve your problem. Happy Coding.




回答15:


YOU MIGHT HAVE SIMILAR PLUGINS INSTALLED.

I am using Cordova, and also had several duplicate symbol errors. I had installed two similar plugins:

  • cordova plugin email composer
  • cordova plugin email

Fixed it by removing "cordova plugin email" using...

cordova plugin remove cordova-plugin-email

After that I ran...

cordova prepare
cordova build ios

Now my xCode build ran like a charm! Woooo Hooo!



来源:https://stackoverflow.com/questions/16427024/duplicate-symbols-for-architecture-armv7

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!