[Mono-devel-list] Mono CVS compilation with MinGW

Albert Strasheim 13640887 at sun.ac.za
Tue Dec 16 16:36:07 EST 2003

Hello all,

I started experimenting with getting Mono from CVS to compile under MinGW 
today. I haven't seen this kind of setup documented anywhere on 
go-mono.com or elsewhere. It seems Cygwin is the currently the method of 

I am doing this setup on Windows Server 2003 with MSVS .NET 2003 
Academic installed. I am using the latest version of MinGW and MSYS, 
installed to C:\mingw and c:\msys respectively. I also installed the 
binutils, bison and libiconv packages provided by the MinGW project.

The following commands were all executed under the MSYS environment.

The Mono build requires pkg-config, which can be obtained from here:


You can also compile pkg-config from source (but this requires GLib 2, 
also available from the URL above). I followed the latter option after 
installed the glib and glib-dev zip files to c:\mingw. I installed 
pkg-config to c:\mingw (called /mingw under MSYS).

I had to copy /mingw/share/aclocal/pkg.m4 to /share/aclocal so that the 
configure file generated by autogen.sh could find the pkg-config macros. 
Not quite sure why MinGW doesn't check both directories (or maybe even 
only the former).

I also have to copy libiconv-2.dll to iconv.dll and libintl-2.dll to 
intl.dll in the /mingw/bin directory before pkg-config would run. Also 
pretty strange... probably an issue with MinGW's iconv?

I set up the MSVS environment by turning the vsvars32.bat file (in the 
Common7\Tools directory) include a shell script which I installed as 
/etc/profile.d/vs.sh (attached). This added csc.exe to the path.

I then executed autogen.sh (after applying mingw-autogen.patch, attached) 
in the mono directory (with sibling mcs):

./autogen --prefix=/opt --with-gc=included

I think did a make fullbuild.

Compilation died while compiling libgc, which I fixed with another patch 
(mingw-libgc.patch). With the patch, libgc seems to compile.

Next up, the compile failed while compiling mcs/jay, because mkstemp is 
not part of the Win32 API (I think?). I fixed this with another patch 

I also had to fix a few Makefiles because csc.exe seemed to get confused 
between command line options starting with / and directories. Replacing / 
with - for command line options all round seemed to do the trick. I think 
all the / arguments might have to be changed to - arguments in the 
Makefiles in order for MinGW to work... Thoughts?

Currently my compilation progreses until I receive the following error:

make[2]: Entering directory `/c/work/mono/mcs/class/System.Drawing'
make[2]: *** No rule to make target `System.Drawing.Printing/Duplex.cs', 
needed by `../../build/deps/System.Drawing.dll.stamp'.  Stop.
make[2]: Leaving directory `/c/work/mono/mcs/class/System.Drawing'
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory `/c/work/mono/mcs/class'

Any comments?


-------------- next part --------------
--- mono.orig/mono/libgc/win32_threads.c	Tue Aug 26 23:21:14 2003
+++ mono/mono/libgc/win32_threads.c	Tue Dec 16 18:30:04 2003
@@ -397,9 +397,9 @@
     LPVOID param;
 } thread_args;
-DWORD WINAPI thread_start(LPVOID arg);
+static DWORD WINAPI thread_start(LPVOID arg);
+GC_API HANDLE GC_CreateThread(
     LPSECURITY_ATTRIBUTES lpThreadAttributes, 
     DWORD dwStackSize, LPTHREAD_START_ROUTINE lpStartAddress, 
     LPVOID lpParameter, DWORD dwCreationFlags, LPDWORD lpThreadId )
-------------- next part --------------
--- mono.orig/mcs/jay/main.c	Tue May 20 23:06:47 2003
+++ mono/mcs/jay/main.c	Tue Dec 16 22:52:15 2003
@@ -91,7 +91,13 @@
 short **derives;
 char *nullable;
+#if defined(_WIN32) && !defined(__CYGWIN32__) && !defined(__CYGWIN__)
+extern char* mktemp();
+#define mkstemp mktemp
 extern char *mkstemp();
 extern char *getenv();
@@ -253,8 +259,12 @@
     int i, len;
     char *tmpdir;
+#if defined(_WIN32) && !defined(__CYGWIN32__) && !defined(__CYGWIN__)
+    tmpdir = ".";
     tmpdir = getenv("TMPDIR");
     if (tmpdir == 0) tmpdir = "/tmp";
     len = strlen(tmpdir);
     i = len + 13;
-------------- next part --------------
--- mono.orig/mono/autogen.sh	Fri Nov  7 23:05:39 2003
+++ mono/mono/autogen.sh	Tue Dec 16 21:32:47 2003
@@ -98,7 +98,7 @@
 if grep "^AM_PROG_LIBTOOL" configure.in >/dev/null; then
   if test -z "$NO_LIBTOOLIZE" ; then 
     echo "Running libtoolize..."
-    ${LIBTOOL}ize --force --copy
+    `basename ${LIBTOOL}ize` --force --copy
-------------- next part --------------
A non-text attachment was scrubbed...
Name: vs.sh
Type: application/x-sh
Size: 949 bytes
Desc: not available
Url : http://lists.ximian.com/pipermail/mono-devel-list/attachments/20031216/75918c32/attachment.sh 

More information about the Mono-devel-list mailing list