ionic-framework: ios **BUILD FAILED ** duplicate symbols for architecture x86_64

Ionic version: (check one with “x”) [ ] 1.x (For Ionic 1.x issues, please use https://github.com/ionic-team/ionic-v1) [ ] 2.x [x] 3.x

I’m submitting a … (check one with “x”) [x] bug report [ ] feature request [ ] support request => Please do not submit support requests here, use one of these channels: https://forum.ionicframework.com/ or http://ionicworldwide.herokuapp.com/

Current behavior: After an undefined period of time, my app can’t build for ios devices anymore.

Expected behavior: It should be able to build for ios devices.

Steps to reproduce: I have no Idea how this happens

Related code: This is what I get when trying to build for ios

> cordova build ios
✖ Running command - failed!
[ERROR] An error occurred while running cordova build ios (exit code 1):

        
        (truncated) ... licate symbol _OBJC_IVAR_$_UNIHTTPStringResponse._body in:
             
        /Users/Alexandre/Library/Developer/Xcode/DerivedData/ShOroom-egyzqumtqhesmlcsgwngozvucwss/Build/Intermediates/ShOroom.build/Debug-iphonesimulator/ShOroom.build/Objects-normal/x86_64/UNIHTTPStringResponse-6AE7BF574F7FD89D.o
             
        /Users/Alexandre/Library/Developer/Xcode/DerivedData/ShOroom-egyzqumtqhesmlcsgwngozvucwss/Build/Intermediates/ShOroom.build/Debug-iphonesimulator/ShOroom.build/Objects-normal/x86_64/UNIHTTPStringResponse-ACD8B349DA1366AA.o
        duplicate symbol _OBJC_CLASS_$_UNIHTTPStringResponse in:
             
        /Users/Alexandre/Library/Developer/Xcode/DerivedData/ShOroom-egyzqumtqhesmlcsgwngozvucwss/Build/Intermediates/ShOroom.build/Debug-iphonesimulator/ShOroom.build/Objects-normal/x86_64/UNIHTTPStringResponse-6AE7BF574F7FD89D.o
             
        /Users/Alexandre/Library/Developer/Xcode/DerivedData/ShOroom-egyzqumtqhesmlcsgwngozvucwss/Build/Intermediates/ShOroom.build/Debug-iphonesimulator/ShOroom.build/Objects-normal/x86_64/UNIHTTPStringResponse-ACD8B349DA1366AA.o
        duplicate symbol _OBJC_METACLASS_$_UNIHTTPStringResponse in:
             
        /Users/Alexandre/Library/Developer/Xcode/DerivedData/ShOroom-egyzqumtqhesmlcsgwngozvucwss/Build/Intermediates/ShOroom.build/Debug-iphonesimulator/ShOroom.build/Objects-normal/x86_64/UNIHTTPStringResponse-6AE7BF574F7FD89D.o
             
        /Users/Alexandre/Library/Developer/Xcode/DerivedData/ShOroom-egyzqumtqhesmlcsgwngozvucwss/Build/Intermediates/ShOroom.build/Debug-iphonesimulator/ShOroom.build/Objects-normal/x86_64/UNIHTTPStringResponse-ACD8B349DA1366AA.o
        duplicate symbol _OBJC_IVAR_$_UNIJsonNode._array in:
             
        /Users/Alexandre/Library/Developer/Xcode/DerivedData/ShOroom-egyzqumtqhesmlcsgwngozvucwss/Build/Intermediates/ShOroom.build/Debug-iphonesimulator/ShOroom.build/Objects-normal/x86_64/UNIJsonNode-7600CC35AA339D64.o
             
        /Users/Alexandre/Library/Developer/Xcode/DerivedData/ShOroom-egyzqumtqhesmlcsgwngozvucwss/Build/Intermediates/ShOroom.build/Debug-iphonesimulator/ShOroom.build/Objects-normal/x86_64/UNIJsonNode-B9FEAECE639D8883.o
        duplicate symbol _OBJC_IVAR_$_UNIJsonNode._object in:
             
        /Users/Alexandre/Library/Developer/Xcode/DerivedData/ShOroom-egyzqumtqhesmlcsgwngozvucwss/Build/Intermediates/ShOroom.build/Debug-iphonesimulator/ShOroom.build/Objects-normal/x86_64/UNIJsonNode-7600CC35AA339D64.o
             
        /Users/Alexandre/Library/Developer/Xcode/DerivedData/ShOroom-egyzqumtqhesmlcsgwngozvucwss/Build/Intermediates/ShOroom.build/Debug-iphonesimulator/ShOroom.build/Objects-normal/x86_64/UNIJsonNode-B9FEAECE639D8883.o
        duplicate symbol _OBJC_CLASS_$_UNIJsonNode in:
             
        /Users/Alexandre/Library/Developer/Xcode/DerivedData/ShOroom-egyzqumtqhesmlcsgwngozvucwss/Build/Intermediates/ShOroom.build/Debug-iphonesimulator/ShOroom.build/Objects-normal/x86_64/UNIJsonNode-7600CC35AA339D64.o
             
        /Users/Alexandre/Library/Developer/Xcode/DerivedData/ShOroom-egyzqumtqhesmlcsgwngozvucwss/Build/Intermediates/ShOroom.build/Debug-iphonesimulator/ShOroom.build/Objects-normal/x86_64/UNIJsonNode-B9FEAECE639D8883.o
        duplicate symbol _OBJC_METACLASS_$_UNIJsonNode in:
             
        /Users/Alexandre/Library/Developer/Xcode/DerivedData/ShOroom-egyzqumtqhesmlcsgwngozvucwss/Build/Intermediates/ShOroom.build/Debug-iphonesimulator/ShOroom.build/Objects-normal/x86_64/UNIJsonNode-7600CC35AA339D64.o
             
        /Users/Alexandre/Library/Developer/Xcode/DerivedData/ShOroom-egyzqumtqhesmlcsgwngozvucwss/Build/Intermediates/ShOroom.build/Debug-iphonesimulator/ShOroom.build/Objects-normal/x86_64/UNIJsonNode-B9FEAECE639D8883.o
        duplicate symbol _OBJC_CLASS_$_CDVLogger in:
             
        /Users/Alexandre/Library/Developer/Xcode/DerivedData/ShOroom-egyzqumtqhesmlcsgwngozvucwss/Build/Intermediates/ShOroom.build/Debug-iphonesimulator/ShOroom.build/Objects-normal/x86_64/CDVLogger.o
             
        /Applications/XAMPP/xamppfiles/htdocs/LVDLV/clone_new/lvdlv/platforms/ios/build/emulator/libCordova.a(CDVLogger.o)
        duplicate symbol _OBJC_METACLASS_$_CDVLogger in:
             
        /Users/Alexandre/Library/Developer/Xcode/DerivedData/ShOroom-egyzqumtqhesmlcsgwngozvucwss/Build/Intermediates/ShOroom.build/Debug-iphonesimulator/ShOroom.build/Objects-normal/x86_64/CDVLogger.o
             
        /Applications/XAMPP/xamppfiles/htdocs/LVDLV/clone_new/lvdlv/platforms/ios/build/emulator/libCordova.a(CDVLogger.o)
        ld: 260 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/ShOroom.app/ShOroom normal x86_64
        (1 failure)
        Error: Error code 65 for command: xcodebuild with args: 
        -xcconfig,/Applications/XAMPP/xamppfiles/htdocs/LVDLV/clone_new/lvdlv/platforms/ios/cordova/build-debug.xcconfig,-workspace,ShOroom.xcworkspace,-scheme,ShOroom,-configuration,Debug,-sdk,iphonesimulator,-destination,platform=iOS 
        Simulator,name=iPhone 
        SE,build,CONFIGURATION_BUILD_DIR=/Applications/XAMPP/xamppfiles/htdocs/LVDLV/clone_new/lvdlv/platforms/ios/build/emulator,SHARED_PRECOMPS_DIR=/Applications/XAMPP/xamppfiles/htdocs/LVDLV/clone_new/lvdlv/platforms/ios/build/sharedpch

Other information: It’s the second time this happens to me, after the first time I had to create an ionic project from scratch and slowly integrate what was in the original project and building for ios after each iteration in order to detect the problem. A few hours later and the code copied in its entirety, I was somehow able to build for ios. Tried to build for ios this morning and I’m still getting the same issue [see related code section]. Also tried to delete my /plugins & /node_modules directories but it did not help. Could not find anything on the web to help me neither…

Ionic info: (run ionic info from a terminal/cmd prompt and paste output below):

cli packages:
    @ionic/cli-utils  : 1.10.2
    ionic (Ionic CLI) : 3.10.3

global packages:
    Cordova CLI : 7.0.1

local packages:
    @ionic/app-scripts : 2.1.4
    Cordova Platforms  : android 6.2.3 ios 4.4.0
    Ionic Framework    : ionic-angular 3.6.1

System:
    ios-deploy : 1.9.1
    ios-sim    : 6.0.0
    Node       : v6.11.0
    npm        : 3.10.10
    OS         : OS X El Capitan
    Xcode      : Xcode 8.2.1 Build version 8C1002

About this issue

  • Original URL
  • State: closed
  • Created 7 years ago
  • Comments: 19 (4 by maintainers)

Most upvoted comments

Try remove plugin console and try again, I had the same issues. But I have Cordova ios 4.5

The problem is CDVLogger that is already in cordova cli 7

Cc @kensodemann

Solution from @nuno works for me, just run: cordova plugin rm cordova-plugin-console cordova platform rm ios cordova platform add ios cordova build ios I’m using cordova-ios version 4.5.4.

Duplicated it and fixed it, though I am not entirely sure this is your issue, but worth a shot.

First, I remove my node_modules and platform/ios directories and did an npm i and ionic build, which ended up installing cordova-ios version 4.5.0, which caused the exact same issue you have.

My guess (and it is only a guess) is that you somehow have cordova-ios 4.5.0 even though ionic info is reporting 4.4.0 (weird, but I have no better explanation at this point).

So I did this:

  1. In package.json, change "cordova-ios": "^4.4.0" to "cordova-ios": "4.4.0" (no ‘^’)
  2. In config.xml, change <engine name="ios" spec="^4.4.0" /> to <engine name="ios" spec="4.4.0" />
  3. rm -rf node_modules/ platforms/ios/
  4. npm i
  5. ionic cordova build ios
  6. ** BUILD SUCCEEDED **

So at least for me, the key to the fix was pinning the cordova-ios version to 4.4.0 rather than using ^4.4.0, which will take upgrades to the minor version.

Of course, this means when it is time to upgrade cordova-ios, you will have to do it manually, but you probably want that control anyhow.

Anyhow, give that a try and let me know if that works for you.

As per https://github.com/apache/cordova-plugin-console

This plugin is no longer being worked on as the functionality provided by this plugin is now included in cordova-ios 4.5.0 or greater, and support is already built in to cordova-windows > 5.0.0. You should remove this plugin from your applications.

Solution from @nuno works for me as well.

does anybody still have this problem ? from a gresh new app I’m not able to use this plugin…

@nuno is correct, the console plugin is the root cause, that has been included in cordova 7, so simply remove the plugin fixes the problem.

Hello! Thank you for opening an issue with us!

I cannot duplicate your error, which makes total sense because as you say, it generally works and then mysteriously stops. So… let’s start with some versions of things:

I am using Xcode 9, what version are you using? I am using cordova-ios version 4.4.0, which looks the same as what you are using…

Hmmmm… I am going to try a couple of things