Difference between revisions of "CoCoALib:CoCoALib and Cygwin FAQ"

From ApCoCoAWiki
 
(corrected some of the structure problems - still learning)
Line 1: Line 1:
 
(just a first dirty test how to set up a page....)
 
(just a first dirty test how to set up a page....)
  
1.1.1 Opening Remarks
+
== Opening Remarks ==
 +
 
 
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.
 
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.
  
Line 30: Line 31:
 
  - add section regarding binmode  
 
  - add section regarding binmode  
 
 
1.1.2 Installing Cygwin  
+
== Installing Cygwin ==
  
 
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
 
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
  
- automake1.9
+
* automake1.9
- gcc-g++
+
* gcc-g++
- make
+
* make
  
 
from the devel-section. These packages will enable you to compile the gmp library and CoCoALib.
 
from the devel-section. These packages will enable you to compile the gmp library and CoCoALib.
  
1.1.3 Getting and compiling gmp
+
== 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
 
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
  
Line 69: Line 71:
  
 
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.
 
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.
1.1.4 Compiling CoCoALib
+
 
 +
== Compiling CoCoALib ==
 +
 
 
Get the CoCoALib and unpack to /home/Administrator. 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:
 
Get the CoCoALib and unpack to /home/Administrator. 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:
  

Revision as of 21:35, 20 June 2005

(just a first dirty test how to set up a page....)

Opening Remarks

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

Revision:

2005-06-09: - Converted to XML for easier maintenance and prettier (html)output.

           - revised and expanded opening remarks
           - Added FAQ-section

2005-06-08: - rough first draft, expect corrections over time. Lots of grammatical and

             spelling errors to be found, but documentation with spelling errors and 
             moronic grammar is better than no documentation at all.


ToDo:

- create more beautiful html, i.e. use tidyhtml. The XML converter creates horrible html.
- add section regarding binmode 

Installing Cygwin

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

  • automake1.9
  • gcc-g++
  • make

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.

Compiling CoCoALib

Get the CoCoALib and unpack to /home/Administrator. 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

  1. Optimized -- for the final version
   OPTFLAGS = -O2 

is not commented out and that

  1. Normal (Debug And Leaks)
  2. 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

make library

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

make check

and CoCoALib will build a number of tests and runs those. Output will look like

$ make check make[1]: Entering directory `/home/Administrator/CoCoALib-0.92' COMPILING THE COCOA LIBRARY -- this may take some time COMPILATION OF THE COCOA LIBRARY COMPLETED make[1]: 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.