Quantcast
Channel: Recent Threads — Xamarin Community Forums
Viewing all articles
Browse latest Browse all 204402

Problems with Obj-C native linking

$
0
0

Hi,

I have created a binding for the BA3 AltusMapping library and I am having a few issues with integrating into my project.

Here is the linking details:

[assembly: LinkWith ("AltusMappingEngine-iOS.a", 
  LinkTarget.Simulator | LinkTarget.ArmV7 | LinkTarget.ArmV7s,
  Frameworks = "OpenGLES CoreGraphics GLKit UIKit Foundation CoreText",
  ForceLoad = false,
  LinkerFlags = "-Objc -lc++ -lsqlite3",
  IsCxx = true)]

First of all, if I set the ForceLoad = true then I end up with the following error:

error MT5212: Native linking failed, duplicate symbol: '__Z23__gl_pqHeapNewPriorityQPFiPvS_E'.
error MT5213: Duplicate symbol in: /Users/.../Phoenix/obj/iPhone/Debug/mtouch-cache/AltusMappingEngine-  
iOS.a(priorityq.o) (Location related to previous error)
error MT5213: Duplicate symbol in: /Users/.../Phoenix/obj/iPhone/Debug/mtouch-cache/AltusMappingEngine-  
iOS.a(priorityq-heap.o) (Location related to previous error)
error MT5212: Native linking failed, duplicate symbol: '__Z26__gl_pqHeapDeletePriorityQP13PriorityQHeap'.
error MT5213: Duplicate symbol in: /Users/.../Phoenix/obj/iPhone/Debug/mtouch-cache/AltusMappingEngine-
iOS.a(priorityq.o) (Location related to previous error)
error MT5213: Duplicate symbol in: /Users/.../Phoenix/obj/iPhone/Debug/mtouch-cache/AltusMappingEngine- 
iOS.a(priorityq-heap.o) (Location related to previous error)
...

There are a number of similar errors like that but most have been removed for brevity. If I remove the ForceLoad I am able to compile the project but I am only able to run it on a device. If I try running it on the simulator I get this error when creating a class that is in the library:

Could not create an native instance of the type 'BA3.MEMapViewController': the native class hasn't been loaded.
It is possible to ignore this condition by setting MonoTouch.ObjCRuntime.Class.ThrowOnInitFailure to false.

Again, it doesn't do this when I am deploying and debugging on the iPad

Finally, I have an error when I try to add ServiceStack.Text to the project. I have added the project as source code and I am compiling it and linking it into the project. I end up with an error about not knowing how to convert an instruction. If I don't have the AltusMapping project linked in then ServiceStack.Text links just fine. Here is the error that I get when they are both being linked into the project:

/Developer/MonoTouch/usr/bin/mtouch -sdkroot "/Applications/Xcode.app/Contents/Developer" --cache
"/Users/Sandbox/Phoenix/obj/iPhone/Debug/mtouch-cache" --nomanifest --nosign 
-dev "/Users/Sandbox/bin/iPhone/Debug/Sandbox.app" 
-r "/Users/Sandbox/MonoTouch.Dialog/bin/iPhone/Debug/MonoTouch.Dialog.dll" 
-r "/Users/Sandbox/Altus/Bindings/bin/Debug/Altus.dll" 
-r "/Users/Sandbox/ServiceStack.Text/ServiceStack.Text.MonoTouch/ServiceStack.Text.MonoTouch/bin/Debug/ServiceStack.Text.MonoTouch.dll" 
-r "/Developer/MonoTouch/usr/lib/mono/2.1/System.dll" 
-r "/Developer/MonoTouch/usr/lib/mono/2.1/System.Xml.dll" 
-r "/Developer/MonoTouch/usr/lib/mono/2.1/System.Core.dll" 
-r "/Developer/MonoTouch/usr/lib/mono/2.1/monotouch.dll" 
-r "/Developer/MonoTouch/usr/lib/mono/2.1/System.Runtime.Serialization.dll" 
-debug -linksdkonly -sdk "7.1" -targetver "7.0" --abi=armv7 "/Users/Sandbox/Phoenix/bin/iPhone/Debug/Phoenix.exe"

Xamarin.iOS 7.2.1 Business Edition using framework:
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS7.1.sdk
Process exited with code 1, command:
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang++  
-Objc -lc++ -lsqlite3 -Wl,-pie  -miphoneos-version-min=7.0 -arch armv7 -isysroot 
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS7.1.sdk  
/Users/Sandbox/Phoenix/obj/iPhone/Debug/mtouch-cache/Phoenix.exe.armv7.o 
/Users/Sandbox/Phoenix/obj/iPhone/Debug/mtouch-cache/monotouch.dll.armv7.o 
/Users/Sandbox/Phoenix/obj/iPhone/Debug/mtouch-cache/mscorlib.dll.armv7.o  
/Users/Sandbox/Phoenix/obj/iPhone/Debug/mtouch-cache/System.dll.armv7.o 
/Users/Sandbox/Phoenix/obj/iPhone/Debug/mtouch-cache/System.Core.dll.armv7.o 
/Users/Sandbox/Phoenix/obj/iPhone/Debug/mtouch-cache/Mono.Dynamic.Interpreter.dll.armv7.o 
/Users/Sandbox/Phoenix/obj/iPhone/Debug/mtouch-cache/System.Xml.dll.armv7.o 
/Users/Sandbox/Phoenix/obj/iPhone/Debug/mtouch-cache/Altus.dll.armv7.o 
/Users/Sandbox/Phoenix/obj/iPhone/Debug/mtouch-cache/MonoTouch.Dialog.dll.armv7.o 
/Users/Sandbox/Phoenix/obj/iPhone/Debug/mtouch-cache/System.Json.dll.armv7.o 
/Users/Sandbox/Phoenix/obj/iPhone/Debug/mtouch-cache/ServiceStack.Text.MonoTouch.dll.armv7.o 
/Users/Sandbox/Phoenix/obj/iPhone/Debug/mtouch-cache/System.Runtime.Serialization.dll.armv7.o 
/Users/Sandbox/Phoenix/obj/iPhone/Debug/mtouch-cache/registrar.armv7.o 
/Users/Sandbox/Phoenix/obj/iPhone/Debug/mtouch-cache/main.armv7.o 
/Users/Sandbox/Phoenix/obj/iPhone/Debug/mtouch-cache/AltusMappingEngine-iOS.a -o 
/Users/Sandbox/Phoenix/bin/iPhone/Debug/Phoenix.app/Phoenix -framework CFNetwork -framework QuartzCore 
-framework Foundation -framework CoreGraphics -framework CoreLocation -framework MapKit -framework UIKit 
-framework MessageUI -framework GLKit -framework OpenGLES -framework CoreText -lz -liconv -u _mono_pmip 
-u _monotouch_timezone_get_data -u _monotouch_log -u _monotouch_release_managed_ref 
-u _monotouch_create_managed_ref -u _xamarin_get_block_descriptor -u _CreateZStream -u _CloseZStream -u _Flush 
-u _ReadZStream -u _WriteZStream -u _monotouch_start_wwan 
/Developer/MonoTouch/SDKs/MonoTouch.iphoneos.sdk/usr/lib/libmonoboehm-2.0.a 
/Developer/MonoTouch/SDKs/MonoTouch.iphoneos.sdk/usr/lib/libmonotouch-debug.a

ld: don't know how to convert instruction ec11eaa0 referencing _mono_domain_get.island to thumb in 
'_ServiceStack_Text_CsvConfig_set_RowSeparatorString_string' from /Users/Sandbox/Phoenix/obj/iPhone/Debug/mtouch-
 cache/ServiceStack.Text.MonoTouch.dll.armv7.o for architecture armv7

clang: error: linker command failed with exit code 1 (use -v to see invocation)

error MT5309: Native linking error: don't know how to convert instruction ec11eaa0 referencing _mono_domain_get.island 
to thumb in '_ServiceStack_Text_CsvConfig_set_RowSeparatorString_string' from 
/Users/Sandbox/Phoenix/obj/iPhone/Debug/mtouch-cache/ServiceStack.Text.MonoTouch.dll.armv7.o for architecture armv7

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

Any ideas?

Cheers, Clint


Viewing all articles
Browse latest Browse all 204402

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>