CoCoALib:CoCoALib and Cygwin FAQ
This document is outdated
The 0.96.1 release as well the 0.98.0 build right out of the box. The information below is outdated and will likely be deleted in the future.
This document was written with the 0.92 release of CoCoALib in mind. Much of it will probably directly apply to future versions of CoCoALib, but as differences will crop up expect an update to this document.
CoCoALib is primarily developed on Linux and MaxOSX, while some testing is done on a variety of commercial and free UNIX platforms, mainly Solaris at the moment. Since Microsoft Windows is the dominant desktop operating system at the time we also try to support it. Unfortunetly, Microsoft Windows does not properly support many of the APIs directly, so we use cygwin to compile CoCoALib on Windows. This may change in the future since there is an attempt under way to replace the platform specific code, i.e. fork() and BSD-sockets, with a cross-platform library, so that our code will just compile using MSCV or the Intel compiler out of the box on Windows too. But there are still some issues to be worked out. Anybody who has ever tried to compile the gmp with MSVC can tell that it isn't a feat done easily since there is little support for the autotools on Windows. Plenty of info regarding this is available in the archives of the gmp mailing list.
In this document We assume that you know how to use basic tools like compression utilities and are able to start programs by clicking on some icon. Since CoCoALib is written in C++ one can assume that those skills will be available to you.
Ok, now that we got the opening remarks out of the way we will first go on to install all the required software, i.e. cygwin, first.
Feedback, improvements and suggestions are always welcome to make this document better. If you would like to contribute please send an email to Michael.Abshoff(at)math.uni-dortmund.de. Since I get lots of spam and also have a high volume of mail traffic from mailing lists please make sure that the subject of your email contains something like [CoCoALib] in order to raise my attention. An empty subject will pretty much ensure that your email will be deleted without reading.
Michael Abshoff, University of Dortmund
Go to http://www.cygwin.com/ and get setup.exe. At the moment of writing this document the current version was 1.5.17-1. Start setup.exe and install it to C:\cygwin (with default settings). Besides the default packages select
from the devel-section. These packages will enable you to compile the gmp library and CoCoALib.
Getting and compiling gmp
Get gmp-4.1.4 from http://www.swox.com/gmp/ (since GMP 4.1.3 contains a critical bug affecting CoCoA::RingFloat). Unpack to /home/Administrator/ which translates to C:\cygwin\home\Administrator. Change to /home/Administrator/gmp-4.1.4. Now we have to configure gmp by typing
Administrator@sprocket ~/gmp-4.1.4 $ ./configure --prefix=/home/Administrator/gmp-4.1.4-static --enable-static
Lots of stuff scrolls by, when finished it should look something like:
checking build system type... athlon-pc-cygwin checking host system type... athlon-pc-cygwin checking for a BSD compatible install... /usr/bin/install -c ... config.status: linking ./mpn/x86/k7/mmx/copyi.asm to mpn/copyi.asm config.status: linking ./mpn/x86/k7/mmx/copyd.asm to mpn/copyd.asm config.status: linking ./mpn/x86/k7/mmx/com_n.asm to mpn/com_n.asm config.status: linking ./mpn/x86/k7/gmp-mparam.h to gmp-mparam.h
Ok, now enter "make", wait a while and enter "make install" and the gmp should build. Take a look into /home/Administrator/gmp-4.1.4-static and you should see something like
Administrator@sprocket ~/gmp-4.1.4-static $ ls -al total 8 drwxr-xr-x+ 5 Administrator Kein 0 Jun 8 13:55 . drwxrwxrwx+ 4 Administrator Kein 4096 Jun 8 13:55 .. drwxr-xr-x+ 2 Administrator Kein 0 Jun 8 13:55 include drwxr-xr-x+ 2 Administrator Kein 4096 Jun 8 13:55 info drwxr-xr-x+ 2 Administrator Kein 0 Jun 8 13:55 lib
Ok, now we have the required library to buid CoCoALib. If you encounter problems when building the gmp you can always do a "make check" to verify that the gmp is working correctly on your platform. Since the gmp is well tested on cygwin this seems rather unlikely, though.
Get the CoCoALib and unpack it to /home/Administrator, using cygwin's tar and gunzip command (using winzip or other windows tools can lead to errors, reasoned in the different handling of newlines). Yoou will find a directory called CoCoALib-0.92. Before we compile we have to do some minor tweaks to the common.mki and src/Makefile-dependencies. Since those files were written on Linux use an editor that can handle those kinds if line-breaks (Emacs works, notepad doesn't) Open common.mki. We have to tell make where the gmp can be found. If you did everything as above enter:
GMP_LIB=/home/Administrator/gmp-4.1.4-static/lib/libgmp.a # win32-cygwin GMP_INCLUDE=-I/home/Administrator/gmp-4.1.4-static/include # win32-cygwin
and make sure that
# Optimized -- for the final version OPTFLAGS = -O2
is not commented out and that
# Normal (Debug And Leaks) # OPTFLAGS = -O2 -g -DCoCoA_DEBUG -DCoCoA_MEMPOOL_DEBUG=1
is commented out since performance will otherwise be not as good as it could be. Now open src/Makefiledependecies. Replace line 76 with the line
echo -n " $(COCOA_ROOT)/src/$$ofile" >> Makefile_dependencies; \
i.e. remove the "-e" option from the echo command since cygwin's echo doesn't know that option and will produce a faulty makefile. Make alsio sure that the "$" before "(COCOA_ROOT)" is there since at least on my Windows-Box there was the character "\044" (FIXME: issue with code-pages?) Anyways, you can find the source with the modifications in fsmath.mathematik.uni-dortmund.de/~mabshoff/CoCoA/misc/CoCoALib-0.92-cyg.tar.gz After we are done with the modifications change to /home/Administrator/CoCoALib-0.92 and type
This will take a while and you get:
Administrator@sprocket ~/CoCoALib-0.92 $ make library COMPILING THE COCOA LIBRARY -- this may take some time Rebuilding Makefile_dependencies in directory COCOA_ROOT/src Compiling cputime.o Compiling config.o ... Compiling PPMonoidEvOv.o Compiling OpenMath.o Compiling OpenMathXML.o COMPILATION OF THE COCOA LIBRARY COMPLETED
Ok, now CoCoAlib has been successfully build and can be found in lib/libcocoa.a. Now we want to make sure that everything is working properly. To do that we type in
and CoCoALib will build a number of tests and runs those. Output will look like
$ make check make: Entering directory `/home/Administrator/CoCoALib-0.92' COMPILING THE COCOA LIBRARY -- this may take some time COMPILATION OF THE COCOA LIBRARY COMPLETED make: Leaving directory `/home/Administrator/CoCoALib-0.92' Makefile:119: Makefile_dependencies: No such file or directory Compiling and running the CoCoA Test suite... Compiling test-RingZ1 ... Compiling test-RingHom2 Compiling test-bug1 Running test-RingZ1...OK Running test-RingZmodN1...OK ... Running test-RingHom2...OK Running test-bug1...OK =========================== Good news: all tests passed =========================== CoCoA test completed -- tidying up. Cleaning directory COCOA_ROOT/src/tests
Now everything works and one can start to develop software with CoCoALib.
- add section regarding binmode
In case you encounter any problems not mentioned here, please tell the developers of the library! If you solved the problems yourself simply change this FAQ (by click on Edit and than add your information where ever it fits) and add what you did.
In case you have not been able to solve your problems do not hesitate and explain them in the CoCoA discussion board, such that the developers are able to solve them and can add the information here.
This will help to create a better documention for CoCoA!