1
votes

I'm having a problem getting my PhoneGap 3.2.0 app to compile on Mac when the Zbar barcode scanner plugin is implemented. It will compile within XCode if I deploy to the device, but to a simulated device, it gives the error:

Ld DerivedData/MYAPP/Build/Products/Debug-iphonesimulator/MYAPP.app/MYAPP normal i386 cd /Users/Cordova/MyApp/platforms/ios setenv IPHONEOS_DEPLOYMENT_TARGET 5.0 setenv PATH "/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin:/Applications/Xcode.app/Contents/Developer/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin" /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang++ -arch i386 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator7.0.sdk -L/Users/Cordova/MyApp/platforms/ios/DerivedData/MYAPP/Build/Products/Debug-iphonesimulator -L/Users/Cordova/MyApp/platforms/ios/ZBarSDK -L/Users/Cordova/MyApp/platforms/ios/MYAPP/Plugins/com.manateeworks.barcodescanner/MWBarcodeScanner -F/Users/Cordova/MyApp/platforms/ios/DerivedData/MYAPP/Build/Products/Debug-iphonesimulator -filelist /Users/Cordova/MyApp/platforms/ios/DerivedData/MYAPP/Build/Intermediates/MYAPP.build/Debug-iphonesimulator/MYAPP.build/Objects-normal/i386/MYAPP.LinkFileList -Xlinker -objc_abi_version -Xlinker 2 -weak_framework CoreFoundation -weak_framework UIKit -weak_framework AVFoundation -weak_framework CoreMedia -weak-lSystem -force_load /Users/Cordova/MyApp/platforms/ios/DerivedData/MYAPP/Build/Products/Debug-iphonesimulator/libCordova.a -ObjC -fobjc-arc -fobjc-link-runtime -Xlinker -no_implicit_dylibs -mios-simulator-version-min=5.0 -framework AssetsLibrary -framework CoreGraphics -framework MobileCoreServices -framework CoreLocation -weak_framework ImageIO -framework CoreMotion -weak_framework AudioToolbox -weak_framework SystemConfiguration -framework Foundation -framework UIKit -framework AVFoundation -framework CoreMedia -framework CoreVideo -framework QuartzCore -liconv -lzbar -Xlinker -dependency_info -Xlinker /Users/Cordova/MyApp/platforms/ios/DerivedData/MYAPP/Build/Intermediates/MYAPP.build/Debug-iphonesimulator/MYAPP.build/Objects-normal/i386/MYAPP_dependency_info.dat -o /Users/Cordova/MyApp/platforms/ios/DerivedData/MYAPP/Build/Products/Debug-iphonesimulator/MYAPP.app/MYAPP

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

While I don't actually want or need the simulated devices; the problem is that from the terminal, when I run the command:

$ cordova build ios

it throws up the error:

Error: An error occurred while building the ios project.

** BUILD FAILED **

The following build commands failed:

   Ld build/emulator/MyApp.app/MyApp normal i386

(1 failure)

If I try to type the command shown in the error on its own, it tells me:

ld: file not found: build/emulator/MyApp.app/MyApp

Which is true. It doesn't exist. I presume that something else is failing before this and stopping it from getting created.

If I remove Zbar all together, it everything works fine.

A previous version of the app I had made was way back at PhoneGap v2.5.0 and wasn't using the command-line-interface to create the build. I had put it all together manually, so it wasn't giving me this issue.

I've tried a lot of things already in the Build Settings / Build Phases sections. I've been at this for 2 weeks now, and it seems that everything I try just leads to new error messages. Please help!

1
LD command tries to link the library files to the output DerivedData/MYAPP/Build/Products/Debug-iphonesimulator/MYAPP.app/MYAPP It seems to fail because the ZBar sdk wasn’t compiled or doesn’t have the right flags for i386 architecture so the linkage fails and the directory doesn’t get created. At least it’s what I’m guessing from the command / output, I can't actually try it myself.Daniel Goncalves

1 Answers

0
votes

I solved this! I downgraded the version of ZBar to the pervious version and it worked right away. I had some version in my project that apparently had ios7 fixes. Not sure what the exact cause of the issue was in the end mind you.