Zbar SDK is not working in iOS6
Asked Answered
D

9

28

I was using ZBar for scanning in iOS5 and it was working well.

Now after updating to iOS6, its not working. It shows a following error.

    ld: file is universal (3 slices) but does not contain a(n) armv7s slice: /Users/mac4/Desktop/my desktop/My app/MyApp name 20:09:12  /MyApp name/ZBarSDK/libzbar.a for architecture armv7s
clang: error: linker command failed with exit code 1 (use -v to see invocation)

What is wrong in my side?

Destinee answered 20/9, 2012 at 5:43 Comment(0)
G
30

i recently faced the same issue. The problem seems to be that the ZBar SDK is not ready for the armv7s architecture.

I solved the problem this way:

  1. Go to the ZBar homepage and navigate to the mercurial repository (direct link)
  2. Download the zbar repository as zip.
  3. Unzip the file and navigate to the subfolder named "iphone".
  4. Open the XCode project.
  5. Delete the "Examples" folder (the folder caused a build error on my machine).
  6. Hit "CMD + B" and build the source.
  7. Find your new libzbar.a file. (User/Library/Developer/Xcode/DerivedData/zbar...)
  8. Replace the old libzbar.a file in your project with the new one.
  9. Hit "CMD + R" and you are good to go.
Gretchengrete answered 24/9, 2012 at 8:25 Comment(3)
This worked when running on device or simulator. When you try to build the product I still get this error. "_OBJC_CLASS_$_ZBarReaderController", referenced from: objc-class-ref in DealElementDisplayController.o "_ZBarReaderControllerResults", referenced from: -[DealElementDisplayController imagePickerController:didFinishPickingMediaWithInfo:] in DealElementDisplayController.o ld: symbol(s) not found for architecture armv7Pettigrew
@Pettigrew You are right. If you go with this tutorial (federicocappelli.net/2012/10/05/…) it will work just fine. The key is to merge the output files.Gretchengrete
This does work. Just one thing, when you go to the direct link click on Code and not iPhone and the click "Download Snapshot". The rest of the instructions work perfectly. Thank you.Nierman
D
52

In Xcode, go to the settings of your target, change 'Valid Architectures'

from

armv7,armv7s

to

armv7

This change means your app will not take advantage of possible optimizations the new iPhone5 processor has, but you don't have to wait for 3rd party libraries to upgrade or mess with a hex editor.

Datestamp answered 20/9, 2012 at 16:42 Comment(5)
As noted in the comments on a separate answer, the appropriate way to resolve this is to compile the library to include the correct architecture. Instructions, and a downloadable package, are at federicocappelli.net/2012/10/05/…Tracytrade
Kappe, that's not true. armv7s is a superset of armv7, so anything working on armv7 should work on v7s as well. If the library would contain code which uses armv7s features (i.e. for speed enhancements), you would loose those features. Only if the library would work only on v7s, you would have a problem.Datestamp
adrianz, you're right, compiling the lib is the appropriate way- if you know what you're doing. But we talk about a library that is 1) not enhanced for armv7s, so the recompile would simply add the right flag without changing anything else 2) a complicated piece of code with lots of targets and switches and 3) probably very soon released with the appropriate v7s support anyway. Wether you want to compile a library with all the possible known and unknown problems for yourself instead of waiting for the maintainers to do the same and using this shortcut in the meantime is up to you of course.Datestamp
This worked for me but only after I set version to iOS 6.0 - it still would not build for 6.1Beedon
@Datestamp not working for me i m using xcode 4.6 and device is iphone5.Homophonous
G
30

i recently faced the same issue. The problem seems to be that the ZBar SDK is not ready for the armv7s architecture.

I solved the problem this way:

  1. Go to the ZBar homepage and navigate to the mercurial repository (direct link)
  2. Download the zbar repository as zip.
  3. Unzip the file and navigate to the subfolder named "iphone".
  4. Open the XCode project.
  5. Delete the "Examples" folder (the folder caused a build error on my machine).
  6. Hit "CMD + B" and build the source.
  7. Find your new libzbar.a file. (User/Library/Developer/Xcode/DerivedData/zbar...)
  8. Replace the old libzbar.a file in your project with the new one.
  9. Hit "CMD + R" and you are good to go.
Gretchengrete answered 24/9, 2012 at 8:25 Comment(3)
This worked when running on device or simulator. When you try to build the product I still get this error. "_OBJC_CLASS_$_ZBarReaderController", referenced from: objc-class-ref in DealElementDisplayController.o "_ZBarReaderControllerResults", referenced from: -[DealElementDisplayController imagePickerController:didFinishPickingMediaWithInfo:] in DealElementDisplayController.o ld: symbol(s) not found for architecture armv7Pettigrew
@Pettigrew You are right. If you go with this tutorial (federicocappelli.net/2012/10/05/…) it will work just fine. The key is to merge the output files.Gretchengrete
This does work. Just one thing, when you go to the direct link click on Code and not iPhone and the click "Download Snapshot". The rest of the instructions work perfectly. Thank you.Nierman
A
21

The hg sources download/re-compilation tutorial is great, but you don't need to do all that.

Just browse to http://sourceforge.net/projects/zbar/files/iPhoneSDK/beta/ and download ZBarSDK-1.3.1.dmg, and everything will work out of the box for the latest architectures (in my case armv7, armv7s).

Update:

Some of you reported issues with ZBarSDK on XCode 5, iOS 7 or architectures arm64... well I went back to this project today and experienced similar issues and found that there is a ZBarSDK library that is compiled to work with iOS 7 at: http://www.nerdvision.net/app-development/ios/zbar-sdk. I Just replaced the old files with the new ones and my project compiled. Note that the Architectures in my project's Build Settings are set to amrv7, arm64 ($ARCHS_STANDARD), Base SDK is set to iOS 8.0 and I have the Build Active Architectures Only flag set to Yes.

There is a question here at SO about this: zbar SDK dont work for armv7s(iPad 4 iOS 7)

Thanks to @cdescours for the tip!

Aesthesia answered 29/3, 2013 at 16:11 Comment(6)
really the simplest method just drag drop replace libzbar.a with the new one.Thane
IMHO This should have been the answerCentra
How is this not the number one answer? Excellent.Overdo
After adding this, I start getting arm64 architecture missing error.Fogged
This works for armv7 and armv7s but not arm64. Can you specify which libzbar would work for all three.Fatling
Hi! It happens that at the moment of answering this question there was no arm64 (and to exclude any other architectures, I say... "in my case armv7, armv7s"). When I compile this App for arm64 will check it out and update the answer accordingly.Aesthesia
P
2

I have same problem but I just added armv6 and armv7 then it works for iOS6. Just insert armv6.

Prosenchyma answered 22/4, 2013 at 10:50 Comment(0)
W
1

your binary library does not have code for armv7s. So you should recompile it for the current archtitectures.

Windywindzer answered 20/9, 2012 at 9:14 Comment(0)
M
1

Recompile the source, I download the source code for zbar and compile into new project. It's simple.

Mande answered 8/11, 2012 at 6:52 Comment(0)
A
0

Clone the Mercurial repository and build with Xcode. It's very easy. Here's a link to the repository:

http://zbar.hg.sourceforge.net/hgweb/zbar/iphone/summary

Armor answered 18/3, 2013 at 13:30 Comment(0)
A
0

Came here with the same problem after downloading the tutorial code RDC provided in his blog. Very useful post, but the most helpful answer here was posted by RacZo on 3/29. I just downloaded the original ZBarSDK-1.3.1.dmg image, removed the ZBarSDK from my project and replaced with the original. Done.

Assai answered 2/9, 2013 at 21:20 Comment(0)
S
0

I am learning IOS development. After few days digging,

Here is the tutorial for installing ZBar SDK.

1, The accepted answer is correct, but with some limitations. (tried, works!)

2, The alternative solution is here. (tried, works!)

3, The best is to build the all different architectures separated then bind them using lipo: Great Solution (tried, brilliant!)

Some readings for understanding those architectures:

http://wanderingcoder.net/2010/07/19/ought-arm/

http://wanderingcoder.net/2011/09/25/compiling-armv7/

Shaunshauna answered 10/12, 2013 at 22:32 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.