item2
Next»

contents

 

Introduction - 1

History - 2

Overview - 3

Advanced features - 4

Work in progress - 5

One possibility - 6

Conclusion - 7

 

References

Appendix 1 - blowfish

Appendix 2 - tkspline

4.4 - Cross Compiling

As well as supporting compiling on Windows via Cygwin [12] or Mingw[13], Critcl supports cross compiling libraries and packages for Windows on Linux/Unix using the Xmingwin cross compiler (which is based on Mingw) . When Critcl starts it first tries to recognise a cross-compile environment by looking at the version of the C compiler being used (by running "gcc -v"). It should be relatively straightforward to extend this to any gcc based cross compiler, allowing Critcl to build code on (and for) most major platforms.

To set up an Xmingwin cross compiler use the script posted to comp.lang.tcl by Mo de Jong (a copy is available at [14]). This script (based on an original version by Mumit Khan) downloads Xmingwin, builds it and installs it locally under /usr/local/Xmingwin (you can edit the script and change the PREFIX variable if you want to install it elsewhere).  Once you have Xmingwin installed, you'll need to set your PATH to include the Xmingwin bin directory before using Critcl. One convenient way of doing this is to create a script called cross (in /usr/local/bin or ~/bin):

   $ cat /usr/local/bin/cross
   PATH=/usr/local/Xmingwin/i386mingw32msvc/bin:$PATH
   export PATH
   exec $@

Then, you can compile using the usual Critcl package (or library) building commands:

   $ cross critcl -pkg blowfish
   Cross compiling for Windows using Xmingwin
   Source: blowfish.tcl
   Library: blowfish.dll
   Package: lib/blowfish

If Critcl recognises a cross compile environment, it manipulates the tcl_platform array so that it matches that found on Windows 2000. Specifically, the following values are set:

   tcl_platform(byteOrder) = littleEndian
   tcl_platform(machine)   = intel
   tcl_platform(os)        = Windows NT
   tcl_platform(osVersion) = 5.0
   tcl_platform(platform)  = windows
   tcl_platform(wordSize)  = 4

Critcl also provides the critcl::sharedlibext procedure, which returns the shared library extension for the target platform. If you plan on cross-compiling you should use this variable in your Critcl scripts instead of info sharedlibextension (although overlaying the info sharedlibextension command will probably happen at some stage).

Intermediate files are stored in ~/.critcl/Windows-x86 irrespective of the platform on which cross compiling occurs.

There are two other Critcl procedures that are useful in this context - critcl::platform returns the target platform, and critcl::cache returns the name of the directory where Critcl intermediate files are stored.

see also

Critcl Home Page

Tclkit Home Page

Starkit Home Page

Wikit Home Page

Tclers' Wiki

Steve's Website

Jean-Claude's Website

Paper by S. Landers & J.C. Wippler, as presented at Tcl/Tk 2002 conference - see also original PDF.

Papers & Presentations