CoCoALib:HowTo:Compile CoCoALib on Windows

From ApCoCoAWiki

Introduction

  • This site is set up to collect all necessary bits and pieces to compile the CoCoALib on Windows.
  • Note that the current implementation does not enable all functions available in the CoCoALib.
  • This description is made for compiling the CoCoALib with MSVC 2003/2005.

Preparation

Before compiling the CoCoALib you need to install the following files:

  • GMP Library: You will need this library to enable a few features in the CoCoALib. You can either download the full GMP libraries or get a selection of files needed for the CoCoALib.
    • A howto for installing the GMP lib on Windows and compile it on your own can be found on [1].
    • A zip-file containing the necessarry files to compile GMP4.2.2 with MSVC 2005 can be found [2]. Inlcuded are also the descriptions found at the above mentioned link. We will refer to these files with the keyword %GMPpath.
  • HG mercurial: You will need this software only if you want to use the latest CoCoALib. The source control system HG is used to apply a few changes to the CoCoALib via a patch. We will refer to TortoiseHG. TortoiseHG will install mercurial on your system and adds a context menu in the MS Explorer providing many of the needed functionalities.
    • Download TortoiseHG here.
    • A more detailed documentation on you how to use mercurial can be found here.

Download Instructions

There are two possible downloads available:

  • Download the latest CoCoALib from the official website and apply a patch
  • Download a modified CoCoALib. This version has been tested to compile on Windows but might not be the latest CoCoALib version

CoCoALib MSVC Version

Get the latest MSVC ready version from our download page: ToDo: add link

CoCoALib with patch

To enable a compilation with nmake in MSVC the makefiles have to be added to the lib. To keep things easy we provide a patch.

  • Download the latest CoCoALib source files from the CoCoA website: Download Page.
  • The patch is at the moment available via the forum: [3].
  • Creating a Repo: In order to apply the patch the current CoCoALib directory has to be turned into a HG repo. To do so select the CoCoALib folder in your Browser and choose from the HG context menu: Create Repository here.
  • Applying patch: This has to be done from the command line. Type in your command line window:
    hg import -m "Apply MSVC patch" CoCoALib_MSVC.patch

Compilation Instructions

Config file

Prior to compilation you have to adjust the configuration file. Open the file makefile.vc.conf in the configuration subfolder. Set the %GMPpath by adapting the following two lines:

_GMP_INCLUDE=..\..\..\gmp_p4_dll
_GMP_LIB=..\..\..\gmp_p4_dll\gmp.lib

_GMP_INCLUDE contains the path to your GMP binaries. _GMP_LIB points to the gmp.lib file.

gmp.h

For the current CoCoALib Version the header file gmp.h (found in %GMPpath) has to be copyed manually to the following subfolders:

  • src\AlgebraicCore\TmpFactorDir
  • src\AlgebraicCore\TmpHilbertDir

Compilation

Open a Visual Studio command prompt and change to your local CoCoALib folder. Use the nmake command to compile the CoCoALib:

  • Displays a list of available targets
nmake -f Makefile.vc

This makefile builds the CoCoALib. This build system is
specific for the Microsoft environment using MSVC 2003/5.
For more information check out
http://cocoa.mathematik.uni-dortmund.de/forum
Available targets are: nmake -f makefile.vc "target"
clean : remove all files created
CoCoALib: build CoCoALib ;)
tests : build tests
examples: build examples
Not merged is the possibility of building a non-threaded
version of the CoCoAServer.
  • Builds the CoCoALib
nmake -f Makefile.vc CoCoALib

Problems

If you encounter problems check out the forum: CoCoA Forum