[Mono-dev] Compiling mono on windows for developing (not running)

Konaju Games (Dev) dev at konaju.com
Mon May 5 02:44:00 UTC 2014


Any version of git can be used.  Use the following to make sure the line
endings are correct by using core.autocrlf=input.

git clone https://github.com/mono/mono.git --config core.autocrlf=input

With Cygwin, there is one change to make to etc/fstab before starting a
build.  You need to add noacl to the cygdrive mount.  Without this change,
any files created by a Win32 process outside of Cygwin will result in
Cygwin having no permissions to do anything with the files.
http://georgik.sinusgear.com/2012/07/14/how-to-fix-incorrect-cygwin-permission-inwindows-7/





On 5 May 2014 12:20, Alex J Lennon <ajlennon at dynamicdevices.co.uk> wrote:

>  Ned,
>
> On 04/05/2014 23:11, Edward Ned Harvey (mono) wrote:
>
>  From: mono-devel-list-bounces at lists.ximian.com [mailto:mono-devel-list <mono-devel-list>-bounces at lists.ximian.com] On Behalf Of Miguel de Icaza
>
> To build Mono on Windows, you will need to use Cygwin to build you entire
> stack.   Cygwin is a Unix-on-Windows system that will let you properly build
> Mono.
>
>  Any pointers on how to get that to work?  I am nothing, if not helpful at documenting some process and then sharing it for others - I was motivated to get this working, I spent about a day on it last Sunday, and failed.  I never got a successful build.
>
> I tried cygwin 32 bit, 64 bit...  I tried git checkout with sourcetree somewhere on C: but I found there were line endings problems, and I found some things on the internet suggest you need to use cygwin binaries (install cygwin git) to checkout to a cygwin mount (for example in your home directory) and in fact, I found that solved the line endings problem, so I think that was a good move...
>
>
> This is where I arrived at yesterday. I now have Mono compiled on Windows
> from the 3.4.0 release tarball and yesterday's Git master commit.
>
> NB. There was a problem with my previous set of instructions. /usr/local
> must not be mounted during the build or it seems to result in libiconv
> errors. Instead it should be mounted just before the install.
>
> Best Regards,
>
> Alex
>
> ------------------------------
>
> Building Mono on Win32/Cygwin
> =============================
>
> (1) Install Cygwin
>
> Run setup-x86.exe to install Cygwin   -
> http://www.cygwin.com/setup-x86.exe
>
> Follow instructions from "Compiling Mono on Windows" to install needed
> packages
>
> http://www.mono-project.com/Compiling_Mono_on_Windows
>
> autoconf
> automake
> bison
> gcc-core
> gcc-g++
> mingw-gcc
> libtool,
> make
> python,
>
> Nice to have's
>
> + wget, zip patch, openssh, vim
>
> NOTE: In addition to this you will need the following as per these
> instructions
>
>
> http://www.codeproject.com/Articles/19575/Building-Mono-on-Windows-the-final-battle
>
> gettext-devel
> intltool
> libiconv
> pkg-config
>
> 2) Install working Mono binaries
>
> Use the installation executable from go-mono.com, at time of writing:
>
>
> http://download.mono-project.com/archive/3.2.3/windows-installer/mono-3.2.3-gtksharp-2.12.11-win32-0.exe
>
> For me this gives a working Mono in C:\Program Files (x86)\Mono-3.2.3 on a
> Windows 8.1 / x64 host
>
>
> (3) Grab new Mono sources
>
> ------------------------------
>
> (a) From source tarball
> ====================
>
> (i) Download and Extract
>
> Download the tarball you wish to use from
> http://download.mono-project.com/sources/mono/
>
> At the time of writing we are using 3.4.0:
> http://download.mono-project.com/sources/mono/mono-3.4.0.tar.bz2
>
> Do not extract the source tarball with native Window tools as this appears
> to affect line endings, which will cause problems.
>
> To extract within Cygwin first run the Cywgin environment (Cygwin terminal
> on your start bar) and extract with,
>
> tar xjvf mono-3.4.0.tar.bz2
>
> This will give you a mono-3.4.0 directory
>
> (ii) Create baseline destination
>
> Create a destination folder, where we are going to install the newly built
> Mono, in this case C:\Mono-3.4.0
>
> Copy across files from your existing installation (e.g. Mono-3.2.3) to the
> 3.4.0 folder to give us a baseline
>
> NOTE: It is important not to have spaces in the path as otherwise the Mono
> build will fail, so we're putting this in the root of C: for this example
>            (From my reading it is also likely to be important not to have
> Windows user names with spaces in them, so a heads-up there...)
>
> (iii) Autogen the build
>
> ./autogen.sh --prefix="C:\Mono-3.4.0" --with-preview=yes
>
> (iv) Configure the build
>
> ./configure --host=i686-pc-mingw32
>
> At the end of this process, with the defaults, you should see something
> like
>
>         mcs source:    mcs
>
>    Engine:
>         GC:            sgen and bundled Boehm GC with typed GC and
> parallel mark
>         TLS:           pthread
>         SIGALTSTACK:   no
>         Engine:        Building and using the JIT
>         oprofile:      no
>         BigArrays:     no
>         DTrace:        no
>         LLVM Back End: no (dynamically loaded: no)
>
>    Libraries:
>         .NET 2.0/3.5:  yes
>         .NET 4.0:      yes
>         .NET 4.5:      yes
>         MonoDroid:     no
>         MonoTouch:     no
>         Xamarin.Mac:   no
>         JNI support:   no
>         libgdiplus:    assumed to be installed
>         zlib:          system zlib
>
> (v) We're ready to build mono
>
> You can go ahead and try 'make' now but at the time of writing
> (03/05/2014) there is a problematical interaction between the Cygwin
> headers and the Mono build
>
> This will lead to an error along the lines of,
>
> /usr/i686-pc-mingw32/sys-root/mingw/include/ddk/ntapi.h:49:15: error:
> conflicting types for 'PEXECUTION_STATE'
> In file included from
> /usr/i686-pc-mingw32/sys-root/mingw/include/windows.h:62:0,
>                  from
> /usr/i686-pc-mingw32/sys-root/mingw/include/winsock2.h:40,
>                  from ../../mono/io-layer/io-layer.h:24,
>                  from ../../mono/metadata/domain-internals.h:15,
>                  from ../../mono/metadata/metadata-internals.h:8,
>                  from ../../mono/metadata/class-internals.h:10,
>                  from ../../mono/metadata/object-internals.h:8,
>                  from process.c:16:
>
> A workaround is to edit the Cygwin header file ntapi.h (e.g.
> C:\cygwin\usr\i686-pc-mingw32\sys-root\mingw\include\ddk\ntapi.h) to rename
> PEXECUTION_STATE to PEXECUTION_STATE_KLUDGE, say.
>
> Then,
>
> make
>
> (this will take some time )
>
> NOTE: There seems to be an intermittent issue linking against libiconv
> (even when present) relating to shared libraries.
>
> If you see this try,
>
> make clean
> make
>
> (vi) Install mono
>
> Mount your destination folder under Cygwin as /usr/local with
>
> mount "C:\Mono-3.4.0" /usr/local
>
> NOTE: Do not have /usr/local mounted when performing the previous make
> step or you will see the following build error:
>             *** Warning: Trying to link with static lib archive
> /usr/local/lib/libiconv.a.
>
> As a check you can 'ls /usr/local' which should show the files that you
> have in C:\Mono-3.4.0
>
> ...
>
> At the time of writing (04/05/2014) there is a missing file in the Mono
> 3.4.0 release tarball. This causes installation failure.
>
> ref:
> http://stackoverflow.com/questions/22844569/build-error-mono-3-4-0-centos
>
> To add the missing file create a new file in  mcs/tools/xbuild/targets/
> called Microsoft.Portable.Common.targets
>
> This should contain the following
>
> <Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003"<http://schemas.microsoft.com/developer/msbuild/2003>
> >
> <Import Project="..\Microsoft.Portable.Core.props" />
> <Import Project="..\Microsoft.Portable.Core.targets" />
> </Project>
>
> Then ensure that /usr/local is correctly mounted as per 3(b)(ii) and run
>
> make install
>
> (vii) Fix "missing" mono.exe
>
> The installation removes the existing mono.exe from the C:\Mono-3.4.0\bin
> directory and does not seem to copy across a new version
>
> Within the Cygwin environment there is a "mono.exe" which is a symbolic
> link to mono-sgen.exe, which is rebuilt.
>
> So, assuming that under Win32 the mono.exe is a stub executable (which it
> seems to be as it is small) it should be reasonable to copy
> across mono.exe from the older mono installation
>
> e.g. Copy C:\Program Files (x86)\Mono-3.2.3\bin\mono.exe to
> C:\Mono-3.4.0\bin
>
> (vii) Check installation
>
> Open a Windows cmd box, cd to C:\Mono-3.4.0 and run
>
> mono --version
>
> This should show something like
>
> Mono JIT compiler version 3.4.0 (tarball)
> Copyright (C) 2002-2014 Novell, Inc, Xamarin Inc and Contributors.
> www.mono-project.com
>         TLS:           normal
>         SIGSEGV:       normal
>         Notification:  Thread + polling
>         Architecture:  x86
>         Disabled:      none
>         Misc:          softdebug
>         LLVM:          supported, not enabled.
>         GC:            sgen
>
> (viii) Enable Xamarin Studio to add the new Mono runtime
>
> If you to to Xamarin Tools->Options and try to add the Mono-3.4.0 folder
> it will fail to detect Mono.
>
> This is because of the presence of an installed symlink file, bin\mono
>
> So, for example, delete the file C:\Mono-3.4.0\bin\mono and you will then
> be able to add the runtime to Xamarin Studio
>
> There is an archive of the binaries resulting from my build here,
>
> http://www.dynamicdevices.co.uk/downloads/Mono-3.4.0.zip
>
> NOTE: That Mono 3.x fails to build projects for me with recent Xamarin
> Studio builds giving the error
>
> Build failed. Could not find type 'System.Globalization.SortVersion'.
>
> This appears to be addressed in this commit which is not present in 3.4.0
>
>
> http://stackoverflow.com/questions/23448795/build-failed-could-not-find-type-system-globalization-sortversion
>
> The workaround is to use an older version of Xamarin Studio as discussed
> here
>
>
> http://stackoverflow.com/questions/23448795/build-failed-could-not-find-type-system-globalization-sortversion
>
> i.e. Download Xamarin Studio 4.2.3 from your account at Xamarin.com with
> "view all versions"
>
> NOTE: You may then get a build error about UNC paths
>
> error : Error building target GetReferenceAssemblyPaths: UNC paths should
> be of the form \\server\share.
>
> This appears to relate to extra \\'s in configuration files as discussed
> here
>
>
> http://stackoverflow.com/questions/19933266/error-building-c-sharp-solution-using-xbuild-mono
>
> The workaround is to go to project options and unback "Use MSBuild engine"
> at which point you will be able to compile and debug applications
>
> ------------------------------
>
> (b) From Git repository
> ====================
>
> (i) Checkout Mono using Git within Cygwin. Don't use Subversion as I have
> seen build problems which I think are because sub-modules are not checked
> out with Subversion.
>
> e.g.
>
> cd c:/
> git clone git://github.com/mono/mono.git
>
> NOTE: We are working with Git rev
> 47db8f756f409cd56d207b550ead42a156ad5a01 at present
>
> (This will take some time and checkout to a mono folder)
>
> (ii)
>
> From here the steps are similar to those above. i.e. Follow the above
> steps in (a) (ii) - (v) to create a baseline, autogen, configure and make
>
> NOTE: Ensure /usr/local is not mounted for the build, as discussed above
>
> NOTE: As in the build instructions for the Mono 3.4.0 source archive,
> above, you will need to rename the Cygwin header variable definition
> PEXECUTION_STATE in the file
> C:\cygwin\usr\i686-pc-mingw32\sys-root\mingw\include\ddk\ntapi.h to
> something else e.g. PEXECUTION_STATE_KLUDGE.
>
> e.g. With baseline copy of older mono in C:\Mono-3.4.0
>
> ./autogen.sh --prefix="C:\Mono-3.4.0" --with-preview=yes
> ./configure --host=i686-pc-mingw32
> make
>
> (this will take some time)
>
> mount "C:\Mono-3.4.0" /usr/local
> make install
>
> Copy across mono.exe to bin folder from older installation
> Delete mono file in bin folder
>
> There's an archive of binaries for 3.4.10-master-47db8f7 here
>
> ------------------------------
>
>
> _______________________________________________
> Mono-devel-list mailing list
> Mono-devel-list at lists.ximian.com
> http://lists.ximian.com/mailman/listinfo/mono-devel-list
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.ximian.com/pipermail/mono-devel-list/attachments/20140505/5cdfd97c/attachment-0001.html>


More information about the Mono-devel-list mailing list