Building Chicken With Mingw and Msys Chicken Version 2.3 ====================================================================== Mingw Setup Mingw Packages - http://www.mingw.org/download.shtml mingw-runtime-3.9.tar.gz w32api-3.6.tar.gz gcc-core-3.4.2-20040916-1.tar.gz binutils-2.15.91-20040904-1.tar.gz mingw-utils-0.3.tar.gz gcc-g++-3.4.2-20040916-1.tar.gz [Probably not needed] MSYS-1.0.10.exe msysDTK-1.0.1.exe [For sed you can get elsewhere & save some space] You probably don't need all of the packages listed, but at a minimum you will need the mingw-runtime, gcc, w32api, and msys packages. I installed the others. 1. Extract the gz files into C:\mingw. If you put them anywhere else you will need to adjust all paths accordingly 2. Run the msys installer. It will run a script following the install. As the script runs you will be prompted for two items: - Where is you mingw? Enter the correct location. - Make fstab entries? Say yes. You should be done with mingw setup at this point. ====================================================================== Alternate setup using Dev-C++ Bloodshed Dev-C++ Packages - I used the package updater to get/update win32, gcc, and binutils. ====================================================================== Other Tools You will need sed if you want to use csc. This is because we preprocess csc to substitute text for tool locations. There are several places that you can get sed for windows. If you have gone with the mingw / msys installation you should already have it. If you used the Dev-C++ installation you will probably need to get it from http://unxutils.sourceforge.net/. Make sure that you get it on you path. ====================================================================== Set up the path Set your path and start a command prompt using something like this batch file: set CHICKEN_HOME=C:\working\mingw-only\chicken-2.3 set MINGW_PATH=C:\mingw\bin;C:\msys\1.0\bin set PATH=C:\working\mingw-only\chicken-2.3;%MINGW_PATH%;C:\WINDOWS\system32; cmd.exe Now you can just run this batch file to get a working environment. I recommend that you eliminate all extraneous path entries. I ran into a lot of problems when I used my standard classpath. Since I do all sorts of development on this machine the path environment variable had many entries. Somehow the executables I was creating required strange dlls to run. Since you, like me, probably don't want exes that require dlls from Oracle's jre distribution, eliminate the problem in the first place by getting rid of any extra path entries. ====================================================================== Customize the variables at the top of the make file Look at the top of the make file and set the variables as appropriate. There should be a better way to do this than hardwired values, but right now there isn't. ====================================================================== Build Chicken make -f Makefile.mingw chicken.exe After you build it try running chicken.exe against an scm file. It should produce a c file if everything worked out ok. ====================================================================== Build CSI make -f Makfile.mingw csi.exe Try it out! ====================================================================== Build CSC make -f Makefile.mingw csc.exe Try it out with csc foo.scm bar.scm. ====================================================================== Issues *** I can build chicken to use a shared library and it works fine, but it creates a huge exe. I don't really know what I'm doing, so if anyone has any ideas I would be glad to hear them. The -DPIC option does not work at all and cannot be used. There is probably something basic wrong here but I don't know what it is. Gcc knows about file extensions so if you use unusual file extensions like .obj or .obs gcc doesn't link the dlls and exes. Somebody who knows more about gnu C developement could probably fix this problem in 5 minutes. *** The method that csc.scm uses to obtain tool locations is unusual. It would be nice if it read a config file or used environment variables instead. ====================================================================== TO DO *** Move all location specific variables to the batch file and have make use those. *** Get csc building as appropriate with sed creating csc *** Modify csc so that it does not rely on hard-coded paths. *** Figure out what's wrong with the dll builds. Why are they so big? *** What is the signifigance of --export-dynamic? *** Update the command part of this doc to match the batch file. *** Figure out quoted_cflags in the csc.scm target. *** Note that we need gunzip for chicken-setup ====================================================================== Changes *** Changed csc.scm.in Line 185 (define default-library-files '("%libdir%/libchicken.a")) (define default-library-files '("%staticlibfiles%")) Line 529 Removed -fPIC and -DPIC