CoCoALib:HowTo:Compile CoCoALib on Windows

From ApCoCoAWiki
Revision as of 10:50, 31 January 2009 by Matthias Machnik (talk | contribs) (Updated download section)


  • 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.


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

At the moment the CoCoALib can not be compiled with MSVC directly. 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 in the configuration subfolder. Set the %GMPpath by adapting the following two lines:


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


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


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

This makefile builds the CoCoALib. This build system is
specific for the Microsoft environment using MSVC 2003/5.
For more information check out
Available targets are: nmake -f "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 CoCoALib


If you encounter problems check out the forum: CoCoA Forum