Skip to main content

JDK Builds on Windows

Posted by kellyohair on January 25, 2007 at 12:33 PM PST

I need to add this to the JDK build documentation, but it may be
helpful to have it posted here for some people.

Building the JDK on Windows can be difficult at times, so if it
hasn't been mentioned before, here are a few clues:

  • When using MKS, make sure that the PATH setting has the
    ${ROOTDIR}/mksnt and
    ${ROOTDIR}/bin directories BEFORE the system
    paths.
    Ideally they should be the first items in your PATH.
    There are conflicts between the MKS tools and what is supplied
    in Windows, and you don't want a mixture.


      I cannot verify or reproduce this,
      but there might be some kind of issue
      regarding long PATH values on Windows.
      Even with MKS in the right
      order in PATH, if many paths are placed before MKS,
      sometimes this doesn't work.
      So my recommendation is is to place MKS very early in PATH.

  • When using CYGWIN, the same thing is true, make sure
    /usr/bin is
    before the system directories.
    Mixtures of tools will often not
    work.
  • Use an MKS shell when you start the gnumake.exe
    (GNU make built for MKS).
    Starting make in a Windows
    cmd.exe command window will often not work.
  • Use a CYGWIN shell when you start the
    /usr/bin/make of CYGWIN, if you don't you might get an error like: /bin/sh: cannot duplicate fd 31 to fd 0: Bad file descriptor
  • The 3.81 version of make (in the latest CYGWIN) does not
    understand paths that use a drive letter like C:\
    or C:/. Which means you cannot use this version of
    GNU make to build the JDK.
    It sounds like this is being fixed but it may take some time
    to get the latest CYGWIN fixed.
    You need make version 3.78.1 to 3.80, maybe 3.82 if this
    problem is addressed in tha version, although it sounds like
    it's a matter of how you build GNU make perhaps?
    So get an older version of the make command.
  • There have been some reports of the latest find
    command in CYGWIN is also broken
    (version 4.3.2 as reported by Dmitri), perhaps with the
    drive letter path names too.
    So get an older version
    (Dmitri recommends 4.3.0) of the find command.
  • If you are building JDK5, you may need to


    unset TMPDIR


    unset TMP


    in your
    environment.
    The JDK5 makefiles used these as make variables and they
    can cause conflicts with the environment variable version used
    by MKS. I don't know if this is also a problem with CYGWIN
    since JDK5 didn't build very reliably with CYGWIN anyway.
    In JDK6, the makefiles were changed to not use these names.
  • The Windows Visual Studio compiler you are using should
    be in your PATH.
    You can't run the cl.exe compilers with a full path like C:/.../Bin/cl.exe without also having that
    Bin in your PATH settings.
    If you get an error message that says something about
    not being able to get CC_VERSION, then try running cl
    yourself in the same shell, perhaps compile and link a small
    hello world program to verify that works from
    the shell command line.
  • When setting the JDK ALT_* variables in your environment
    use the pathname style of
    "C:/", not "C:\"
    or CYGWIN's "/cygdrive/C/".
    Ideally, you should also try and use the path names without
    spaces
    (see MKS dosname -s and CYGWIN cygpath -s -m).
    With JDK6, many ALT_*
    variables should not need to be set and
    the makefiles should figure it all out, so try using as few
    ALT_* variables as possible.
    The one exception is ALT_UNIXCOMMAND_PATH for CYGWIN,
    which is by default /usr/bin, but should be a CYGWIN
    style path if you need to set it for some bizarre reason.

Hope these tidbits are helpful to somone.

-kto

Related Topics >>