[Mono-list] Mercury on Mono (not successful)

Fergus Henderson fjh@cs.mu.OZ.AU
Thu, 27 Feb 2003 22:24:00 +1100


--8t9RHnE3ZwKMSgU+
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline

Now that I've got Mercury bootstrapping with .NET, I thought I'd try
running it on Mono 0.20.  Unfortunately I ran into several problems.

The first one is that Mono doesn't search the GAC.
OK, that one is easy to work around; just add the appropriate
directory to the PATH.

The second one is that Mercury and Mono both define a DLL named "gc.dll".
Putting the Mercury gc.dll first in the PATH causes `mono' to abort with
the error message

	mono.exe - Application Error

	The application failed ot initialize properly (0xc000007b).
	Click on OK to termiante the application

For a quick work-around I deleted the Mercury version of gc.dll,
and tried again. 

Unfortunately I still got a LOT of warning messages (8,591 of them)
of the form

	** (./hello.exe:3352): WARNING **: Could not load class from token
	0x0100002e in C:\cygwin\home\fjh\ws\hermes\samples\mono_test\array.dll
	...
	... lots more like that ...
	...
	** (./hello.exe:3304): WARNING **: Could not load class from token
	0x01000072 in C:\cygwin\home\fjh\ws\hermes\samples\mono_test\io.dll

and then another warning message

	** (./hello.exe:3304): WARNING **: Missing method
	do_unify__type_ctor_info_1_0 in assembly
	C:\cygwin\home\fjh\ws\hermes\samples\mono_test\mercury_il.dll
	typeref index 2

and then finally a window pops up reporting an assertion failure:

	** ERROR **: file jit.c: line 1221 (check_inlining):
	assertion failed (cm)
	aborting...

The code which produced this assertion failure is available at
<ftp://ftp.mercury.cs.mu.oz.au/pub/mercury/mono-test/>.

I also tried using the `ilasm' on the IL generated by the Mercury compiler.
That failed too, with the following error message:

	Unhandled Exception: Mono.ILASM.ILSyntaxError: Bad number format!
	   at Mono.ILASM.NumberHelper.Build()
	   at Mono.ILASM.ILTokenizer.GetNextToken()
	   at Mono.ILASM.ILTokenizer.get_NextToken()
	   at Mono.ILASM.ScannerAdapter.advance()
	   at Mono.ILASM.ILParser.yyparse(yyInput yyLex)
	   at Mono.ILASM.ILParser.yyparse(yyInput yyLex, Object yyd)
	   at Mono.ILASM.DriverMain.ProcessFile(String file_path)
	   at Mono.ILASM.DriverMain.Run()
	   at Mono.ILASM.Driver.Main(String[] args)
	(null)

A small IL file which demonstrates the problem is attached.  I think
mono's ilasm.exe doesn't like the hexadecimal notation used in the
".publickeytoken" directives.  I haven't checked the ECMA spec, but
this syntax is accepted by both the Microsoft and Portable.NET versions
of ilasm.exe.

-- 
Fergus Henderson <fjh@cs.mu.oz.au>  |  "I have always known that the pursuit
The University of Melbourne         |  of excellence is a lethal habit"
WWW: <http://www.cs.mu.oz.au/~fjh>  |     -- the last words of T. S. Garp.

--8t9RHnE3ZwKMSgU+
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename="h.il"

//
// Automatically generated from `hello.m' by the
// Mercury compiler, version rotd-2003-02-13, configured for i686-pc-cygwin.
// Do not edit.



.assembly 'hello' { }

.assembly extern 'mercury'{
.ver 0:0:0:0
	.publickeytoken = ( 22 8C 16 7D 12 AA B B ) 
	
}


.assembly extern 'mscorlib'{
.ver 1:0:3300:0
	.publickeytoken = ( B7 7A 5C 56 19 34 E0 89 ) 
	
}


.assembly extern 'mscorlib'{

}

--8t9RHnE3ZwKMSgU+--