Compile Errors Under OS X

I made a sample program, and I tried to compile it with:

mcs Test.cs -r:Tao.Sdl.dll -r:Tao.OpenGl.dll

I then get this verbose output and I am not sure what it all means. Does anyone have any ideas?

** (/Library/Frameworks/Mono.framework/Versions/1.2.5.1/lib/mono/1.0/mcs.exe:147): WARNING **: The class System.Collections.Generic.Dictionary`2 could not be loaded, used in mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089

Unhandled Exception: System.TypeLoadException: Could not load type 'Tao.OpenGl.Gl' from assembly 'Tao.OpenGl, Version=2.1.0.4, Culture=neutral, PublicKeyToken=1ca010269a4501ef'.
at <0x00000>
at (wrapper managed-to-native) System.MonoType:GetMethodsByName (string,System.Reflection.BindingFlags,bool,System.Type)
at System.MonoType.GetMethods (BindingFlags bindingAttr) [0x00000]
at Mono.CSharp.MemberCache.AddMethods (BindingFlags bf, System.Type type) [0x00000]
at Mono.CSharp.MemberCache.AddMethods (System.Type type) [0x00000]
at Mono.CSharp.MemberCache..ctor (IMemberContainer container) [0x00000]
at Mono.CSharp.TypeHandle..ctor (System.Type type) [0x00000]
at Mono.CSharp.TypeHandle.GetTypeHandle (System.Type t) [0x00000]
at Mono.CSharp.TypeHandle.GetMemberCache (System.Type t) [0x00000]
at Mono.CSharp.TypeManager.MemberLookup_FindMembers (System.Type t, MemberTypes mt, BindingFlags bf, System.String name, System.Boolean& used_cache) [0x00000]
at Mono.CSharp.TypeManager.RealMemberLookup (System.Type invocation_type, System.Type qualifier_type, System.Type queried_type, MemberTypes mt, BindingFlags original_bf, System.String name, IList almost_match) [0x00000]
at Mono.CSharp.TypeManager.MemberLookup (System.Type invocation_type, System.Type qualifier_type, System.Type queried_type, MemberTypes mt, BindingFlags original_bf, System.String name, IList almost_match) [0x00000]
at Mono.CSharp.Expression.MemberLookup (System.Type container_type, System.Type qualifier_type, System.Type queried_type, System.String name, MemberTypes mt, BindingFlags bf, Location loc) [0x00000]
at Mono.CSharp.Expression.MemberLookup (System.Type container_type, System.Type qualifier_type, System.Type queried_type, System.String name, Location loc) [0x00000]
at Mono.CSharp.MemberAccess.DoResolve (Mono.CSharp.EmitContext ec, Mono.CSharp.Expression right_side) [0x00000]
at Mono.CSharp.MemberAccess.DoResolve (Mono.CSharp.EmitContext ec) [0x00000]
at Mono.CSharp.Expression.Resolve (Mono.CSharp.EmitContext ec, ResolveFlags flags) [0x00000]
at Mono.CSharp.Invocation.DoResolve (Mono.CSharp.EmitContext ec) [0x00000]
at Mono.CSharp.Expression.Resolve (Mono.CSharp.EmitContext ec, ResolveFlags flags) [0x00000]
at Mono.CSharp.Expression.Resolve (Mono.CSharp.EmitContext ec) [0x00000]
at Mono.CSharp.ExpressionStatement.ResolveStatement (Mono.CSharp.EmitContext ec) [0x00000]
at Mono.CSharp.StatementExpression.Resolve (Mono.CSharp.EmitContext ec) [0x00000]
at Mono.CSharp.Block.Resolve (Mono.CSharp.EmitContext ec) [0x00000]
at Mono.CSharp.While.Resolve (Mono.CSharp.EmitContext ec) [0x00000]
at Mono.CSharp.Block.Resolve (Mono.CSharp.EmitContext ec) [0x00000]
at Mono.CSharp.While.Resolve (Mono.CSharp.EmitContext ec) [0x00000]
at Mono.CSharp.Block.Resolve (Mono.CSharp.EmitContext ec) [0x00000]
at Mono.CSharp.EmitContext.ResolveTopBlock (Mono.CSharp.EmitContext anonymous_method_host, Mono.CSharp.ToplevelBlock block, Mono.CSharp.Parameters ip, IMethodData md, System.Boolean& unreachable) [0x00000]
at Mono.CSharp.EmitContext.EmitTopBlock (IMethodData md, Mono.CSharp.ToplevelBlock block) [0x00000]
at Mono.CSharp.MethodData.Emit (Mono.CSharp.DeclSpace parent) [0x00000]
at Mono.CSharp.Method.Emit () [0x00000]
at Mono.CSharp.TypeContainer.EmitType () [0x00000]
at Mono.CSharp.RootContext.EmitCode () [0x00000]
at Mono.CSharp.Driver.MainDriver (System.String[] args) [0x00000]
at Mono.CSharp.Driver.Main (System.String[] args) [0x00000]

And just some random information that may help:

  • I'm running OS X 10.5 Leopard
  • It's an Intel Mac
  • I installed the latest stable Mono from the website
  • I downloaded the latest Tao zip from the website and am using the Dll's already created for me (the ones under /bin/assemblies/)
  • My Test project's folder contains Test.cs, Tao.OpenGl.dll, Tao.OpenGl.xml, Tao.Sdl.dll, and Tao.Sdl.xml

Thanks for your help!

You should use gmcs (Mono's

You should use gmcs (Mono's .NET 2.0 compiler) instead of mcs (the .NET 1.0 compiler).

Thanks for the advice,

Thanks for the advice, SeaEagle1!

To get it to work, I also had to add this:

[dllmap dll="opengl32.dll" target="/System/Library/Frameworks/OpenGL.framework/OpenGL" /]
[dllmap dll="SDL.dll" target="/Library/Frameworks/SDL.framework/SDL" /]

(replace all [ ]'s with greater than and less than signs. The forum software removed them.)
to /Library/Frameworks/Mono.framework/Versions/Current/etc/mono/config

Then, I ran this:

gmcs Test.cs -addmodule:Tao.Sdl.dll,Tao.OpenGl.dll &&
macpack -r:Tao.Sdl.dll -r:Tao.OpenGl.dll -n:MyTest -a:Test.exe

to get the app bundle. Hopefully this helps someone, and thanks again SeaEagle1.

EDIT:
Does anyone know what command to use for macpack so the binary can run on machines without mono installed? Thanks again!

Theme by La Boite a site | Powered by Drupal