./README-builds.html

Print this page
rev 406 : Enable OpenJDK builds on Windows with MinGW/MSYS

@@ -93,11 +93,12 @@
                                         <li><a href="#alsa">ALSA files</a> </li>
                                     </ul>
                                 </li>
                                 <li>Windows only:
                                     <ul>
-                                        <li>Unix Command Tools (<a href="#cygwin">CYGWIN</a>)</li>
+                                        <li>Unix Command Tools (<a href="#cygwin">CYGWIN</a>) <strong>or</strong></li>
+                                        <li>Minimalist GNU for Windows (<a href="#msys">MinGW/MSYS</a>)</li>
                                         <li><a href="#dxsdk">DirectX 9.0 SDK</a> </li>
                                     </ul>
                                 </li>
                             </ul>
                         </li>

@@ -677,35 +678,26 @@
                     could be 3.80, you need 3.81, in which case,
                     see the <a href="#buildgmake">"Building GNU make"</a> section.
                 </li>
                 <li>
                     <strong>Windows:</strong>
-                    Make sure you start your build inside a bash/sh/ksh shell
-                    and are using a <tt>make.exe</tt> utility built for that
-                    environment (a cygwin <tt>make.exe</tt> is not the same
-                    as a <tt>make.exe</tt> built for something like
-                    <a href="http://www.mkssoftware.com/">MKS</a>). 
-                    <br>
-                    <b>WARNING:</b> Watch out on some make 3.81 versions, it may
-                    not work due to a lack of support for MS-DOS drive letter paths
-                    like <tt>C:/</tt> or <tt>C:\</tt>.
-                    <br>
-                    You may be able to use the information at the
-                    <a href="http://developer.mozilla.org/en/docs/Windows_build_prerequisites_using_cygwin#make" target="_blank">
-                        mozilla developer center</a>
-                    on this topic.
-                    <br>
-                    It's hoped that when make 3.82 starts shipping in a future cygwin
-                    release that this MS-DOS path issue will be fixed.
-                    <br>
-                    It may be possible to download the version at
-                    <a href="http://www.cmake.org/files/cygwin/make.exe">
-                        www.cmake.org make.exe</a>.
-                    <br>
-                    It might be necessary for you to build your own GNU make 3.81,
-                    see the <a href="#buildgmake">"Building GNU make"</a> section
-                    in that case.
+                    Make sure you start your build inside a bash/sh/ksh shell and are
+                    using a <tt>make.exe</tt> utility built for that
+                    environment.<br/>
+                    <strong>MKS</strong> builds need
+                    a native Windows version of GNU make
+                    (see <a href="#buildgmake">Building GNU make</a>).<br/>
+                    <strong>Cygwin</strong> builds need
+                    a make version which was specially compiled for the Cygwin environment
+                    (see <a href="#buildgmake">Building GNU make</a>). <strong>WARNING:</strong>
+                    the OpenJDK build with the make utility provided by Cygwin will <strong>not</strong>
+                    work because it does not support drive letters in paths. Make sure that
+                    your version of make will be found before the Cygwins default make by 
+                    setting an appropriate <tt>PATH</tt> environment variable or by removing
+                    Cygwin's make after you built your own make version.<br/>
+                    <strong>MinGW/MSYS</strong> builds you can use the default make which 
+                    comes with the environment.
                 </li>
             </ul>
             <p>
                 Information on GNU make, and access to ftp download sites, are
                 available on the

@@ -717,11 +709,11 @@
                     ftp.gnu.org/pub/gnu/make/</a>.
             </p>
             <!-- ------------------------------------------------------ -->
             <h4><a name="buildgmake">Building GNU make</a></h4>
             <blockquote>
-                First step is to get the GNU make 3.81 source from
+                First step is to get the GNU make 3.81 (or newer) source from
                 <a href="http://ftp.gnu.org/pub/gnu/make/" target="_blank">
                     ftp.gnu.org/pub/gnu/make/</a>.
                 Building is a little different depending on the OS and unix toolset
                 on Windows:
                 <ul>

@@ -732,16 +724,28 @@
                     <li>
                         <strong>Solaris:</strong>
                         <tt>./configure && gmake CC=gcc</tt>
                     </li>
                     <li>
-                        <strong>Windows for CYGWIN:</strong>
-                        <tt>./configure && make</tt>
-                    </li>
-                    <li>
-                        <strong>Windows for MKS: (CYGWIN is recommended)</strong>
-                        <tt>./configure && make -f Makefile.win32</tt>
+                        <strong>Windows for CYGWIN:</strong><br/>
+                        <tt>./configure</tt><br/>
+                        Add the line <tt>#define HAVE_CYGWIN_SHELL 1</tt> to the end of <tt>config.h</tt><br/>
+                        <tt>make</tt><br/>
+                        <br/>
+                        This should produce <tt>make.exe</tt> in the current directory.
+                    </li>
+                    <li>
+                        <strong>Windows for MKS: </strong><br/>
+                        Edit <tt>config.h.W32</tt> and uncomment the line <tt>#define HAVE_MKS_SHELL 1</tt><br/>
+                        Set the environment for your native compiler (e.g. by calling:<br/>
+                        <tt>"C:\Program Files\Microsoft SDKs\Windows\v7.1\Bin\SetEnv.cmd" /Release /xp /x64)</tt>
+                        <tt>nmake -f NMakefile.win32</tt>
+                        <br/>
+                        This should produce <tt>WinDebug/make.exe</tt> and <tt>WinRel/make.exe</tt>
+                        <br/>
+                        If you get the error: <tt>NMAKE : fatal error U1045: spawn failed : Permission denied</tt>
+                        you have to set the <tt>Read &amp; execute</tt> permission for the file <tt>subproc.bat</tt>.
                     </li>
                 </ul>
             </blockquote>
         </blockquote>
         <!-- ------------------------------------------------------ -->

@@ -884,43 +888,140 @@
         </blockquote>
         <!-- ------------------------------------------------------ -->
         <h4><a name="paths">Windows Paths</a></h4>
         <blockquote>
             <strong>Windows:</strong>
-            Note that GNU make is a historic utility and is based very
-            heavily on shell scripting, so it does not tolerate the Windows habit
+            Note that GNU make, the shell and other Unix-tools required during the build
+            do not tolerate the Windows habit
             of having spaces in pathnames or the use of the <tt>\</tt>characters in pathnames.
             Luckily on most Windows systems, you can use <tt>/</tt>instead of \, and
-            there is always a 'short' pathname without spaces for any path that 
-            contains spaces.
-            Unfortunately, this short pathname can be somewhat dynamic and the
-            formula is difficult to explain.
-            You can use <tt>cygpath</tt> utility to map pathnames with spaces
-            or the <tt>\</tt>character into the <tt>C:/</tt> style of pathname
-            (called 'mixed'), e.g.
-            <tt>cygpath -s -m "<i>path</i>"</tt>.
+            there is always a short <a href="http://en.wikipedia.org/wiki/8.3_filename">
+            "8.3" pathname</a> without spaces for any path that contains spaces.
+            Unfortunately, this short pathname is somewhat dynamic (i.e. dependant on the
+            other files and directories inside a given directory) and can not be 
+            algorithmicly calculated by only looking at a specific path name.
             <p>
                 The makefiles will try to translate any pathnames supplied
                 to it into the <tt>C:/</tt> style automatically.
+            </p>
+            <p>
+                Special care has to be taken if native Windows applications
+                like <tt>nmake</tt> or <tt>cl</tt> are called with file arguments processed
+                by Unix-tools like <tt>make</tt> or <tt>sh</tt>!
+            </p>
+        </blockquote>
+        <!-- ------------------------------------------------------ -->
+        <h4><a name="paths">Windows build environments</a></h4>
+        <blockquote>
+            Building on Windows requires a Unix-like environment, notably a Unix-like shell.
+            There are several such environments available of which 
+            <a href="http://www.mkssoftware.com/products/tk/ds_tkdev.asp">MKS</a>, 
+            <a href="http://www.cygwin.com/">Cygwin</a> and 
+            <a href="http://www.mingw.org/wiki/MSYS">MinGW/MSYS</a> are currently supported for
+            the OpenJDK build. One of the differences of these three systems is the way
+            how they handle Windows path names, particularly path names which contain
+            spaces, backslashes as path separators and possibly drive letters. Depending
+            on the use case and the specifics of each environment these path problems can
+            be solved by a combination of quoting whole paths, translating backslashes to
+            forward slashes, escaping backslashes with additional backslashes and
+            translating the path names to their <a href="http://en.wikipedia.org/wiki/8.3_filename">
+            "8.3" version</a>.
+            <p>
+                As of this writing (MKS ver. 9.4, Cygwin ver. 1.7.9, MinGW/MSYS 1.0.17),
+                MKS builds are known to be the fastes Windows builds while MingGW/MSYS
+                builds are slightly slower (about 10%) than MKS builds and Cygwin builds
+                require nearly twice the time (about 180%) of MKS builds (e.g. on a
+                DualCore i7 notebook with 8GB of RAM, HDD and 64-bit Windows 7 operating system
+                the complete OpenJDK 8 product build takes about 49min with MKS, 54min with
+                MinGW/MSYS and 88min with Cygwin).
+            </p>
+            <p>
+                Mixing tools from the different Unix emulation environments is no good
+                idea and will probably not work!
+            </p>
+            <p>
+                <strong>MKS:</strong> is a commercial product which includes
+                all the Unix utilities which are required to build the OpenJDK except GNU
+                make. In pre-OpenJDK times it was the only supported build environment on
+                Windows. The MKS tools support Windows paths with drive letters and
+                forward slashes as path separator. Paths in environment variables like for
+                example <tt>PATH</tt> are separated by semicolon '<tt>;</tt>'.
+            </p>
+            <p>
+                Recent versions of MKS provide the <tt>dosname</tt> utility to convert paths
+                with spaces to short (8.3) path names,e .g.
+                <tt>dosname -s "<i>path</i>"</tt>.   
+            </p>
+            <p>
+                If you are using the MKS environment, you need a native Windows version
+                of Gnu make <a href="#buildgmake">which you can easily build yourself</a>. 
+            </p>
+            <p>
+                <strong>Cygwin:</strong>
+                is an open source, Linux-like environment which tries to emulate
+                a complete POSIX layer on Windows. It tries to be smart about path names
+                and can usually handle all kinds of paths if they are correctly quoted
+                or escaped altough internally it maps drive letters <tt>&lt;drive&gt;:</tt> 
+                to a virtual directory <tt>/cygdrive/&lt;drive&gt;</tt>.
+            </p>
+            <p>
+                You can always use the <tt>cygpath</tt> utility to map pathnames with spaces
+                or the backslash character into the <tt>C:/</tt> style of pathname
+                (called 'mixed'), e.g.
+                <tt>cygpath -s -m "<i>path</i>"</tt>.
+            </p>
             <p>
-                Note that use of CYGWIN creates a unique problem with regards to
+                Note that the use of CYGWIN creates a unique problem with regards to
                 setting <a href="#path"><tt>PATH</tt></a>. Normally on Windows
                 the <tt>PATH</tt> variable contains directories
                 separated with the ";" character (Solaris and Linux uses ":").
                 With CYGWIN, it uses ":", but that means that paths like "C:/path"
                 cannot be placed in the CYGWIN version  of <tt>PATH</tt> and
                 instead CYGWIN uses something like <tt>/cygdrive/c/path</tt>
                 which CYGWIN understands, but only CYGWIN understands.
-                So be careful with paths on Windows.
+            </p>
+            <p>
+                If you are using the Cygwin environment, you need to 
+                <a href="#buildgmake">compile your own version</a>
+                of GNU make because the default Cygwin make can not handle drive letters in paths. 
+            </p>
+            <p>
+                <strong>MinGW/MSYS:</strong> 
+                MinGW ("Minimalist GNU for Windows") is a collection of free Windows
+                specific header files and import libraries combined with GNU toolsets that
+                allow one to produce native Windows programs that do not rely on any
+                3rd-party C runtime DLLs. MSYS is a supplement to MinGW which allows building
+                applications and programs which depend on traditional UNIX tools to
+                be present. Among others this includes tools like <tt>bash</tt> and <tt>make</tt>.
+            </p>
+            <p>
+                Like Cygwin, MinGW/MSYS can handle different types of path formats. They
+                are internally converted to paths with forward slashes and drive letters
+                <tt>&lt;drive&gt;:</tt> replaced by a virtual
+                directory <tt>/&lt;drive&gt;</tt>.  Additionally, MSYS automatically
+                detects binaries compiled for the MSYS environment and feeds them with the
+                internal, Unix-style path names. If native Windows applications are called
+                from within MSYS programs their path arguments are automatically converted
+                back to Windows style path names with drive letters and backslashes as
+                path separators. This may cause problems for Windows applications which
+                use forward slashes as parameter separator (e.g. <tt>cl /nologe /I</tt>)
+                because MSYS may wrongly <a href="http://mingw.org/wiki/Posix_path_conversion">
+                replace such parameters by drive letters</a>.
+            </p>
+            <p>
+                If you are using the MinGW/MSYS system you can use the default make
+                version supplied by the environment.
+            </p>
         </blockquote>
         <!-- ------------------------------------------------------ -->
         <h4><a name="windows_checklist">Basic Windows Check List</a></h4>
         <blockquote>
             <ol>
                 <li>
-                    Install the
-                    <a href="#cygwin">CYGWIN product</a>. 
+                    Install one of the 
+                    <a href="#cygwin">CYGWIN</a>, <a href="#msys">MinGW/MSYS</a> or 
+                    <a href="http://www.mkssoftware.com/products/tk/ds_tkdev.asp">MKS</a> environments. 
                 </li>
                 <li>
                     Install the 
                     <a href="#bootjdk">Bootstrap JDK</a>, set
                     <tt><a href="#ALT_BOOTDIR">ALT_BOOTDIR</a></tt>.

@@ -1242,11 +1343,12 @@
                     XRender header files are required for building the
                     OpenJDK on Solaris.
                     The XRender header file is included with the other X11 header files
                     in the package <strong>SFWxwinc</strong> on new enough versions of
                     Solaris and will be installed in
-                    <tt>/usr/X11/include/X11/extensions/Xrender.h</tt>
+                    <tt>/usr/X11/include/X11/extensions/Xrender.h</tt> or
+                    <tt>/usr/openwin/share/include/X11/extensions/Xrender.h</tt>
                 </p><p>
                     <strong>Linux:</strong>
                     XRender header files are required for building the
                     OpenJDK on Linux.
                     The Linux header files are usually available from a "Xrender"

@@ -1412,26 +1514,22 @@
                             <tr>
                                 <td>make.exe</td>
                                 <td>Devel</td>
                                 <td>make</td>
                                 <td>The GNU version of the 'make' utility built for CYGWIN.<br>
-                                    <b>NOTE</b>: See <a href="#gmake">the GNU make section</a></td>
+                                    <b>NOTE</b>: the Cygwin make can not be used to build the 
+                                    OpenJDK, you only need it to build your own version of make 
+                                    (see <a href="#gmake">the GNU make section</a>)</td>
                             </tr>
                             <tr>
                                 <td>m4.exe</td>
                                 <td>Interpreters</td>
                                 <td>m4</td>
                                 <td>GNU implementation of the traditional Unix macro
                                     processor</td>
                             </tr>
                             <tr>
-                                <td>cpio.exe</td>
-                                <td>Utils</td>
-                                <td>cpio</td>
-                                <td>A program to manage archives of files</td>
-                            </tr>
-                            <tr>
                                 <td>gawk.exe</td>
                                 <td>Utils</td>
                                 <td>awk</td>
                                 <td>Pattern-directed scanning and processing language</td>
                             </tr>

@@ -1477,10 +1575,25 @@
                     with the Visual Studio version. You need the Visual Studio
                     version of <tt>link.exe</tt>, not the CYGWIN one.
                     So it's important that the Visual Studio paths in PATH preceed
                     the CYGWIN path <tt>/usr/bin</tt>.
             </blockquote>
+            <strong> Minimalist GNU for Windows (<a name="msys">MinGW/MSYS</a>)</strong>
+            <blockquote> 
+                Alternatively, the set of unix command tools for the OpenJDK build on 
+                Windows can be supplied by 
+                <a href="http://www.mingw.org/wiki/MSYS" target="_blank">MinGW/MSYS</a>.
+                <p>
+                    In addition to the tools which will be installed by default you have
+                    to manually install the <tt>msys-zip</tt> and <tt>msys-unzip</tt> packages.
+                    This can be easily done with the MinGW command line installer:<br/>
+                    <tt><br/>
+                        mingw-get.exe install msys-zip<br/>
+                        mingw-get.exe install msys-unzip<br/>
+                    </tt>
+                </p>
+            </blockquote>
             <strong><a name="dxsdk">Microsoft DirectX 9.0 SDK header files and libraries</a></strong>
             <blockquote>
                 Microsoft DirectX 9.0 SDK (Summer 2004)
                 headers are required for building
                 OpenJDK.