iOS build fails - mdublin/mdublin.github.io GitHub Wiki

9/11/2017:

kept seeing a clang compiler error related to duplicate symbols for architecture x86_64 during ionic cordova build ios and it would not build in Xocde 8.3.3, failing with:

clang: error: linker command failed with exit code 1 (use -v to see invocation)

Either in the reveal logger or in Terminal after executing ionic ios build, was seeing:

/Users/mdd/Library/Developer/Xcode/DerivedData/onpoint-cfriowfbnsfvxyhhxluaoqfhpktm/Build/Intermediates/onpoint.build/Debug-iphonesimulator/onpoint.build/Objects-normal/x86_64/onpoint_dependency_info.dat -o /Users/mdd/DEV/onpoint/platforms/ios/build/emulator/onpoint.app/onpoint duplicate symbol _OBJC_CLASS_$_CDVLogger in:

    `/Users/mdd/Library/Developer/Xcode/DerivedData/onpoint-cfriowfbnsfvxyhhxluaoqfhpktm/Build/Intermediates/onpoint.build/Debug-iphonesimulator/onpoint.build/Objects-normal/x86_64/CDVLogger.o`
         `/Users/mdd/DEV/onpoint/platforms/ios/build/emulator/libCordova.a(CDVLogger.o)`
    `duplicate symbol _OBJC_METACLASS_$_CDVLogger in:`
         
    `/Users/mdd/Library/Developer/Xcode/DerivedData/onpoint-cfriowfbnsfvxyhhxluaoqfhpktm/Build/Intermediates/onpoint.build/Debug-iphonesimulator/onpoint.build/Objects-normal/x86_64/CDVLogger.o`
         `/Users/mdd/DEV/onpoint/platforms/ios/build/emulator/libCordova.a(CDVLogger.o)`
    `ld: 2 duplicate symbols for architecture x86_64`
    `clang: error: linker command failed with exit code 1 (use -v to see invocation)`
    
    `** BUILD FAILED **`
    
    
    `The following build commands failed:`
    	`Ld build/emulator/onpoint.app/onpoint normal x86_64`
    `(1 failure)`
    `Error: Error code 65 for command: xcodebuild with args: `
    `-xcconfig,/Users/mdd/DEV/onpoint/platforms/ios/cordova/build-debug.xcconfig,-workspace,onpoint.xcworkspace,-scheme,onpoint,-configuration,Debug,-sdk,iphonesimulator,-destination,platform=iOS `
    `Simulator,name=iPhone `
    `SE,build,CONFIGURATION_BUILD_DIR=/Users/mdd/DEV/onpoint/platforms/ios/build/emulator,SHARED_PRECOMPS_DIR=/Users/mdd/DEV/onpoint/platforms/ios/build/sharedpch`

THE FIX:

In Xcode, selected Onpoint under Targets ---> Build Phases ----> in search field, searched for the name of the symbol file that appeared twice in stacktrace, here it was CDVLogger.o

While only one instance of CDVLogger.o appeared in Build Phases window for search results, I deleted anyway, and it fixed the problem and build was successful.