These are my notes for building Mustang on Ubuntu 6.06. Amazingly enough, this works with just a small number of easily fixed issues. This is good news if you want to tinker with the JDK on Ubuntu. Even if you don't, it is comforting to know that the Mustang build process is robust enough to allow the tinkerers to use it on their favorite platform, so that you can benefit from their labors.

???As any mad scientist would do, just to prove that it can be done, I decided to build Mustang on my shiny new Ubuntu 6.06 "Dapper Drake" system. The build instructions warn you not to try this at home. The official build environment is Redhat Enterprise Advanced Server 2.1 update 2, formerly known as Redhat Advanced Server 2.1 update 2. Ugh.

I was not sure that this was going to work. Ubuntu is Debian based, and it uses GCC 4.0, not GCC 3.2. As it turns out, the X11 headers have recently moved to around, so I had some grief. But it all turned out well, and I lived to tell the tale.

Why would anyone care? If you use Linux as your primary work OS (as I do), and you switched to the increasingly popular Ubuntu, and you want to tinker with the JDK, these instructions will save you time and frustration. (Not that much time, maybe. It took me less than a day to hack my way through.) For everyone else, it may be comforting to know that someone with very limited system programming experience can do the build in an unfamiliar environment. It certainly is a tribute to the Mustang team who put this very complex build together.

Here are the instructions.

  1. In addition to the basic GCC tools, you need the following packages installed:
  2. Install the binary Mustang distribution, e.g. in /home/me/jdk1.6.0
  3. You need a binary 1.5 distribution, e.g. in /home/me/jdk1.5.0
  4. Make directories for the source and the output, e.g. /home/me/mustangsrc and /home/me/mustangout
  5. Download and install the JARs
    cd mustangsrc
    java -jar ../downloads/jdk-6-rc-src-b87-jrl-09_jun_2006.jar
    java -jar ../downloads/jdk-6-rc-bin-b87-jrl-09_jun_2006.jar
    java -jar ../downloads/jdk-6-rc-mozilla_headers-b87-unix-09_jun_2006.jar
  6. Set environment variables
    unset JAVA_HOME
    export ALT_BOOTDIR=/home/me/jdk1.5.0
    export ALT_DEVTOOLS_PATH=/usr/bin
    export ALT_GCC29_PLUGIN_LIB_PATH=/home/me/jdk1.6.0/jre/plugin/i386/ns7-gcc29
    export ALT_MOZILLA_HEADERS_PATH=/home/me/mustangsrc/share/plugin/
    export ALT_OUTPUTDIR=/home/me/mustangout
    export MILESTONE=rc
    export BUILD_NUMBER=b87
  7. In Ubuntu, basename is in /usr/bin, not in /bin. In j2se/make/common/shared/Defs-utils.gmk, change the definition of BASENAME to
    BASENAME       = $(UTILS_USR_BIN_PATH)basename
  8. To avoid the error execvp: cp: Too many levels of symbolic links, make these changes:
  9. GCC 4.0 is pickier than GCC 3.2. Therefore, we won't fail on warnings. Comment this out in j2se/make/docs/Makefile:
    # WARNINGS_ARE_ERRORS = -Werror
  10. GCC 4.0 complains when redefining an extern function as static. Comment out the word static in these function definitions:
  11. In j2se/src/solaris/native/sun/awt/awt_motif21.c, comment out this declaration:
    /*
    extern XIC XmImGetXIC(
                                    Widget          w,
                            uint32_t    input_policy,
                            ArgList         args,
                            Cardinal        num_args) ;
    */
    
  12. I fixed the error PIC register ‘%ebx’ clobbered in ‘asm’ in j2se/src/solaris/bin/java_md.c by commenting out %ebx in the clobber declaration
     "%eax", /* "%ebx", */ "%ecx", "%edx"
    I'd like some expert to tell me if that is ok.
  13. Ubuntu 6.06 has a different location for several X11 files. Make these changes:
  14. The build instructions told me to run make scsl, but then I got an error complaining about a missing jscheme/REPL. Following this advice, I picked up with make j2se, and voila, it worked.

  15. ???It walks, it talks!
    cd /home/me/mustangout
    bin/java -jar demo/jfc/SwingSet2/SwingSet2.jar