How to build for WinCE

JPS: The kind and intelligent Jeff Hobbs (tclguy) helped me do this mid-2004, so ask me (or him) if you have questions. Better yet, add your question(s) between the following two lines, and send me an email indicating the question and that it has been added to this page with the URL. If I can't answer, then I'll ask Jeff.


Sebastian Wangnick: It is possible to create a version that gracefully handles the new Pocket-PC's with VGA screens (480x640 resp. 640x480). You have to add a resource HI_RES_AWARE, type CEUX, value 01 00 to wish84.exe, e.g.:

  • Start Visual Studio (MS VC++ 6)
  • File -> Open -> select wish84.exe
  • From the Insert menu, select Resource...
  • Click the Custom... button
  • Enter CEUX for the resource type
  • Set the resource data to 01 00, and close
  • Select the 101 resource below the "CEUX" type
  • From the View menu, select Properties...
  • Rename the item to "HI_RES_AWARE", including quotes
  • Set Language to Neutral(Default), and close
  • Save wish84.exe

Looks very nice. Even screenmmwidth, and distances in mm/inch, are correct.


This page tries to collect information needed to build Tcl/Tk and extensions for WinCE as of October 2003. It's not for comments regarding writing Tcl for these devices (see PocketPC for that), nor for adjusting the GUI to fit the small screens. -jcw


In 2001/2002, Rainer Keuchel built Tcl/Tk 8.4a2, see [L1 ]. As side effect of this great job, he wrote the "celib" utility library and headers which provide wrappers and replacement definitions for things needed to make this work.

And it does, indeed. The challenge now is to take this further with newer releases of Tcl (8.4a2 does not support VFS, hence no Starkits).

In July 2003, Jeff Hobbs then built Tcl/Tk 8.4.4, and announced it here [L2 ]. This is based on having Cygwin and EVC3 installed in their standard locations on the C drive.

Some important comments about that:

  The sources are set up in such that they coexist in 
  the regular win/ subdir, you just configure like so: 

  $ /cygdrive/z/cvs/tcl/tcl8.4ce/win/configure \ 
    --prefix=C:/build/inst/tclce \ 
    --enable-wince=300,ARM \ 
    --with-celib=/cygdrive/z/src/celib-palm-3.0 

  Also, they require changes to the default celib devel stuff from 
  Rainer Keuchel ( http://www.rainer-keuchel.de/software.html - thanks 
  for the porting library Rainer!), in order to be more WinCE3.0 compliant.

In September 2003, jcw did some work to try and get Starkits going. The original goal was to build Tclkit, but there were some issues with finding encodings, so this was changed to creating a "starkit" package with all the necessary scripts and code inside. In October, this appears to be nearly done. The WinCE Mk4tcl.dll is available here [L3 ] (but read on, no need to get it separately). The rechan and zlib binaries were built with EVC3 and work. The last hurdle is TclVFS, which digs a little into Tcl's internals, and seems to have a configure mismatch right now (e.g. "vfs::filesystem fullynormalize ." crashes).

It's now Oct 7, 2003 - the "package starkit" that is intended to make starkits work is described here [L4 ]. The starkit.tar.gz download at [L5 ] now also includes WinCE binaries, but at this moment the vfs12.dll in there is not right.

Stay tooned...


JH Steps to building for WinCE from scratch.

  • Obtain WinCE sources from http://sourceforge.net/projects/tcltkce/ Files section.
  • Install cygwin on your machine from http://www.cygwin.org/ . Ensure that you include make.
  • Get Rainer Keuchel's celib binaries [L6 ].
  • Install MSVC++ 6 or other functional compiler (this is kind of bogus ... we need to get past the working compiler part of configure that I haven't figured out how to avoid).
  • Install embedded Visual Tools 3 - 2002 Edition[L7 ]. You can skip embedded VB, but let it install in the default C:\Windows CE Tools\. This should also install MS Windows SDK for Pocket PC 2002. You need evc3 if you want to build for Pocket PC 2002. If you just target PPC 2003 or newer, evc4 can be installed, but it has not been tested in the build environment (changes will be required).
  • Pray that it all installed OK ... you should have the following:
  • An installed Win32 compiler found on the path
  • Various CE Tools in C:/Windows CE Tools.
  • The embedded VC in C:/Program Files/Microsoft eMbedded Tools
  • The PPC 2002 SDK in C:/Windows CE Tools/wce300/Pocket PC 2002
  • Configure the system in the cygwin shell with:
    /path/to/tclce-src/win/configure --enable-wince=300,ARM --with-celib=/path/to/celib
  • make
  • Rinse, repeat for Tk.

Extensions can also be built. They will need to use the latest TEA macros from the sampleextension, as those include the --enable-wince stuff. An example of a working ported extension is Tktable. Minor adjustments may need to be made to an extension to get it to work on WinCE (Tktable required one line of C code changes amongst 25K LOC).


Slightly off-topic, but has anybody got any experience with compiling celib itself? I'm trying to get it compiled for Windows mobile 2003, but I am stuck (probably owing to my lack of understanding of MS build environment).

<VK> I did succeeded building CELIB. It was easier than I initially thought BTW. Can share makefiles. Please write to tcltkce mailing list on sourcesorge if you're interested.</VK>

I have installed MS eVC++ 4.0, PocketPC 2003 SDK, MS Windows CE Platform Manager 4.0 and a couple of patches that I think added WCE4.20 support to eVC++.

I have edited the Makefile.ce that comes with the celib sources to add a target for the WinCE 4.20 platform (see diff below), but running nmake -f Makefile.ce fails on the first file alarm.c with the following error:-

 *****************************************************************
 Building for armv4 POCKET PC 2003 wce420
 INCLUDE = C:\Program Files\Windows CE Tools/wce420/POCKET PC 2003/Include/armv4
 LIB     = C:\Program Files\Windows CE Tools/wce420/POCKET PC 2003/Lib/armv4
 PATH    = C:\Program Files\Microsoft eMbedded C++ 4.0\EVC\wce420\BIN
 *****************************************************************

        if not exist wince-arm-pocket-wce420-release mkdir wince-arm-pocket-wce420-release
        clarm.exe -c -nologo -I inc -DPALM_SIZE -D _ARM_ -D ARM -D _arm_ -D _ARM_ -DPOCKET_SIZE -D HAVE_STDARG_H -D  _WINCE  -D _WIN32_WCE=420  -D UNDER_CE=420  -D BUILD_CELIB=1  -D FLOATING_POINT -Od -D_MT  -D_DLL -Fowince-arm-pocket-wce420-release\ .\alarm.c
 alarm.c
 c:\userdata\temp\celibsrc\celib-palm-3.0\inc\cewin32.h(108) : error C2011: '_ABC' : 'struct' type redefinition
 NMAKE : fatal error U1077: 'clarm.exe' : return code '0x2'
 Stop.

(Makefile.ce diff follows)

 diff -c "c:/userdata/temp/celibsrc/celib-palm-3.0/Makefile.ce~"  "c:/userdata/temp/celibsrc/celib-palm-3.0/Makefile.ce"
 *** c:/userdata/temp/celibsrc/celib-palm-3.0/Makefile.ce~        Fri May 10 08:37:37 2002
 --- c:/userdata/temp/celibsrc/celib-palm-3.0/Makefile.ce        Fri Mar 12 11:35:56 2004
 ***************
 *** 9,15 ****
   #CFG = WINCE_PROFILESHARED

   !if "$(TARGET)" == ""
 ! TARGET=wince-arm-hpc-wce300
   #TARGET=wince-arm-hpc-wce211
   #TARGET=wince-sh3-hpc-wce211
   #TARGET=wince-sh4-hpc-wce211
 --- 9,15 ----
   #CFG = WINCE_PROFILESHARED

   !if "$(TARGET)" == ""
 ! TARGET=wince-arm-pocket-wce420
   #TARGET=wince-arm-hpc-wce211
   #TARGET=wince-sh3-hpc-wce211
   #TARGET=wince-sh4-hpc-wce211
 ***************
 *** 29,40 ****
   #TARGET=wince-x86-hpc-wce300
   !endif

 ! EVC        = N:\Programme\Microsoft eMbedded Tools\EVC
 ! WCEROOT    = N:\Windows CE Tools
 ! SDKROOT    = N:\Windows CE Tools
   #WCEROOT    = D:\Windows CE Tools
   #SDKROOT    = D:\Windows CE Tools

   !if "$(TARGET)" == "wince-x86-hpc-wce300"
   CC         = cl.exe
   PLATFORM   = HPC2000
 --- 29,56 ----
   #TARGET=wince-x86-hpc-wce300
   !endif

 ! #EVC        = N:\Programme\Microsoft eMbedded Tools\EVC
 ! #WCEROOT    = N:\Windows CE Tools
 ! #SDKROOT    = N:\Windows CE Tools
 ! EVC        = C:\Program Files\Microsoft eMbedded C++ 4.0\EVC
 ! WCEROOT    = C:\Program Files\Windows CE Tools
 ! SDKROOT    = C:\Program Files\Windows CE Tools
   #WCEROOT    = D:\Windows CE Tools
   #SDKROOT    = D:\Windows CE Tools

 + #mno
 + !if "$(TARGET)" == "wince-arm-pocket-wce420"
 + CC         = clarm.exe
 + PLATFORM   = POCKET PC 2003
 + TARGETCPU  = armv4
 + MACHFLAGS  = -D _ARM_ -D ARM -D _arm_ -D _ARM_ -DPOCKET_SIZE
 + #MACHFLAGS  = -QRxscale -D _ARM_ -D ARM -D _arm_ -D _ARM_ -DPOCKET_SIZE
 + OSVERSION  = wce420
 + CEVERSION  = 420
 + CESUBSYS   = windowsce,4.20
 + MACHINE           = -machine:arm
 + !endif
 + 
   !if "$(TARGET)" == "wince-x86-hpc-wce300"
   CC         = cl.exe
   PLATFORM   = HPC2000
 ***************
 *** 263,270 ****
   #CEPATH=D:\Programme\Microsoft eMbedded Tools\EVC\$(OSVERSION)\BIN
   PATH=$(CEPATH);$(PATH)

 ! INCLUDE=$(WCEROOT)/$(OSVERSION)/$(PLATFORM)/include
 ! LIB=$(WCEROOT)/$(OSVERSION)/$(PLATFORM)/lib/$(TARGETCPU)

   ######################################################################

 --- 279,287 ----
   #CEPATH=D:\Programme\Microsoft eMbedded Tools\EVC\$(OSVERSION)\BIN
   PATH=$(CEPATH);$(PATH)

 ! #mno INCLUDE=$(WCEROOT)/$(OSVERSION)/$(PLATFORM)/include
 ! INCLUDE=$(WCEROOT)/$(OSVERSION)/$(PLATFORM)/Include/$(TARGETCPU)
 ! LIB=$(WCEROOT)/$(OSVERSION)/$(PLATFORM)/Lib/$(TARGETCPU)

   ######################################################################

 ***************
 *** 278,284 ****

   ######################################################################

 ! COMMONCFLAGS   = -nologo -I inc -DPALM_SIZE $(MACHFLAGS) -D HAVE_STDARG_H
   COMMONCEDEFS   = -D _WINCE \
                    -D _WIN32_WCE=$(CEVERSION) \
                    -D UNDER_CE=$(CEVERSION) \
 --- 295,304 ----

   ######################################################################

 ! COMMONCFLAGS   = -nologo -I inc -DPALM_SIZE $(MACHFLAGS) -D HAVE_STDARG_H 
 ! 
 ! #-I "C:\Program Files\Windows CE Tools\wce420\POCKET PC 2003\Include\Armv4"
 ! 
   COMMONCEDEFS   = -D _WINCE \
                    -D _WIN32_WCE=$(CEVERSION) \
                    -D UNDER_CE=$(CEVERSION) \

Do you have compiled TCLTK8.4.5 with EVC4 on WinCE successfully? Could you please give me a guide?