19

I recently switched my development MacBook from a classic MacBook (32 bit) to a MacBook Air (64 bit). I am trying to open a project that was made on my old MacBook (32 bit) running XCode 4.

The project is a PhoneGap application made in PhoneGap 1.7.0.

My new MacBook Air (64 bit) is running XCode 5.

I imported my developer profiles from my old MacBook to my new MacBook Air. But when I try to run it, I get the following error message.

enter image description here

enter image description here

I have tried changing the my architecture in the build settings to armv7 but still no luck :(

Does anyone know why I'm getting this error and how to fix it?

Thanks

Farhan Ahmad
  • 5,148
  • 6
  • 40
  • 69

2 Answers2

26

OK so as it turns out, XCode 5 changes the default architecture to armv7 when my application does not support armv7. I am running Cordova 1.7.0 and that version does not have support for armv7 architecture.

Fix architecture issue:

  1. Removed ALL architectures from Build Settings --> Valid Architecture
  2. Added armv6 to Build Settings --> Valid Architecture enter image description here


Fix libSystem.B.dylib issue:

  1. Removed /usr/lib/libSystem.B.dylib from Build Settings --> Linking --> Other Linker Flags

  2. Also removed -weak_library from Build Settings --> Linking --> Other Linker Flags enter image description here

Farhan Ahmad
  • 5,148
  • 6
  • 40
  • 69
  • 1
    in my case, i am trying to run the project made in xcode 4.5 into xcode 5.0. So this error occurs in every project. so i removed all the linker flags from 'other Linker Flags' and it works. – utkal patel Dec 19 '13 at 05:51
  • 1
    Thanks so much mate for this....exactly my problem... and excatly the solution i needed :) – Abolfoooud Jan 30 '14 at 13:30
  • After 2 weeks of searching for a solution, this was it! – AddisDev Feb 03 '14 at 14:10
1

Xcode 5 asks you to build your libraries for the simulator (1) and for iOS (2). You can then merge (3) these into a fat binary which you then link to your main project. I use the same flags as Xcode is using to build your main project (as seen in your screendump).

Expressed in common gnu toolchain variables I do:

1. Building a library for the simulator

CC=clang
IPHONEOS_DEPLOYMENT_TARGET=7.0
PATH="/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin:/Applications/Xcode.app/Contents/Developer/usr/bin:$PATH"
CFLAGS="-arch i386 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator7.0.sdk -mios-simulator-version-min=7.0"

2. Building a library for iOS

CC=clang
IPHONEOS_DEPLOYMENT_TARGET=7.0
PATH="/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin:/Applications/Xcode.app/Contents/Developer/usr/bin:$PATH"
CFLAGS="-arch armv7 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS7.0.sdk -miphoneos-version-min=7.0"

3. Merging to a fat binary

Choose either of .a or .dylib depending on what you use:

lipo -create "your armv7 lib".a     "your simulator lib".a     -output "your lib".a
lipo -create "your armv7 lib".dylib "your simulator lib".dylib -output "your lib".dylib
such
  • 583
  • 4
  • 9
  • Where would I type these? Is it in terminal? Also, for step 3, can I call those libs whatever I want? What would replace the placeholder text? – Michael Nares Jul 30 '14 at 16:10