2
votes

I am using the RedLaser binding for Monotouch to create an app that scans barcodes. It works nice like a charm on iSimulator, but when I try deploying to a real device (switch running environment Debug|Simulator -> Debug|iPhone), I cannot even build.

I am using MonoTouch 6.0.8, MonoDevelop 3.0.6, XCode 4.5.2.

Also, I am using iphone 3GS device for deployment. The device is running iOS 6.0 and that is what the target of my application is. I found a bug on MonoTouch bugzilla that has the same erro code here, which suggested changing the target from 6.0 -> 5.1. I did that and did not change a thing.

I have my provisioning profile is setup, verified and installed on Xcode Organiser and same for the Certificate. I can see both are fine.

The Build Output is below, any help would be highly appreciated. Thanks

/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/g++ -miphoneos-version-min=5.1 -gdwarf-2 -arch armv7 -std=c99 -I/Developer/MonoTouch/SDKs/MonoTouch.iphoneos.sdk/usr/include -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS6.0.sdk -c /var/folders/_l/0pvrtd6x6qg83sz4_0906b5c0000gn/T/tmpee06e1f.tmp/main.armv7.m -o /Users/hasnainaltaiar/Dev/Leopard/SVN/trunk/LD6419/Platforms/iOS/Leopard.Delivery.iOS/Leopard.Delivery.iOS/obj/Release/mtouch-cache/main..armv7.cache.M0wr77LlBANF6vKjGqQvyVnmWEk=.o /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/g++ -miphoneos-version-min=5.1 -gdwarf-2 -arch armv7 -std=c99 -I/Developer/MonoTouch/SDKs/MonoTouch.iphoneos.sdk/usr/include -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS6.0.sdk -c /var/folders/_l/0pvrtd6x6qg83sz4_0906b5c0000gn/T/tmpee06e1f.tmp/registrar.m -o /Users/hasnainaltaiar/Dev/Leopard/SVN/trunk/LD6419/Platforms/iOS/Leopard.Delivery.iOS/Leopard.Delivery.iOS/obj/Release/mtouch-cache/registrar.armv7.cache.Zar9bxp0AZNxwVcgrsOMEFHv0k4=.o /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/g++ -Wl,-no_pie -miphoneos-version-min=5.1 -gdwarf-2 -arch armv7 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS6.0.sdk /var/folders/_l/0pvrtd6x6qg83sz4_0906b5c0000gn/T/tmpee06e1f.tmp/Mono.Security.dll.armv7.o /var/folders/_l/0pvrtd6x6qg83sz4_0906b5c0000gn/T/tmpee06e1f.tmp/Leopard.Domain.dll.armv7.o /var/folders/_l/0pvrtd6x6qg83sz4_0906b5c0000gn/T/tmpee06e1f.tmp/RedLaser.dll.armv7.o /var/folders/_l/0pvrtd6x6qg83sz4_0906b5c0000gn/T/tmpee06e1f.tmp/System.Core.dll.armv7.o /var/folders/_l/0pvrtd6x6qg83sz4_0906b5c0000gn/T/tmpee06e1f.tmp/mscorlib.dll.armv7.o /var/folders/_l/0pvrtd6x6qg83sz4_0906b5c0000gn/T/tmpee06e1f.tmp/System.dll.armv7.o /var/folders/_l/0pvrtd6x6qg83sz4_0906b5c0000gn/T/tmpee06e1f.tmp/monotouch.dll.armv7.o /var/folders/_l/0pvrtd6x6qg83sz4_0906b5c0000gn/T/tmpee06e1f.tmp/LeopardDeliveryiOS.exe.armv7.o /Users/hasnainaltaiar/Dev/Leopard/SVN/trunk/LD6419/Platforms/iOS/Leopard.Delivery.iOS/Leopard.Delivery.iOS/obj/Release/mtouch-cache/main..armv7.cache.M0wr77LlBANF6vKjGqQvyVnmWEk=.o /Users/hasnainaltaiar/Dev/Leopard/SVN/trunk/LD6419/Platforms/iOS/Leopard.Delivery.iOS/Leopard.Delivery.iOS/obj/Release/mtouch-cache/registrar.armv7.cache.Zar9bxp0AZNxwVcgrsOMEFHv0k4=.o -o /var/folders/_l/0pvrtd6x6qg83sz4_0906b5c0000gn/T/tmpee06e1f.tmp/LeopardDeliveryiOS -framework CFNetwork -framework Foundation -framework UIKit -framework AudioToolbox -framework QuartzCore -framework CoreGraphics -framework AVFoundation -framework CoreMedia -framework CoreVideo -framework OpenGLES -framework Security -framework SystemConfiguration -lz -liconv -u _mono_pmip -u _monotouch_create_managed_ref -u _monotouch_release_managed_ref -u _monotouch_IntPtr_objc_msgSend_IntPtr -u _monotouch_IntPtr_objc_msgSendSuper_IntPtr -u _CloseZStream -u _CreateZStream -u _Flush -u _ReadZStream -u _WriteZStream -lmono-2.0 -lmonotouch -L/Developer/MonoTouch/SDKs/MonoTouch.iphoneos.sdk/usr/lib -lgcc_eh -force_load /var/folders/_l/0pvrtd6x6qg83sz4_0906b5c0000gn/T/tmpee06e1f.tmp/libRedLaserSDK.a Process exited with code 1, command: /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/g++ -Wl,-no_pie -miphoneos-version-min=5.1 -gdwarf-2 -arch armv7 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS6.0.sdk /var/folders/_l/0pvrtd6x6qg83sz4_0906b5c0000gn/T/tmpee06e1f.tmp/Mono.Security.dll.armv7.o /var/folders/_l/0pvrtd6x6qg83sz4_0906b5c0000gn/T/tmpee06e1f.tmp/Leopard.Domain.dll.armv7.o /var/folders/_l/0pvrtd6x6qg83sz4_0906b5c0000gn/T/tmpee06e1f.tmp/RedLaser.dll.armv7.o /var/folders/_l/0pvrtd6x6qg83sz4_0906b5c0000gn/T/tmpee06e1f.tmp/System.Core.dll.armv7.o /var/folders/_l/0pvrtd6x6qg83sz4_0906b5c0000gn/T/tmpee06e1f.tmp/mscorlib.dll.armv7.o /var/folders/_l/0pvrtd6x6qg83sz4_0906b5c0000gn/T/tmpee06e1f.tmp/System.dll.armv7.o /var/folders/_l/0pvrtd6x6qg83sz4_0906b5c0000gn/T/tmpee06e1f.tmp/monotouch.dll.armv7.o /var/folders/_l/0pvrtd6x6qg83sz4_0906b5c0000gn/T/tmpee06e1f.tmp/LeopardDeliveryiOS.exe.armv7.o /Users/hasnainaltaiar/Dev/Leopard/SVN/trunk/LD6419/Platforms/iOS/Leopard.Delivery.iOS/Leopard.Delivery.iOS/obj/Release/mtouch-cache/main..armv7.cache.M0wr77LlBANF6vKjGqQvyVnmWEk=.o /Users/hasnainaltaiar/Dev/Leopard/SVN/trunk/LD6419/Platforms/iOS/Leopard.Delivery.iOS/Leopard.Delivery.iOS/obj/Release/mtouch-cache/registrar.armv7.cache.Zar9bxp0AZNxwVcgrsOMEFHv0k4=.o -o /var/folders/_l/0pvrtd6x6qg83sz4_0906b5c0000gn/T/tmpee06e1f.tmp/LeopardDeliveryiOS -framework CFNetwork -framework Foundation -framework UIKit -framework AudioToolbox -framework QuartzCore -framework CoreGraphics -framework AVFoundation -framework CoreMedia -framework CoreVideo -framework OpenGLES -framework Security -framework SystemConfiguration -lz -liconv -u _mono_pmip -u _monotouch_create_managed_ref -u _monotouch_release_managed_ref -u _monotouch_IntPtr_objc_msgSend_IntPtr -u _monotouch_IntPtr_objc_msgSendSuper_IntPtr -u _CloseZStream -u _CreateZStream -u _Flush -u _ReadZStream -u _WriteZStream -lmono-2.0 -lmonotouch -L/Developer/MonoTouch/SDKs/MonoTouch.iphoneos.sdk/usr/lib -lgcc_eh -force_load /var/folders/_l/0pvrtd6x6qg83sz4_0906b5c0000gn/T/tmpee06e1f.tmp/libRedLaserSDK.a Undefined symbols for architecture armv7:
"_OBJC_CLASS_$_CLLocationManager", referenced from: objc-class-ref in libRedLaserSDK.a(StatusManager.o) ld: symbol(s) not found for architecture armv7 collect2: ld returned 1 exit status

error MT5202: Native linking failed. Please review the build log.

---------------------- Done ----------------------

Project does not have bundle identifier specified. Generated 'leoparddeliveryios' to match provisioning profile.

2
Did you forget to include the native dependencies? stackoverflow.com/questions/11104969/…Lex Li

2 Answers

4
votes

From the error message:

Undefined symbols for architecture armv7: "_OBJC_CLASS_$_CLLocationManager"

It seems the library was updated and now has a dependency on CoreLocation.

Edit the [LinkWith] attribute inside the binding project and add CoreLocation to it's Frameworks property, then rebuild the bindings (and then rebuild your application). If this fixes the issue then please file a bug report so it can be fixed in the github repository.

Note: As a quick test you can also add the following option to both your Debug and Release configuration of your project (in the mtouch additional arguments in your project's Options inside MonoDevelop).

-gcc_args="-framework CoreLocation"

That will result in the same - except you'll need to copy that fix for every project (and configuration) you're using (so it's useful to spot the issue but not a really good way to fix it).

2
votes

Ok I resolved the problem but will document the solution here to share the lesson learned.

First: it could not build the solution because it was missing CoreLocation from the Frameworks attributes when binding. Thanks to poupou for pointing that out, I fixed it also on GitHub (MonoTouch Binding Repo).

Second: MonoDevelop Could not build the app because it could not find the Provisioning profile. You need to set up your Provisioning profile and Certificate manually. You can do that by going to your Main Project > Options > Build > iPhone Bundle Signing > Then you choose your Configuration (Debug|Release) and Platform (iPhone|Simulator) and choose your certificate and provisioning profile for Identity and Prov. Profile.

Third: Lastly, the app was crashing everytime I deploy to the iPhone. I filed a bug as mentioned in the comment above. Then it appeared that RedLaser framework has a bug in scanning QRCodes. Disabling this feature by adding the line below, fixed the problem.

overlayController.ParentPicker.ScanQRCODE = false;