1

I'm using Xcode Version 6.0.1 (6A317)and stuck with Apple Mach-O error for a long time. I get this error once I introduce SocketRocket project.

duplicate symbol _OBJC_IVAR_$_AppDelegate._window in:

    /Users/anuradhavasudeva/Desktop/Buzz/Complete/CWPAYou/Build/Intermediates/CWPAYou.build/Debug-iphonesimulator/CWPAYou.build/Objects-normal/i386/AppDelegate-113CA4C4B5D4CC68.o
    /Users/anuradhavasudeva/Desktop/Buzz/Complete/CWPAYou/Build/Intermediates/CWPAYou.build/Debug-iphonesimulator/CWPAYou.build/Objects-normal/i386/AppDelegate-D68FF7E1CDB59174.o
duplicate symbol _OBJC_METACLASS_$_AppDelegate in:
    /Users/anuradhavasudeva/Desktop/Buzz/Complete/CWPAYou/Build/Intermediates/CWPAYou.build/Debug-iphonesimulator/CWPAYou.build/Objects-normal/i386/AppDelegate-113CA4C4B5D4CC68.o
    /Users/anuradhavasudeva/Desktop/Buzz/Complete/CWPAYou/Build/Intermediates/CWPAYou.build/Debug-iphonesimulator/CWPAYou.build/Objects-normal/i386/AppDelegate-D68FF7E1CDB59174.o
duplicate symbol _OBJC_CLASS_$_AppDelegate in:
    /Users/anuradhavasudeva/Desktop/Buzz/Complete/CWPAYou/Build/Intermediates/CWPAYou.build/Debug-iphonesimulator/CWPAYou.build/Objects-normal/i386/AppDelegate-113CA4C4B5D4CC68.o
    /Users/anuradhavasudeva/Desktop/Buzz/Complete/CWPAYou/Build/Intermediates/CWPAYou.build/Debug-iphonesimulator/CWPAYou.build/Objects-normal/i386/AppDelegate-D68FF7E1CDB59174.o
duplicate symbol _OBJC_CLASS_$_ViewController in:
    /Users/anuradhavasudeva/Desktop/Buzz/Complete/CWPAYou/Build/Intermediates/CWPAYou.build/Debug-iphonesimulator/CWPAYou.build/Objects-normal/i386/ViewController-7B952F801D984E6D.o
    /Users/anuradhavasudeva/Desktop/Buzz/Complete/CWPAYou/Build/Intermediates/CWPAYou.build/Debug-iphonesimulator/CWPAYou.build/Objects-normal/i386/ViewController-99529767CD55CC78.o
duplicate symbol _OBJC_METACLASS_$_ViewController in:
    /Users/anuradhavasudeva/Desktop/Buzz/Complete/CWPAYou/Build/Intermediates/CWPAYou.build/Debug-iphonesimulator/CWPAYou.build/Objects-normal/i386/ViewController-7B952F801D984E6D.o
    /Users/anuradhavasudeva/Desktop/Buzz/Complete/CWPAYou/Build/Intermediates/CWPAYou.build/Debug-iphonesimulator/CWPAYou.build/Objects-normal/i386/ViewController-99529767CD55CC78.o
duplicate symbol _main in:
    /Users/anuradhavasudeva/Desktop/Buzz/Complete/CWPAYou/Build/Intermediates/CWPAYou.build/Debug-iphonesimulator/CWPAYou.build/Objects-normal/i386/main-B74D1ABF07758C74.o
    /Users/anuradhavasudeva/Desktop/Buzz/Complete/CWPAYou/Build/Intermediates/CWPAYou.build/Debug-iphonesimulator/CWPAYou.build/Objects-normal/i386/main-F48A7B3907D55170.o
ld: 6 duplicate symbols for architecture i386
clang: error: linker command failed with exit code 1 (use -v to see invocation)

I have made sure to follow the steps given in https://github.com/square/SocketRocket

the only exception I see is SocketRocket.framework was showing red when I tried adding it under + Link Binary with libraries.

I have added the following libraries:

Security.Framework
CFNetwork.Framework
UIKit.Framework
Foundation.Framework
libicucore.dylib
libsocketrocket.a
libresolv.dylib

I've set other linker flags to -ObjC Build Active Architecture only - No, because setting it to Yes throws an error : Check dependencies. No architectures to compile for (ONLY_ACTIVE_ARCH=YES, active arch=x86_64, VALID_ARCHS=i386). Valid Architectures - armv64 armv7 armv7s

This issue is really killing my time. I tried to follow other posts but nothing could help me solve the issue!

arv
  • 41
  • 1
  • 5

1 Answers1

1

1.- Are you importing a .m file inside another .m file instead of the Header? It happens by mistake some times and causes that issue.

2.- Check in your Compile Sources under Build Phases that you are not including same file 2 times although from the looks of it this doesn't seem the problem.

3.- If all else fails. Clean DerivedData folder for the project in Organizer. Clean and re-build.

gzafra
  • 496
  • 3
  • 10
  • Hi, thanks for the response. I resolved it by removing the references to SRWebSocketTests and SocketTesterARC. Changed the header path to #import "../../../SocketRocket/SocketRocket/SRWebSocket.h" in // SocketIOTransportWebsocket.h – arv Oct 02 '14 at 11:39
  • If you add the path in your Build Settings to Header Search Paths you don't need to specify the full path in the import, btw. Anyway, remember to write your solution as a answer so that people with same problem can find the solution easily :) – gzafra Oct 02 '14 at 13:22
  • Yes..I agree. That would have been the correct thing to do..will take care of it. Thanks. – arv Oct 02 '14 at 14:59