Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

ionic app build fails with error 'linker command failed with exit code 1 (use -v to see invocation)'

When attempting to build using ionic run ios -lc I am seeing the following error in terminal:

** BUILD FAILED **


The following build commands failed:
    Ld build/emulator/xXxXxXx.app/xXxXxXx normal i386
(1 failure)
Error code 65 for command: xcodebuild with args: -xcconfig,/Users/xXxXxXx/Projects/xXxXxXx/platforms/ios/cordova/build-debug.xcconfig,-project,xXxXxXx.xcodeproj,ARCHS=i386,-target,xXxXxXx,-configuration,Debug,-sdk,iphonesimulator,build,VALID_ARCHS=i386,CONFIGURATION_BUILD_DIR=/Users/xXxXxXx/Projects/xXxXxXx/platforms/ios/build/emulator,SHARED_PRECOMPS_DIR=/Users/xXxXxXx/Projects/xXxXxXx/platforms/ios/build/sharedpch
Error: /Users/xXxXxXx/Projects/xXxXxXx/platforms/ios/cordova/run: Command failed with exit code 2
    at ChildProcess.whenDone (/usr/local/lib/node_modules/cordova/node_modules/cordova-lib/src/cordova/superspawn.js:131:23)
    at ChildProcess.emit (events.js:110:17)
    at maybeClose (child_process.js:1015:16)
    at Process.ChildProcess._handle.onexit (child_process.js:1087:5)

When attempting to build the same app in xCode I am seeing the error linker command failed with exit code 1 (use -v to see invocation)

  • I've removed and added the ios platform
  • I've updated ios-deploy
  • I've updated ios-sim
  • I've restarted Xcode
  • I've restarted my machine Xcode is up to date
  • I can build other projects successfully
like image 433
Harry B Avatar asked May 29 '15 11:05

Harry B


3 Answers

The Xcode error linker command failed with exit code 1 (use -v to see invocation) led me to this stack overflow answer

The second answer there suggests a check for multiple / duplicate .m files in the Xcode project Compile Resources:

That can happen if the same .m file is referenced multiple times in your target's "Compile Sources" section in "Build Phases". Remove duplicate entries and you should be fine.

So I had a check in Xcode and there was indeed a duplicate call to a plugin resource.

After checking package.json I found the same plugin was referenced in two ways (with two paths).

Removing one of the two plugins resolved the issue.

like image 180
Harry B Avatar answered Nov 18 '22 04:11

Harry B


I found the solution on github

the solution for me was open the .xcworkspace file insted of .xcodeproj located inside my '/platforms/ios' folder.

https://github.com/phonegap/phonegap-plugin-push/issues/1240

like image 36
Batur Avatar answered Nov 18 '22 05:11

Batur


the solution for my case was simply

cd platforms/ios

then:

pod install
like image 1
Anas Red Avatar answered Nov 18 '22 04:11

Anas Red