Upgrade to Cordova 4.0.0 make iOS build fail with code 65

2.4k Views Asked by At

To generally upgrade my Codova install, I did this:

  • Upgraded NPM / node.js to the latest release
  • Upgraded Cordova

    sudo npm update -g cordova

  • Upgraded iOS and Android

    cordova platform update ios cordova platform update android

  • Then, I started a new build

cordova build

Unfortunately, no the iOS build fails:

The following build commands failed:

 CompileC build/XXX.build/Debug-iphonesimulator/XXX.build/Objects-normal/i386/
   MainViewController.o XXX/Classes/MainViewController.m normal 
   i386 objective-c com.apple.compilers.llvm.clang.1_0.compiler
   (1 failure)

     Error: /Users/sp21/Documents/projects/workshop/platforms/ios/cordova/build: Command failed with exit code 65
      at ChildProcess.whenDone (/usr/local/lib/node_modules/cordova/node_modules/cordova-lib/src/cordova/superspawn.js:135:23)
      at ChildProcess.emit (events.js:98:17)
      at maybeClose (child_process.js:756:16)
      at Process.ChildProcess._handle.onexit (child_process.js:823:5)

I probably should delete and regenerate the whole project.

But before I do, I'd be interested in a better workaround.

Update 2014-10-28

Now, I get a has been modified since the precompiled header message:

fatal error: file '/Users/USER/Documents/projects/workshop/platforms/
...ios/PROJECT/PROJECT-Prefix.pch' has been modified since the precompiled header
                   '/var/folders/pq/vqgwwh5h8xl0qx008k8xrc100000gp/C/com.apple.DeveloperTools/  
  ...6.1-6A1052d/Xcode/SharedPrecompiledHeaders/PROJECT-Prefix-
   ...cdipadqrfuqsrbermtsnitfghaea/PROJECT-Prefix.pch.pch' was built
 note: please rebuild precompiled header   
  '/var/folders/pq/vqgwwh5h8xl0qx008k8xrc100000gp/C/com.apple.DeveloperTools/
  ...6.1-6A1052d/Xcode/SharedPrecompiledHeaders/
  ...PROJECT-Prefix-cdipadqrfuqsrbermtsnitfghaea/PROJECT-Prefix.pch.pch'
3

There are 3 best solutions below

0
On

I set up a new Cordova project to figure out what triggered the cordova 'BUILD FAILED' error on cordova-ios v 4.0.0.

Turns out its when I add the Cordova Camera plugin in iOS@4.

cordova plugin rm cordova-plugin-camera
cordova build ios

Also remember to disable it on 'config.xml' otherwise it will be automatically reinstalled:

<!-- <plugin name="cordova-plugin-camera" spec="~1.2.0" /> -->
0
On

For safety reasons, I renamed the relevant Cordova platform folder:

<CordovaProject>/platforms/ios

to

<CordovaProject>/platforms/ios_pre_4-0-0

Then, I regenerated the iOS platform:

cordova platform add ios

Now, the project compiles fine again.

1
On

In my experience there is no need to re-add the platform for iOS or regenerate the whole project.

You can also just replace the contents of the /platforms/ios/(PROJECT NAME)/Classes folder with the content of a freshly added Cordova 4.0.0 iOS platform / project.