xcode 离子应用程序构建失败并显示错误“链接器命令失败,退出代码为 1(使用 -v 查看调用)”
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/30528762/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
ionic app build fails with error 'linker command failed with exit code 1 (use -v to see invocation)'
提问by Harry B
When attempting to build using ionic run ios -lc
I am seeing the following error in terminal:
尝试使用构建时,ionic run ios -lc
我在终端中看到以下错误:
** 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)
尝试在 xCode 中构建相同的应用程序时,我看到了错误 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
- 我已经删除并添加了 ios 平台
- 我已经更新了 ios-deploy
- 我已经更新了 ios-sim
- 我已经重新启动了 Xcode
- 我已经重新启动了我的机器 Xcode 是最新的
- 我可以成功构建其他项目
回答by Harry B
The Xcode error linker command failed with exit code 1 (use -v to see invocation)
led me to this stack overflow answer
Xcode 错误linker command failed with exit code 1 (use -v to see invocation)
导致我找到了这个堆栈溢出答案
The second answer there suggests a check for multiple / duplicate .m files in the Xcode project Compile Resources:
那里的第二个答案建议在 Xcode 项目编译资源中检查多个/重复的 .m 文件:
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.
如果在“构建阶段”的目标的“编译源”部分中多次引用同一个 .m 文件,就会发生这种情况。删除重复的条目,你应该没问题。
So I had a check in Xcode and there was indeed a duplicate call to a plugin resource.
所以我检查了 Xcode,确实有对插件资源的重复调用。
After checking package.json I found the same plugin was referenced in two ways (with two paths).
检查 package.json 后,我发现以两种方式(有两个路径)引用了同一个插件。
Removing one of the two plugins resolved the issue.
删除两个插件之一解决了这个问题。
回答by Batur
I found the solution on github
我在github上找到了解决方案
the solution for me was open the .xcworkspace file insted of .xcodeproj located inside my '/platforms/ios' folder.
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
https://github.com/phonegap/phonegap-plugin-push/issues/1240
回答by Anas Red
the solution for my case was simply
我的情况的解决方案很简单
cd platforms/ios
then:
然后:
pod install