duplicate symbols for architecture arm64 after Xcode 8.0 update

18,877

Solution 1

Below Patch work for me..:)

Code recommended to use warning flags and set GCC_NO_COMMON_BLOCKS to YES.

Setting it back to NO solved the problem!enter image description here

Solution 2

I finally found it! You can compile after setting enable testability to NO in your Build settings.

Changed settings

From The Xcode 8 Release Notes:

When the Enable Testability build setting is enabled, Xcode 8 will pass -export_dynamic to the linker to preserve all global symbols for testing. This effectively overrides dead code stripping, which can expose link failures from unused functions that reference undefined symbols. If necessary, disabling testability will allow the link to proceed without source changes. (27684883)

Of course, the best thing to do is to either: a) remove the unused code that is causing the linker issues, or b) actually fix the linker issues.

Solution 3

I understand most people are solving this by either the No Common Blocks or the Dead Code setting, but that is actually a workaround for the real issue. In my case, I was using a Pod file that was adding the same libraries I already had linked, so basically I removed the duplicate files in my Build Phases link libraries that were already compiled in my Pod file and the Archive feature worked.

Solution 4

I found that I had constants declared in each 2 different classes, in .m file. This was allowed before this new version of xCode, but now appears like duplicate even those 2 classes don't import eachother and has nothing to do one with another.

const NSInteger space = 10; <-- the name "space" should be unique over the app, even it's in .m file

Solution 5

In your Xcode 9 project you will see left hand side 3 column search icon click that then search for: -Objc in the search bar and then you will see a pod config file open that. Now remove the -ObjC from the inherited it will solve the issue.

Share:
18,877
Andreea Mateevici
Author by

Andreea Mateevici

Updated on June 05, 2022

Comments

  • Andreea Mateevici
    Andreea Mateevici about 2 years

    I get duplicate symbols error after I updated my Xcode. (find the code down) Does anybody get this too? And how could be solved?

    I tried to remove -ObjC linker flag from the "Other Linker Flags" section, check after imported .m instead of .h, switch the "No Common Blocks" compiler setting to NO, I went to Targets -> Build Phases -> Compile sources and no duplicates there, tried all with no results.

    Any other ideas?

    duplicate symbol _space in: /Users/a/Library/Developer/Xcode/DerivedData/SMAP-bshetjpaaresiudzvoubtutnfvuq/Build/Intermediates/SMAP.build/Debug-iphoneos/SMAP.build/Objects-normal/arm64/SearchView.o /Users/a/Library/Developer/Xcode/DerivedData/SMAP-bshetjpaaresiudzvoubtutnfvuq/Build/Intermediates/SMAP.build/Debug-iphoneos/SMAP.build/Objects-normal/arm64/FollowingUserViewController.o duplicate symbol _space in: /Users/a/Library/Developer/Xcode/DerivedData/SMAP-bshetjpaaresiudzvoubtutnfvuq/Build/Intermediates/SMAP.build/Debug-iphoneos/SMAP.build/Objects-normal/arm64/SearchView.o /Users/a/Library/Developer/Xcode/DerivedData/SMAP-bshetjpaaresiudzvoubtutnfvuq/Build/Intermediates/SMAP.build/Debug-iphoneos/SMAP.build/Objects-normal/arm64/ChatViewController.o duplicate symbol _space in: /Users/a/Library/Developer/Xcode/DerivedData/SMAP-bshetjpaaresiudzvoubtutnfvuq/Build/Intermediates/SMAP.build/Debug-iphoneos/SMAP.build/Objects-normal/arm64/SearchView.o /Users/a/Library/Developer/Xcode/DerivedData/SMAP-bshetjpaaresiudzvoubtutnfvuq/Build/Intermediates/SMAP.build/Debug-iphoneos/SMAP.build/Objects-normal/arm64/MessagesNotifications.o duplicate symbol _space in: /Users/a/Library/Developer/Xcode/DerivedData/SMAP-bshetjpaaresiudzvoubtutnfvuq/Build/Intermediates/SMAP.build/Debug-iphoneos/SMAP.build/Objects-normal/arm64/SearchView.o /Users/a/Library/Developer/Xcode/DerivedData/SMAP-bshetjpaaresiudzvoubtutnfvuq/Build/Intermediates/SMAP.build/Debug-iphoneos/SMAP.build/Objects-normal/arm64/AppDelegate.o duplicate symbol _space in: /Users/a/Library/Developer/Xcode/DerivedData/SMAP-bshetjpaaresiudzvoubtutnfvuq/Build/Intermediates/SMAP.build/Debug-iphoneos/SMAP.build/Objects-normal/arm64/SearchView.o /Users/a/Library/Developer/Xcode/DerivedData/SMAP-bshetjpaaresiudzvoubtutnfvuq/Build/Intermediates/SMAP.build/Debug-iphoneos/SMAP.build/Objects-normal/arm64/PicturesCell.o duplicate symbol _space in: /Users/a/Library/Developer/Xcode/DerivedData/SMAP-bshetjpaaresiudzvoubtutnfvuq/Build/Intermediates/SMAP.build/Debug-iphoneos/SMAP.build/Objects-normal/arm64/SearchView.o /Users/a/Library/Developer/Xcode/DerivedData/SMAP-bshetjpaaresiudzvoubtutnfvuq/Build/Intermediates/SMAP.build/Debug-iphoneos/SMAP.build/Objects-normal/arm64/SMAPMainViewController.o duplicate symbol _space in: /Users/a/Library/Developer/Xcode/DerivedData/SMAP-bshetjpaaresiudzvoubtutnfvuq/Build/Intermediates/SMAP.build/Debug-iphoneos/SMAP.build/Objects-normal/arm64/SearchView.o /Users/a/Library/Developer/Xcode/DerivedData/SMAP-bshetjpaaresiudzvoubtutnfvuq/Build/Intermediates/SMAP.build/Debug-iphoneos/SMAP.build/Objects-normal/arm64/CheckUserTypeViewController.o duplicate symbol _space in: /Users/a/Library/Developer/Xcode/DerivedData/SMAP-bshetjpaaresiudzvoubtutnfvuq/Build/Intermediates/SMAP.build/Debug-iphoneos/SMAP.build/Objects-normal/arm64/SearchView.o /Users/a/Library/Developer/Xcode/DerivedData/SMAP-bshetjpaaresiudzvoubtutnfvuq/Build/Intermediates/SMAP.build/Debug-iphoneos/SMAP.build/Objects-normal/arm64/SmaptersNearYou.o duplicate symbol _space in: /Users/a/Library/Developer/Xcode/DerivedData/SMAP-bshetjpaaresiudzvoubtutnfvuq/Build/Intermediates/SMAP.build/Debug-iphoneos/SMAP.build/Objects-normal/arm64/SearchView.o /Users/a/Library/Developer/Xcode/DerivedData/SMAP-bshetjpaaresiudzvoubtutnfvuq/Build/Intermediates/SMAP.build/Debug-iphoneos/SMAP.build/Objects-normal/arm64/PostSlider.o duplicate symbol _space in: /Users/a/Library/Developer/Xcode/DerivedData/SMAP-bshetjpaaresiudzvoubtutnfvuq/Build/Intermediates/SMAP.build/Debug-iphoneos/SMAP.build/Objects-normal/arm64/SearchView.o /Users/a/Library/Developer/Xcode/DerivedData/SMAP-bshetjpaaresiudzvoubtutnfvuq/Build/Intermediates/SMAP.build/Debug-iphoneos/SMAP.build/Objects-normal/arm64/UserSettings.o duplicate symbol _space in: /Users/a/Library/Developer/Xcode/DerivedData/SMAP-bshetjpaaresiudzvoubtutnfvuq/Build/Intermediates/SMAP.build/Debug-iphoneos/SMAP.build/Objects-normal/arm64/SearchView.o /Users/a/Library/Developer/Xcode/DerivedData/SMAP-bshetjpaaresiudzvoubtutnfvuq/Build/Intermediates/SMAP.build/Debug-iphoneos/SMAP.build/Objects-normal/arm64/EventSliderCell.o duplicate symbol _space in: /Users/a/Library/Developer/Xcode/DerivedData/SMAP-bshetjpaaresiudzvoubtutnfvuq/Build/Intermediates/SMAP.build/Debug-iphoneos/SMAP.build/Objects-normal/arm64/SearchView.o /Users/a/Library/Developer/Xcode/DerivedData/SMAP-bshetjpaaresiudzvoubtutnfvuq/Build/Intermediates/SMAP.build/Debug-iphoneos/SMAP.build/Objects-normal/arm64/UserProfile.o duplicate symbol _space in: /Users/a/Library/Developer/Xcode/DerivedData/SMAP-bshetjpaaresiudzvoubtutnfvuq/Build/Intermediates/SMAP.build/Debug-iphoneos/SMAP.build/Objects-normal/arm64/SearchView.o /Users/a/Library/Developer/Xcode/DerivedData/SMAP-bshetjpaaresiudzvoubtutnfvuq/Build/Intermediates/SMAP.build/Debug-iphoneos/SMAP.build/Objects-normal/arm64/EventCell.o duplicate symbol _space in: /Users/a/Library/Developer/Xcode/DerivedData/SMAP-bshetjpaaresiudzvoubtutnfvuq/Build/Intermediates/SMAP.build/Debug-iphoneos/SMAP.build/Objects-normal/arm64/SearchView.o /Users/a/Library/Developer/Xcode/DerivedData/SMAP-bshetjpaaresiudzvoubtutnfvuq/Build/Intermediates/SMAP.build/Debug-iphoneos/SMAP.build/Objects-normal/arm64/NewsFeed.o duplicate symbol _textViewMaxHeight in: /Users/a/Library/Developer/Xcode/DerivedData/SMAP-bshetjpaaresiudzvoubtutnfvuq/Build/Intermediates/SMAP.build/Debug-iphoneos/SMAP.build/Objects-normal/arm64/EventSliderCell.o /Users/a/Library/Developer/Xcode/DerivedData/SMAP-bshetjpaaresiudzvoubtutnfvuq/Build/Intermediates/SMAP.build/Debug-iphoneos/SMAP.build/Objects-normal/arm64/ExpressSliderCell.o duplicate symbol _textViewStandardHeight in: /Users/a/Library/Developer/Xcode/DerivedData/SMAP-bshetjpaaresiudzvoubtutnfvuq/Build/Intermediates/SMAP.build/Debug-iphoneos/SMAP.build/Objects-normal/arm64/EventSliderCell.o /Users/a/Library/Developer/Xcode/DerivedData/SMAP-bshetjpaaresiudzvoubtutnfvuq/Build/Intermediates/SMAP.build/Debug-iphoneos/SMAP.build/Objects-normal/arm64/ExpressSliderCell.o duplicate symbol _textViewStep in: /Users/a/Library/Developer/Xcode/DerivedData/SMAP-bshetjpaaresiudzvoubtutnfvuq/Build/Intermediates/SMAP.build/Debug-iphoneos/SMAP.build/Objects-normal/arm64/EventSliderCell.o /Users/a/Library/Developer/Xcode/DerivedData/SMAP-bshetjpaaresiudzvoubtutnfvuq/Build/Intermediates/SMAP.build/Debug-iphoneos/SMAP.build/Objects-normal/arm64/ExpressSliderCell.o duplicate symbol _space in: /Users/a/Library/Developer/Xcode/DerivedData/SMAP-bshetjpaaresiudzvoubtutnfvuq/Build/Intermediates/SMAP.build/Debug-iphoneos/SMAP.build/Objects-normal/arm64/SearchView.o /Users/a/Library/Developer/Xcode/DerivedData/SMAP-bshetjpaaresiudzvoubtutnfvuq/Build/Intermediates/SMAP.build/Debug-iphoneos/SMAP.build/Objects-normal/arm64/FollowerUserViewController.o duplicate symbol _space in: /Users/a/Library/Developer/Xcode/DerivedData/SMAP-bshetjpaaresiudzvoubtutnfvuq/Build/Intermediates/SMAP.build/Debug-iphoneos/SMAP.build/Objects-normal/arm64/SearchView.o /Users/a/Library/Developer/Xcode/DerivedData/SMAP-bshetjpaaresiudzvoubtutnfvuq/Build/Intermediates/SMAP.build/Debug-iphoneos/SMAP.build/Objects-normal/arm64/FilterAlertView.o duplicate symbol _space in: /Users/a/Library/Developer/Xcode/DerivedData/SMAP-bshetjpaaresiudzvoubtutnfvuq/Build/Intermediates/SMAP.build/Debug-iphoneos/SMAP.build/Objects-normal/arm64/SearchView.o /Users/a/Library/Developer/Xcode/DerivedData/SMAP-bshetjpaaresiudzvoubtutnfvuq/Build/Intermediates/SMAP.build/Debug-iphoneos/SMAP.build/Objects-normal/arm64/UserNotificationsViewController.o ld: 20 duplicate symbols for architecture arm64 clang: error: linker command failed with exit code 1 (use -v to see invocation)

  • Renish Dadhaniya
    Renish Dadhaniya almost 8 years
    @pi1000, Happy to hear you..:)
  • JSA986
    JSA986 over 7 years
    Brilliant! Works!
  • Ivan
    Ivan over 7 years
    Thank you, this fixed my issue, not the other suggested solution to set GCC_NO_COMMON_BLOCKS to NO.
  • JorisH
    JorisH over 7 years
    @Ivan Nice, I'm glad I could help!
  • Daniel Wood
    Daniel Wood over 7 years
    Perfect. You're a life saver.
  • Denis Kutlubaev
    Denis Kutlubaev over 7 years
    I had to change both Enable Testability and No Common Blocks settings.
  • Denis Kutlubaev
    Denis Kutlubaev over 7 years
    I had to change both Enable Testability and No Common Blocks settings.
  • Greg
    Greg almost 7 years
    This should be the selected answer. I've been having this issue for a week now and I've seen lots of tricks and that's to solve this, but your answer actually made me understand the problem so I could fix it in no time. Much appreciated, thanks!
  • walker
    walker almost 7 years
    or just correct the code, for me, add extern in const declaration