2

I updated Xcode to 5.1 and many errors appeared in my iOS app project which use opencv framework 2.4. My computer is macbook air and OSX 10.9.2.

When I compile my project, it works fine when I'm using Iphone Retina (3.5-Inch ,4-Inch) Simulator. But when I'm using Iphone Retina (4-Inch 64-bit) I got the following message when I try to build and run :

ld: warning: ignoring file /Users/mike/Documents/opencv2.framework/opencv2, missing required architecture x86_64 in file /Users/mike/Documents/opencv2.framework/opencv2 (3 slices)
Undefined symbols for architecture x86_64:
  "CvKNearest::CvKNearest(CvMat const*, CvMat const*, CvMat const*, bool, int)", referenced from:
  -[HomeViewController ocrTicket:] in HomeViewController.o
  "CvKNearest::~CvKNearest()", referenced from:
  -[HomeViewController ocrTicket:] in HomeViewController.o
  "cv::_InputArray::_InputArray(cv::Mat const&)", referenced from:
  -[HomeViewController ocrTicket:] in HomeViewController.o
  PreProcessImage(cv::Mat*, cv::Mat*, int, int) in HomeViewController.o
  PreProcessImageNew(cv::Mat*, cv::Mat*, int, int) in HomeViewController.o
  -[HomeViewController FromMat:ObtainRect:] in HomeViewController.o
...
ld: symbol(s) not found for architecture x86_64
bc a
  • 117
  • 2
  • 9

2 Answers2

11

Xcode upgrade to 5.1, apple default let all app through the 64 - bit compiler. By this way can close: selected the

Targets - > Build Settings - > Architectures. Double-click the Architectures

, choose other, delete in addition to the

$(ARCH_STANDARD) (' - ')

, and then increase

armv7 and armv7s' + '

(point). Compile the clean once again.

MackC
  • 352
  • 3
  • 17
  • I have a new problem. Now I want to submit my app to AppStore. But during validation, it says" This bundle is invalid. App that include an armv7s architecture are required to include an armv7 architecture". What should be done? – bc a Mar 28 '14 at 01:01
  • did u add armv7 in the architecture? – MackC Mar 28 '14 at 01:41
  • @bca you can try to find "Build Active Architecture Only" and set Release to NO – MackC Mar 28 '14 at 01:44
  • [http://stackoverflow.com/questions/12487689/validating-app-application-is-missing-architecture-armv7] .Yes I add.Build Active Architecture Only is set to no, but doesn't help.I solved it by remove iPhone 5c from my macbook. Strange. – bc a Mar 28 '14 at 01:49
  • Maybe it's because when you are driving simulator with mobile phones, or only compile the current version of the CPU architecture。 – MackC Mar 28 '14 at 01:54
  • @MackC I can build on 64-bit simulator, but still cannot build on 64-bit iPad Air. Any suggestion? – Wen May 04 '14 at 13:01
3

Short Answer: Remove arm64 from your list of Architectures in your build settings

Long Answer: Since Xcode 5.1 the default is to include arm64 in the list of standard build architectures. This will cause problems if you use a precompiled library, like OpenCV, that doesn't have a 64-bit slice because the the linker will not be able to find valid code. Don't worry about removing arm64 from your architecture list. As long as it is in the Valid Architectures list it will still run on a 64-bit platform.

borrrden
  • 33,256
  • 8
  • 74
  • 109
  • Thank you for answering me. Could you teach me how to "remove arm64 from my list of Architectures in my build setting?" You know change setting in Xcode is dangerous for ordinary people like me. – bc a Mar 17 '14 at 03:34
  • 1
    1) Look for "Architectures" 2) Remove "arm64" – borrrden Mar 17 '14 at 03:39
  • 1
    Actually I should rephrase that. You want to delete "Standard Architectures" and add "armv7" and "armv7s" (the 32-bit architectures from the iPhone 3GS onward) in its place. – borrrden Mar 17 '14 at 03:50
  • Thank you. Your answer is correct, but MackC give me more detail. – bc a Mar 19 '14 at 02:31