Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

Tags:

xcode

cordova

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.

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.

like image 212
Peter Avatar asked Sep 27 '12 12:09

Peter


3 Answers

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.

  • 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).

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

like image 151
Peter Avatar answered Nov 14 '22 14:11

Peter


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.

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
like image 43
Dev01 Avatar answered Nov 14 '22 15:11

Dev01


I had the same error and fixed it by reverting to an older version of 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 ios or 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.

Instructions came from here.

like image 6
j.davies Avatar answered Nov 14 '22 15:11

j.davies