I'm trying to build a game for iOS with XNA and Farseer Physics 3.3, using ExEn and MonoTouch. In theory this should work fine, but I'm having trouble getting Farseer to work on the iPhone.
I compiled Farseer for MonoTouch/ExEn, and it works great in the iPhone Simulator. But as soon as I switch to the actual iPhone, my project no longer compiles. The problem appears to be happening with the MonoDevelop linker. The compiler bombs out with the message "mtouch exited with code 1", and I get the following linker error output: http://pastebin.com/y62ykJP2. If I disable linking in the project options, the application compiles and deploys to the iPhone, but then crashes.
If I comment out all of the code that instantiates objects defined by Farseer, I don't get any linker errors, and the program deploys and runs just fine. So the problem is clearly with my build of Farseer for MonoTouch.
Unfortunately, I have no idea where to go from here. Where should I start looking with a linker error like this? Or, even better: Has anyone successfully compiled Farseer 3.3 and used it with MonoTouch and ExEn?
You're trying to use an assembly compiled for .NET 4.0 in MonoTouch. This will not work (the linker exception you get is because the assembly references a method that does not exist in MonoTouch).
The solution is to compile all assemblies you reference using MonoTouch. Look around to see if anybody already has created a MonoTouch project for Farseer, otherwise you'll have to create one yourself.
Related
#miguel.de.icaza blogged about using Instruments to profile Mac apps built with Mono. However, that blog post was about executables run from the command line, not about .app bundles.
The key point in the above blog post is that the app must be compiled with the AOT switch so that the static symbols are meaningful to Instruments. We've been trying to use the same approach to run Instruments against a Mac .app bundle, and have run into issues.
We've tried running
~/dev/foo/bin/debug> MONO_ENV_OPTIONS="--debug --aot"
./foo.app/Contents/MacOS/foo
but the app compiles to a .dylib rather than a native executable:
Generating debug symbols: dsymutil /Users/bright/dev/foo/bin/Debug/foo.app/Contents/MonoBundle/foo.exe.dylib
We're unsure how to correctly compile this.
Has anyone managed to get Instruments to work with Xamarin.Mac bundles? This must be a pretty common need.
I want to use the Novell.Directory.Ldap library in a MonoTouch and Mono For Android project.
http://www.novell.com/coolsolutions/feature/11204.html
When I compile my project in iOS simulator modus, It compiles without errors and runs correctly (in the iOS simulator).
When I compile my project in iOS device modus (to test the app with a physical device), I get this error:
Error MT2002: Failed to resolve "System.Void System.Security.Cryptography.RNGCryptoServiceProvider::.ctor(System.Byte[])" reference from "mscorlib, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" (MT2002) (MyProject)
How could I solve this problem? I can't find a solution.
Should this library work for MonoTouch and Mono For Android?
Are there better LDAP solutions for Mono?
UPDATE: I just tested it with Mono For Android. This works fine.
There's three questions in there, so I splitted my answers in three. Please read all of them :-)
How could I solve this problem?
This is a general problem with a general solution to solve it.
The code you compiled is including a reference to "mscorlib, Version=1.0.5000.0
That's likely because you did not use the compiler provided with Xamarin.iOS (MonoTouch), named smcs, to build the assembly. That compiler would set the references to use the right mscorlib.dll assembly (and report anything missing in the MOBILE profile).
The fact that it can work for Xamarin.Android is that it uses the JIT (just in time compilation), so missing members won't be found before runtime (and if execution reach that code).
OTOH Xamarin.iOS uses AOT (ahead of time compilation) since JIT'ing is not allowed (by Apple) on devices. That means missing members are found at build time. In this case the (managed) linker can't find the reference and issue the MT2002 error.
So the solution is to re-build the assembly using smcs and fix, if any, build time errors. E.g. IIRC that RNGCryptoServiceProvider ctor is not available (and does nothing since seeding is not possible) and should be replaced with the default ctor.
Should this library work for MonoTouch and Mono For Android?
It should. However my personal experience with Novell.Directory.Ldap was not really good (code and design issues, e.g. threading, in particular with SSL enabled).
Also the code has not been updated for quite a while. You might be better served at looking at (managed or native) alternatives for your LDAP needs.
Are there better LDAP solutions for Mono?
Sadly I have not used any other similar library so I can't suggest alternatives (but maybe other people will be able to help).
The problem is solved.
Instead of using the dll from Novell, I downloaded all the source files of the Novell LDAP library and put them into a new library project. Then I made a reference to that library from my own Mono project.
While compiling my project and the library project, I received some errors from the library project. After solving these errors manually, it works fine for both (MonoTouch and Mono for Android).
I have an iPhone project that I want to use libcsoap in to make service calls. I'm having trouble linking a pure c library to xCode though. I've tried everything short of manually rebuilding the project as an Xcode project.
I built it via command line (./configure; make; make install). Then linked the output (libcsoap.a) and connected to the headers. This gave me a linker error saying that libcsoap.a was built for archiving and couldn't be used.
I tried creating a project out of just the makefile but that failed to build.
Can anybody explain to me what I should do to link these?
Thanks in advance,
George
I'm trying to build some GHUnit tests based on an iOS application I have which uses ProtocolBuffers, accessed as a library. I've run into lots of linker problems which I've slowly killed off by adding the source files from the application to the "Compile Sources" build phase, but now that I've added everything relevant in the application, I have found that I can't seem to link against ProtocolBuffers.
I have read GH-Unit for unit testing Objective-C code, why am I getting linking errors? wherein the poster seems to have fixed his situation based on the README update at the bottom. Since I have a hybrid - I am linking GHUnit against both an application and a library, I started with the assumption that I should add the ProtocolBuffers output as a dependency in addition to adding all the application source files to my "Compile Sources" build phase.
This hasn't worked. I continue to get linker errors which clearly show that the linker isn't finding symbols from the ProtocolBuffers library. I can't add the ProtocolBuffers source files because they're not in this project, and even adding #import "ProtocolBuffers.h" to my tests.pch file doesn't work.
I'm now stumped. Any suggestions? GHUnit looks great but, as it seems to always be with Xcode/ObjC testing tools, getting to "Hello World" is more trouble that I would expect.
Here's my situation: I have the source code for a third-party framework that I want to include in my project. I'm developing on 10.6 but I want to support 10.5, so I have the base SDK and the deployment target set to 10.5.
I can build the framework and the application, and the app runs inside Xcode and on the machine. However, it fails on a 10.5.8 and crashes. The crash report says
Unknown required load command 0x80000022
I have also tried building the framework on the 10.5.8 machine, setting the architecture to '32/64-bit Universal'. Moving this framework to the 10.6 machine and attempting to build the app works, but the app fails to run, throwing multiple errors of:
-[NSCFArray matchAndAssemble:]: unrecognized selector sent to instance 0x3503c0
Has anyone seen this before? Do you know of a fix or workaround? It can't be an uncommon situation.
The loader command being flagged is the loader command for a compressed binary which is a binary type supported only on 10.6.
matchAndAssemble: is not a (documented) method of NSArray/NSMutableArray. It is, however, a method of the PKParser kit. Is that the framework you are trying to build?
Anyhow, something in your project is being built only for 10.6 and it's probably that framework. Check the build settings for all of your targets, and any targets of any sub projects and do an otool -l on any third party frameworks to look for the 22 load command.
Answer for the first error: unable to read unknown load command 0x80000022 - Stack Overflow, and it might have a bearing on the second error. What version Xcode and SDK are you using?