构建到 64 位时,phonegap cordova xcode 链接失败

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/22045877/
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

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-15 04:42:05  来源:igfitidea点击:

phonegap cordova xcode link failed when build to 64bit

iosxcodecordova

提问by Chana

i have a cordova project in xcode 5.0.2 it works perfectly on a iphone5c but didnt work on iphone5s i read some on this and thought that the problem is i have to build my project on 64bit architecture.
i make this build settings:
architecture - standart architecture (including 64-bit)(armv7, armv7s, arm64)
build active architecture only - no

我在 xcode 5.0.2 中有一个 cordova 项目,它在 iphone5c 上运行良好,但在 iphone5s 上没有运行,我阅读了一些关于此的内容,并认为问题是我必须在 64 位架构上构建我的项目。
我进行此构建设置:
架构 - 标准架构(包括 64 位)(armv7、armv7s、arm64)
仅构建活动架构 - 否

and when i build i get this errors:

当我构建时,我收到此错误:

ld: warning: ignoring file /Users/chana/Library/Developer/Xcode/DerivedData/Pitaron-    echagbyhunbeprbdfodckoblgtuq/Build/Products/Debug-iphonesimulator/libCordova.a, file was built for archive  which is not the architecture being linked (x86_64):  /Users/chana/Library/Developer/Xcode/DerivedData/Pitaron-echagbyhunbeprbdfodckoblgtuq/Build/Products/Debug- iphonesimulator/libCordova.a
Undefined symbols for architecture x86_64:
  "_CDVLocalNotification", referenced from:
  -[AppDelegate application:didReceiveLocalNotification:] in AppDelegate.o
   "_CDVPluginHandleOpenURLNotification", referenced from:
  -[AppDelegate application:handleOpenURL:] in AppDelegate.o
  "_OBJC_CLASS_$_CDVCommandDelegateImpl", referenced from:
  _OBJC_CLASS_$_MainCommandDelegate in MainViewController.o
  "_OBJC_CLASS_$_CDVCommandQueue", referenced from:
   _OBJC_CLASS_$_MainCommandQueue in MainViewController.o
  "_OBJC_CLASS_$_CDVViewController", referenced from:
  _OBJC_CLASS_$_MainViewController in MainViewController.o
  "_OBJC_METACLASS_$_CDVCommandDelegateImpl", referenced from:
  _OBJC_METACLASS_$_MainCommandDelegate in MainViewController.o
  "_OBJC_METACLASS_$_CDVCommandQueue", referenced from:
  _OBJC_METACLASS_$_MainCommandQueue in MainViewController.o
  "_OBJC_METACLASS_$_CDVViewController", referenced from:
  _OBJC_METACLASS_$_MainViewController in MainViewController.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)

any body knows what to do?
thanks a lot.

任何人都知道该怎么做?
多谢。

采纳答案by Sasikant

The problem is with Xcode 5.1 coming with 64 bit support.

问题在于 Xcode 5.1 支持 64 位。

The cordova project created contains cordova library (‘CordovaLib.xcodeproj' project in the project navigator pane) which is not configured for arm64.

创建的cordova 项目包含未针对arm64 配置的cordova 库(项目导航器窗格中的“CordovaLib.xcodeproj”项目)。

To resolve this issue, click on ‘CordovaLib.xcodeproj' where it shows project settings goto ‘Architectures' and table and change all architectures to ‘$(ARCHS_STANDARD)' or Standard Architectures. (They have been initially set to different values which is the reason for build failing)

要解决此问题,请单击显示项目设置的“CordovaLib.xcodeproj”,然后转到“架构”和表格,并将所有架构更改为“$(ARCHS_STANDARD)”或标准架构。(它们最初被设置为不同的值,这是构建失败的原因)

回答by iain_simpson

The problem seems to be that your version of libCordova isn't compiled for arm64.

问题似乎是您的 libCordova 版本不是为 arm64 编译的。

The quick fix is to remove arm64 from your list of build architectures - the 5s will happily run code compiled for armv7.

快速修复是从您的构建架构列表中删除 arm64 - 5s 将很乐意运行为 armv7 编译的代码。

The proper fix is to upgrade Cordova to a version that has arm64 versions of the libraries compiled.

正确的解决方法是将 Cordova 升级到编译了 arm64 版本库的版本。