[Mono-list] Cygwin/Mono compilation problems

Piers Haken piersh@friskit.com
Fri, 10 May 2002 10:02:56 -0700

From: Stefan Matthias Aust [mailto:sma@3plus4.de] 
> BTW, the compiled mono.exe still doesn't run if I
> don't add the lib dir to the PATH. I know, on Windows,
> DLLs must be either in the same dir as the EXE or in the
> PATH.  However, cygwin being a Unix emulation should have
> this "feature" but cygwin programs should search there
> libs in the cygwin lib path.  Why does mono "misbehave"
> here?  Is there a good reason?

Remember: mono.exe isn't a cygwin executable. It's _built_ using the
cygwin environment but the makefiles throw the -mno-cygwin switch which
causes the final exe to be just a regular win32 exe linked to the
regular microsoft crt DLL.

That's probably why your '/usr/local' paths didn't work: according to
mono.exe the '/' directory is the root directory of the current drive,
eg 'c:\'

This is what I use:

export CPPFLAGS="$CPPFLAGS -I/usr/local/include"
export LDFLAGS="$LDFLAGS -I/usr/local/lib"
export CC="gcc -mno-cygwin"
./autogen.sh --prefix=c:/bin/cygwin/usr/local --with-gc=boehm
make && make install

NOTE: the --prefix= flag takes a windows path, not a cygwin path. I've
used forward '/'s because msvcrt.dll handles them and I don't have to
escape them, but 'c:\bin\cygwin' is the location of my cygwin root.

This assumes you've been able to build it before hand, ie you already
have the glib, iconv, boehm libraries installed and configured.