Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ios **BUILD FAILED ** duplicate symbols for architecture x86_64 #12942

Closed
speedtreammanga opened this issue Sep 20, 2017 · 19 comments
Closed

ios **BUILD FAILED ** duplicate symbols for architecture x86_64 #12942

speedtreammanga opened this issue Sep 20, 2017 · 19 comments
Labels
needs: reply the issue needs a response from the user

Comments

@speedtreammanga
Copy link

speedtreammanga commented Sep 20, 2017

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
@speedtreammanga speedtreammanga changed the title ios **BUILD FAILED ** x86_64 ios **BUILD FAILED ** duplicate symbols for architecture x86_64 Sep 20, 2017
@kensodemann
Copy link
Member

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

@speedtreammanga
Copy link
Author

Hey @kensodemann , I am currently on Xcode Version 8.2.1

Thank you!

@nuno
Copy link

nuno commented Sep 20, 2017

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

@kensodemann
Copy link
Member

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.

@nuno
Copy link

nuno commented Sep 20, 2017

@kensodemann Exactly the issue!

@kensodemann kensodemann added the needs: reply the issue needs a response from the user label Sep 20, 2017
@speedtreammanga
Copy link
Author

speedtreammanga commented Sep 20, 2017

@kensodemann Hooray, I can now build, Thank you!!

Here's the thing, before doing ioinc build I went into my package.json file and here's what I found "cordova-ios": "^4.4.0", and not ^4.5.0.

Anyway, so I followed your instructions, ran rm -rf node_modules/ platform/ios then npm i and npm build.

That last command then changed my "cordova-ios": "^4.4.0", to "cordova-ios": "^4.5.0",.
In order to follow your instructions as close as possible, I changed it to your suggestion "cordova-ios": "4.4.0", (same thing for config.xml).

Uninstalled my node_modules & platform/ios once again and ran npm i then ionic cordova build ios and it worked.

Surprisingly enough, after doing so, I still find myself with "cordova-ios": "^4.4.0", in my package.json and <engine name="ios" spec="^4.4.0" /> in my config.xml

@kensodemann
Copy link
Member

Surprisingly enough, after doing so, I still found myself with "cordova-ios": "^4.4.0", in my package.json and in my config.xml

My guess is that Cordova does that. Personally not a fan of tools mucking with my setup... :(

I am going to close this then. Glad it is working for you now.

@mchenx
Copy link

mchenx commented Oct 20, 2017

@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.

@surajitdeveloper
Copy link

surajitdeveloper commented Dec 4, 2017

@kensodemann
Not worked for me. I got

Ld build/emulator/MyApp.app/MyApp normal x86_64
cd /Applications/IonicApps/BabyName/platforms/ios
export IPHONEOS_DEPLOYMENT_TARGET=9.0
export PATH="/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin:/Applications/Xcode.app/Contents/Developer/usr/bin:/Library/Frameworks/Python.framework/Versions/3.5/bin:/Users/saikrishna/Softwares/android-sdks/platform-tools:/Users/saikrishna/Softwares/android-sdks/tools:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin"
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang -arch x86_64 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator10.3.sdk -L/Applications/IonicApps/BabyName/platforms/ios/build/emulator -F/Applications/IonicApps/BabyName/platforms/ios/build/emulator -FMyApp/Plugins/cordova-plugin-facebook4 -FMyApp/Plugins/cordova-plugin-googleplus -filelist /Users/eupherntechnology/Library/Developer/Xcode/DerivedData/MyApp-gddohggkprehdkdqznpxmbtrwfzt/Build/Intermediates/MyApp.build/Debug-iphonesimulator/MyApp.build/Objects-normal/x86_64/MyApp.LinkFileList -Xlinker -rpath -Xlinker @executable_path/Frameworks -mios-simulator-version-min=9.0 -dead_strip -Xlinker -object_path_lto -Xlinker /Users/eupherntechnology/Library/Developer/Xcode/DerivedData/MyApp-gddohggkprehdkdqznpxmbtrwfzt/Build/Intermediates/MyApp.build/Debug-iphonesimulator/MyApp.build/Objects-normal/x86_64/MyApp_lto.o -Xlinker -no_deduplicate -Xlinker -objc_abi_version -Xlinker 2 -fobjc-arc -fobjc-link-runtime -ObjC -Xlinker -sectcreate -Xlinker __TEXT -Xlinker __entitlements -Xlinker /Users/eupherntechnology/Library/Developer/Xcode/DerivedData/MyApp-gddohggkprehdkdqznpxmbtrwfzt/Build/Intermediates/MyApp.build/Debug-iphonesimulator/MyApp.build/MyApp.app.xcent /Applications/IonicApps/BabyName/platforms/ios/build/emulator/libCordova.a -weak_framework AudioToolbox -framework StoreKit -framework Bolts -framework FBSDKCoreKit -framework FBSDKLoginKit -framework FBSDKShareKit -framework CoreLocation -framework GoogleAppUtilities -framework GoogleAuthUtilities -framework GoogleNetworkingUtilities -framework GoogleSignIn -framework GoogleSymbolUtilities -framework GoogleUtilities -weak_framework AddressBook -weak_framework CoreText -weak_framework SafariServices -weak_framework Security -weak_framework SystemConfiguration -weak-lz -weak-lz -weak_framework WebKit -weak_framework Social -weak_framework MessageUI -Xlinker -dependency_info -Xlinker /Users/eupherntechnology/Library/Developer/Xcode/DerivedData/MyApp-gddohggkprehdkdqznpxmbtrwfzt/Build/Intermediates/MyApp.build/Debug-iphonesimulator/MyApp.build/Objects-normal/x86_64/MyApp_dependency_info.dat -o /Applications/IonicApps/BabyName/platforms/ios/build/emulator/MyApp.app/MyApp
duplicate symbol OBJC_CLASS$_CDVLogger in:
/Users/eupherntechnology/Library/Developer/Xcode/DerivedData/MyApp-gddohggkprehdkdqznpxmbtrwfzt/Build/Intermediates/MyApp.build/Debug-iphonesimulator/MyApp.build/Objects-normal/x86_64/CDVLogger.o
/Applications/IonicApps/BabyName/platforms/ios/build/emulator/libCordova.a(CDVLogger.o)
duplicate symbol OBJC_METACLASS$_CDVLogger in:
/Users/eupherntechnology/Library/Developer/Xcode/DerivedData/MyApp-gddohggkprehdkdqznpxmbtrwfzt/Build/Intermediates/MyApp.build/Debug-iphonesimulator/MyApp.build/Objects-normal/x86_64/CDVLogger.o
/Applications/IonicApps/BabyName/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/MyApp.app/MyApp normal x86_64
(1 failure)
Error: Error code 65 for command: xcodebuild with args: -xcconfig,/Applications/IonicApps/BabyName/platforms/ios/cordova/build-debug.xcconfig,-workspace,MyApp.xcworkspace,-scheme,MyApp,-configuration,Debug,-sdk,iphonesimulator,-destination,platform=iOS Simulator,name=iPhone SE,build,CONFIGURATION_BUILD_DIR=/Applications/IonicApps/BabyName/platforms/ios/build/emulator,SHARED_PRECOMPS_DIR=/Applications/IonicApps/BabyName/platforms/ios/build/sharedpch

Environment

cli packages: (/Applications/IonicApps/BabyName/node_modules)

@ionic/cli-utils  : 1.19.0
ionic (Ionic CLI) : 3.19.0

global packages:

cordova (Cordova CLI) : 7.1.0 
Gulp CLI              : CLI version 3.9.1 Local version 3.9.1

local packages:

Cordova Platforms : ios 4.5.4
Ionic Framework   : ionic1 1.3.3

System:

ios-deploy : 1.9.1 
ios-sim    : 6.1.2 
Node       : v6.10.3
npm        : 2.15.12 
OS         : macOS Sierra
Xcode      : Xcode 8.3.3 Build version 8E3004b 

Environment Variables:

ANDROID_HOME : /Users/saikrishna/Softwares/android-sdks

Misc:

backend : pro

@kensodemann
Copy link
Member

@surajitdeveloper -

Are you sure you are not installing the console plugin?
Did you remove everything and re-install from scratch?

If your repo is online, provide a link and I can take a quick look. In general, though, this is not an Ionic Framework issue but an issue with the use of incompatible plugins.

@gjoris
Copy link

gjoris commented Dec 13, 2017

@kensodemann is right, it is all due to plugins being either old or incompatible.

For me, it turned out to be the cordova-plugin-inappbrowser. In my config.xml, there was still a reference to a git repo that didn't exist anymore. I first didn't take notice in the build process, but all of a sudden, I noticed that the build was complaining about not finding the repo for the plugin. The solution was quite simple: put the line in the config.xml in comment, and reinstall the plugin. And iOS was building again :)

So, if it may help, check you build log after you run ionic cordova build ios - it may contain errors about plugins. And check all of your plugins: simply reinstalling them might not help, you may have to update versions too.

@didinj
Copy link

didinj commented Jan 4, 2018

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.

@GoriX
Copy link

GoriX commented Jan 4, 2018

Hi all,

I had same problem and I have tried to execute solution posted by @didinj and not works because after this I get an error for scripts when execute rm platform and then build ios, I add again app-scripts but the problem was this : npm install @Ionic / app-scripts@latest --save-dev because install 3.1.7 version of scripts and this generate the same main error then I execute and again app-scripts but with a less version for app-scripts and now works fine with 3.0.0 : npm install @Ionic / app-scripts@3.0.0 --save-dev

I'm using too cordova-ios version 4.5.4 and the all latest versions of all in macOS High Sierra 10.13.2 with Xcode 9.2

cli packages: (/usr/local/lib/node_modules)

@ionic/cli-utils  : 1.19.0
ionic (Ionic CLI) : 3.19.0

global packages:

cordova (Cordova CLI) : 8.0.0

local packages:

@ionic/app-scripts : 3.0.0
Cordova Platforms  : android 6.2.3 ios 4.5.4
Ionic Framework    : ionic-angular 3.9.2

System:

ios-deploy : 1.9.2
Node       : v8.0.0
npm        : 5.0.0
OS         : macOS High Sierra
Xcode      : Xcode 9.2 Build version 9C40b

I hope that with this I can help other users.

Thanks to all.

@sophianachiba
Copy link

works for me! thanks @kensodemann ! 😃

@amreladawy
Copy link

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.

@sebastianovide
Copy link

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

@tarung
Copy link

tarung commented Apr 6, 2018

Solution from @nuno works for me as well.

@sreekanth-karini
Copy link

ionic cordova plugin remove cordova-plugin-console

  • Hit the above command to get ios build success.

@ionitron-bot
Copy link

ionitron-bot bot commented Sep 1, 2018

Thanks for the issue! This issue is being locked to prevent comments that are not relevant to the original issue. If this is still an issue with the latest version of Ionic, please create a new issue and ensure the template is fully filled out.

@ionitron-bot ionitron-bot bot locked and limited conversation to collaborators Sep 1, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
needs: reply the issue needs a response from the user
Projects
None yet
Development

No branches or pull requests