xcode Phonegap/Cordova 构建错误 - Apple Mach-O 链接器错误:没有这样的文件或目录:libCordova.a

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

Phonegap/Cordova Build error - Apple Mach-O Linker Error: no such file or directory: libCordova.a

xcodecordova

提问by Peter

I am getting an error after creating a new Cordova 2.1.0 project and updating the www folder with some code from a previous PhoneGap application.

在创建新的 Cordova 2.1.0 项目并使用以前 PhoneGap 应用程序中的一些代码更新 www 文件夹后,我收到错误消息。

clang: error: no such file or directory: '/Users/peterbanjo/Library/Developer/Xcode/DerivedData/OpuzMobile-bhwawiqfaptmxvfosawfabudgbkj/Build/Products/Debug-iphoneos/libCordova.a'

The error only occurs when I try and run the application on a device - in the simulator it works fine.

只有当我尝试在设备上运行应用程序时才会发生错误 - 在模拟器中它工作正常。

I am running Xcode 4.5 and iOS6 on the target iPad. I have tried a clean build and libCordova.a appears in the Build Phases > Link Library With Libraries tab but it is in red.

我在目标 iPad 上运行 Xcode 4.5 和 iOS6。我尝试了一个干净的构建,libCordova.a 出现在构建阶段 > 链接库与库选项卡中,但它是红色的。

回答by Peter

What I found confusing with PhoneGap/Cordova 2.1.0 by upgrading from 1.4 is that there are TWO projects in my application. There is MyApplication.xcodeproj and CordovaLib.xcodeproj. The changes to resolve this issue need to be applied to the CordovaLib project.

通过从 1.4 升级,我发现与 PhoneGap/Cordova 2.1.0 混淆的是我的应用程序中有两个项目。有 MyApplication.xcodeproj 和 CordovaLib.xcodeproj。解决此问题的更改需要应用于 CordovaLib 项目。

  • Change "Build Active Architecture Only" to "YES"
  • Update the text file project.pbxproj to these values
  • Toggle between the build schema for the simulator and the device (Use the select menu next to the stop button. Somehow this seems to cause the changes to be detected).
  • 将“仅构建活动架构”更改为“是”
  • 将文本文件 project.pbxproj 更新为这些值
  • 在模拟器和设备的构建模式之间切换(使用停止按钮旁边的选择菜单。不知何故,这似乎会导致检测到更改)。

Did this work for you? Did I miss something?

它能为您提供帮助吗?我错过了什么?

PS: For a better understanding of the problem take a look at this Google Forum thread

PS:为了更好地理解问题,请查看此Google 论坛帖子

回答by Dev01

I'm using Cordova/Phonegap 2.9 and this solved my issue. Didn't touch any of the arch stuff. Everything is set to armv7 armv7s on mine.

我正在使用 Cordova/Phonegap 2.9,这解决了我的问题。没有接触任何拱形的东西。我的一切都设置为 armv7 armv7s。

Follow these steps to fix this problem:

请按照以下步骤解决此问题:

  1. Go to project settings and Build Tab.
  2. Search for "Other Linker Flags"
  3. Double click on the linker flags for Release and Change ${TARGET_BUILD_DIR}/libCordova.a to ${BUILT_PRODUCTS_DIR}/libCordova.a
  4. Do the same for Debug Clean and build archive again
  1. 转到项目设置和构建选项卡。
  2. 搜索“其他链接器标志”
  3. 双击 Release 的链接器标志并将 ${TARGET_BUILD_DIR}/libCordova.a 更改为 ${BUILT_PRODUCTS_DIR}/libCordova.a
  4. 对 Debug Clean 执行相同操作并再次构建存档

回答by j.davies

I had the same error and fixed it by reverting to an older version of cordova ios.

我有同样的错误并通过恢复到旧版本的cordova ios来修复它。

Steps to fix the issue:

解决问题的步骤:

  1. Uninstall cordova-ios first, with npm uninstall cordova-ios
  2. Install old version of cordova-ios with npm install [email protected]
  3. Remove existing ios platform with ionic cordova platform rm iosor ionic platform rm ios
  4. After that we should add platform with ionic cordova platform add [email protected]or ionic platform add [email protected]
  5. Run ionic cordova build ios.
  1. 首先卸载cordova-ios,使用 npm uninstall cordova-ios
  2. 安装旧版本的cordova-ios npm install [email protected]
  3. 使用ionic cordova platform rm ios或删除现有的 ios 平台ionic platform rm ios
  4. 之后我们应该添加平台ionic cordova platform add [email protected]ionic platform add [email protected]
  5. 运行 ionic cordova build ios。

Instructions came from here.

指示来自这里

回答by Samuel

Only need to remove armv6from both YourProject and CordovaLib: remove armv6 from CordovaLib and do the same for YourProject

只需要从 YourProject 和 CordovaLib 中删除armv6从 CordovaLib 中删除 armv6 并对 YourProject 执行相同操作

The consequences of doing this? Apparently, it's still working on iPhone 3GS, but not the previous versions..

这样做的后果是什么?显然,它仍在 iPhone 3GS 上工作,但不是以前的版本。

回答by Bartosz Wachowski

To make it work I downloaded from http://connect.apple.comstand alone Xcode 4.4.1. With this version I can build my phonegap Application with armv6 :)

为了使它工作,我从http://connect.apple.com下载了独立的 Xcode 4.4.1。使用此版本,我可以使用 armv6 构建我的 phonegap 应用程序 :)

Yes, in this case you need to have two Xcode on your computer.

是的,在这种情况下,您的计算机上需要有两个 Xcode。

回答by Augie Gardner

DO NOT assume that having Standard (armv7,armv7s) - $(ARCHS_STANDARD_32_BIT)is the same as the fix above. Manually change this value to only armv7and that fixed it for me. I was very frustrated.

不要假设具有Standard (armv7,armv7s) - $(ARCHS_STANDARD_32_BIT)与上面的修复相同。手动将此值更改为 onlyarmv7并为我修复它。我非常沮丧。

回答by Theus

Look at this https://groups.google.com/forum/?fromgroups=#!topic/phonegap/ywoc9wNydZ8

看看这个https://groups.google.com/forum/?fromgroups=#!topic/phonegap/ywoc9wNydZ8

works for me

对我来说有效

-- OS X 10.8.2 XCode 4.5 iOS 6.0 PhoneGap 2.1.0

-- OS X 10.8.2 XCode 4.5 iOS 6.0 PhoneGap 2.1.0

回答by maridob

If you did everything here and it is still not working and you have separate configuration aside from Release and Debug - for this example is Production. Make sure that 'Production' Build Configuration exists in Cordova project. Build the Cordova Project and Build + Archive your main project again.

如果您在此处完成了所有操作,但它仍然无法正常工作,并且除了发布和调试之外您还有单独的配置 - 对于此示例是生产。确保 Cordova 项目中存在“生产”构建配置。再次构建 Cordova 项目并构建 + 归档您的主项目。