[Mono-dev] Cannot compile mono or mcs, please help

David Piepgrass qwertie256 at gmail.com
Mon Sep 25 21:07:42 EDT 2006

As a school project, I have decided to add unit checking to C# using
annotations in comments. With this feature, you would potentially be able to
write code like this...

double average(IList<double> list)
    double total = 0;
    for (int i = 0; i < list.Count; i++)
        total += list[i];
    return total / list.Count;

...and the compiler could automatically deduce that the return value has the
same units as the elements of the list.

Similarly you could write this function with an annotation in a comment...

double get_volume_of_sphere(double radius)
    // units: radius metres, return metres^3
    return (4.0/3.0*PI) * (radius*radius);

...and the compiler could automatically detect the unit error in the
formula. It could also work with polymorphic units like so:

double get_volume_of_sphere(double radius)
    // units: radius d1, return d1^3
    // ("d1" represents any unit, e.g. feet, millimetres, etc.)

I was hoping I could use gmcs as a starting point, assuming I could figure
out how the code works.  Unfortunately, I can't even figure it out well
enough to compile it.

I have tried the following compiling methods (on Win32):

1) Checking out the mcs tree from Subversion and using mcs.sln and gmcs.sln.
This is a non-starter. In the case of mcs, cs-parser.cs and Consts.cs are
missing; and in the case of gmcs, MOST of the source files are missing!

2) Following the instructions to build mono.
- I downloaded mono- from http://go-mono.com/sources-latest/
- I downloaded Cygwin and installed all the dependencies mentioned in the
"Windows Compilation" section at http://www.mono-project.com/Compiling_Mono,
including the "other dependencies".
- I ran do-install-zip-pkgs according to the instructions, and it seemed to
- I ran ./configure in the main folder, mono- It failed while
attempting to run "/lib/cpp" (/lib/cpp did not exist) so I installed g++
from the cygwin setup program. It failed again and I ended up installing
glib and pkgconfig from the cygwin setup program. I tried again and it
seemed to work.
- I ran "make" within the main folder, mono- After 5 or 10 minutes
it failed with (IIRC!) "[sample.c] Error 128".
- I ran env.sh (the instructions aren't clear about the need to run this).
- I ran "make" again.  After about 10 minutes it failed with this output:

Making all in mini
make[3]: Entering directory `/cygdrive/d/Dev/University/ENCM599/mono-'
../../mono/monoburg/monoburg -c 1 -p -e ./inssel.brg ./inssel-float.brg./inssel-
long32.brg ./inssel-x86.brg -d inssel.h
 -s inssel.c
make[3]: *** [inssel.c] Error 128
make[3]: Leaving directory `/cygdrive/d/Dev/University/ENCM599/mono-'
make[2]: *** [all-recursive] Error 1
make[2]: Leaving directory `/cygdrive/d/Dev/University/ENCM599/mono-'
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory `/cygdrive/d/Dev/University/ENCM599/mono-
make: *** [all] Error 2

3) Compiling the mcs directory only.
- I ran "make" in the mcs folder, but it failed quickly.  The output (shown
below) suggests an error in the grammar, which is surely not the real

make[2]: Entering directory `/cygdrive/d/Dev/University/ENCM599/mono-'
../jay/jay -ctv < ../jay/skeleton.cs cs-parser.jay > jay-tmp.out && mv
jay-tmp.out cs-parser.cs
../jay/jay: 5 rules never reduced
../jay/jay: 30 shift/reduce conflicts, 1 reduce/reduce conflict.
Creating ../build/deps/mcs.exe.response ...
make[2]: *** No rule to make target
`../class/Mono.CompilerServices.SymbolWriter/MonoSymbolFile.cs', needed by
/lib/default/mcs.exe'.  Stop.
make[2]: Leaving directory `/cygdrive/d/Dev/University/ENCM599/mono-'
make[1]: *** [do-all] Error 2
make[1]: Leaving directory `/cygdrive/d/Dev/University/ENCM599/mono-'
make: *** [all-recursive] Error 1

At this point I feel like my best best is manual compilation, but I am very

- Why can't I find the Jay, the "C# port of yacc"?  The "mcs/jay" folder
only contains a C program.  I think Jay is required to build cs-parser.cs,
- What is Consts.cs and how does one build it?
- Why are so many source files missing from gmcs in Subversion?
- Why doesn't mono- contain a gmcs directory at all?

Finally, I would like the opinion of this list. Is modifying gmcs a good
approach for my project, or should I attempt to make my own unit-checking
tool?  The latter would require writing a C# parser and partial semantic
analyzer, which is probably very hard; but on the other hand, it may (or may
not) be very hard to integrate unit checking into gmcs.

- David
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.ximian.com/pipermail/mono-devel-list/attachments/20060925/eb87ef71/attachment.html 

More information about the Mono-devel-list mailing list