How to build CLDC 1.0.3 under Windows using Cygwin

Install Cygwin

Cygwin is a UNIX environment for Windows. It's located at http://sources.redhat.com/cygwin/

When running the setup program, in the 'Select Packages' dialog box, choose to install gcc2, gcc-mingw, make and mingw-runtime under the 'Category' field.

Install JDK 1.3.1

Install JDK 1.3.1 under cygwin's '/usr/local'. For example, if cygwin is install at 'd:/cygwin', install JDK at 'd:/cygwin/usr/local/jdk1.3.1'. This will make cygwin find jdk more easily.

Edit cygwin's '/etc/profile'. Add the following line:
PATH="/usr/local/jdk1.3.1/bin:$PATH"

chmod a+x /usr/local/jdk1.3.1/bin/*
Note: Doing this is for make to be able to determine they are executables.

Download J2ME CLDC 1.0.4

Download J2ME CLDC 1.0.4 from Sun's website at http://java.sun.com/j2me/download.html

In cygwin, unzip j2me_cldc-1_0_4-fcs-src-b30-winunix-13_nov_2002.zip
chmod -R u+w j2me_cldc
mv j2me_cldc cldc1.0.4fcs

Modify kvm/VmWin/build/Makefile, change 'gcc' to 'gcc-2'.

Modify tools/preverifier/build/win32/Makefile, change 'gcc' to 'gcc-2'.

It is because Cygwin's gcc (gcc 3.2) can't handle -mno-cygwin correctly. Therefore, we need to use gcc-2 (gcc 2.95.3) instead.

Build J2ME CLDC 1.0.4

cd cldc1.0.4fcs/build/win32

make GCC=true

The built image is kvm/VmWin/build/kvm.exe