Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
477 views
in Technique[技术] by (71.8m points)

ios - xcode 5.1 - Undefined symbols for architecture x86_64 (zbar)

I have updated my x code version from 5.0 to 5.1
I have used ZBarSDK in my project for scan bar code. In simulator 'iPhone Retina (3.5-inch)' and 'iPhone Retina(4-inch)', it is working fine. But when i want to build with simulator 'iPhone Retina (4-inch 64-bit)', it is giving the following error.

ld: warning: ignoring file /Users/sayan/Desktop/ProjectAtanu/Omlis/Custom Classes/ZBarSDK/libzbar.a, missing required architecture x86_64 in file /Users/sayan/Desktop/ProjectAtanu/Omlis/Custom Classes/ZBarSDK/libzbar.a (3 slices)
Undefined symbols for architecture x86_64:
"_OBJC_CLASS_$_ZBarReaderViewController", referenced from:
 objc-class-ref in HomeViewController.o
"_ZBarReaderControllerResults", referenced from:
-[HomeViewController imagePickerController:didFinishPickingMediaWithInfo:] in  HomeViewController.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)

Architecture: Standard architecture(arm64, armv7, armv7s) - $(ARCHS_STANDARD)
Valid Architectures: arm64,armv7,armv7s
Base SDK: Latest IOS(IOS 7.1)
iOS Deployment Target: iOS 6.1

Any help much appreciated!

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

USING PODS

pod 'ZBarSDK'

OR

Recompile ZBar for iphone 5. You can download recompiled ZBAR from here to skip the following

Steps

  1. Download the source code (you must have Mercurial for mac):

  2. Open Terminal and run following commands

    a. hg clone http://zbar.hg.sourceforge.net:8000/hgroot/zbar/zbar

    b. cd zbar

    c. hg checkout iPhoneSDK-1.3.1

    d. open iphone/zbar.xcodeproj

  3. In the xcode project edit the "libzbar" scheme and select Release in Build configuration

  4. Go to Build Settings set following Architectures

    a. Architectures - >Standard architectures(armv7,armv72,arm64)

    b. Valid Architectures -> arm64,armv7 armv7s

  5. Compile libzbar for device AND for simulator, here the configuration:

  6. Find the compiled libzbar.a and go in the folder using Teminal.app,

    In My Case : /Users/kappe/Library/Developer/Xcode/DerivedData/zbar-gyozyrpbqzvslmfoadhqkwskcesd/Build/Products

    In this folder you you should have two sub folder Release-iphoneos and Release-iphonesimulator

  7. using xcode command line tools build your universal lib:

    lipo -create Release-iphoneos/libzbar.a Release-iphonesimulator/libzbar.a -o libzbar.a

    Now you can use the libzbar.a created, both in device and simulator.

Ref : http://www.federicocappelli.net/2012/10/05/zbar-library-for-iphone-5-armv7s/


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...