Difference between revisions of "ApCoCoA-1:HowTo:Compile ApCoCoALib on Windows"

From ApCoCoAWiki
m (updated pull description)
(Complete Redesign of the page)
Line 1: Line 1:
Note: The compilation as described below will fail on the current repository version. The description only presents the general approach which will be made available with the next releases.
+
=Introduction=
 +
*This site is set up to collect all necessary bits and pieces to compile the ApCoCoALib on Windows.
 +
*This description is made for compiling the ApCoCoALib with MSVC 2003/2005.
  
= What is needed =
+
=Preparation=
In order to compile the ApCoCoALib on Windows several programs need to be installed prior compilation. The installation and reference of those programs will not be described on this site. We refer to the official websites instead.
+
Before compiling the ApCoCoALib you need to install the following files/libraries:
  
==Cygwin==
+
*CoCoALib: The ApCoCoALib is based on and extends the functionalities of the CoCoALib. You need to compile the CoCoALib prior to the ApCoCoALib.
To get the latest releases we recommend to use mercurial as your repository client. In case you do not want to contribute to the project the current version can also be downloaded [http://www.apcocoa.org/hg/ here].
+
**Find a description on how to install the CoCoALib on Windows [http://www.apcocoa.org/wiki/HowTo:Compile_CoCoALib_on_Windows here].
  
Install Cygwin with the following components activated:
+
*Blas and Lapack Library: You will need those libraries to enable a few features in the ApCoCoALib. You can either download the full libraries or get a selection of files needed for the ApCoCoALib.
*devel: mercurial
+
** Download and install the complete libraries via [http://math-atlas.sourceforge.net/ ATLAS].
*devel: python-brlapi
+
** A selection of needed files can be found ''[http:// here]''. Download the archive and extract it to your local harddisk. We will refer to these files with the keyword %BLLApath
*util: patch
 
*editors: nano (or any other command line editor - optional)
 
  
==MSVC==
+
*Optionally you can install [http://linalg.org LinBox] which can improve the FGLM techniques especially over finite fields and lets you call LinBox functions from within the ApCoCoA GUI.
Version 2003/2005 (for MatlabToolbox MSVC2005 is needed)
 
  
==Source code==
+
*HG mercurial: You will need this software to download the latest ApCoCoALib from a repository. The ApCoCoALib is managed with the source control system mercurial. 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.
If you downloaded the source code from the repository website you can skip the next section "How to get source code from a repository". In case you use mercurial read the follwoing section.
+
** Download TortoiseHG [http://tortoisehg.sourceforge.net/ here].
 +
** A more detailed documentation on you how to use mercurial can be found [http://www.selenic.com/mercurial/wiki/ here].
 +
** General information on the ApCoCoALib source code management can be found [http://www.apcocoa.org/wiki/ApCoCoA:SourceCodeManagement here].
  
Needed are the following repositories:
+
*Intel MKL: You need the Intel MKL installed on your computer.
*CoCoALib (e.g. CoCoALib-0.99)
 
*ApCoCoALib (e.g. ApCoCoALib-devel)
 
*MatlabToolbox (in case you need the MatlabToolbox-Interface)
 
  
= How to get the source code from a repository =
+
=Download Instructions=
The ApCoCoALib sources are managed with Mercurial. See also [[ApCoCoA:SourceCodeManagement | SourceCodeManagement]].
+
Get your prefered ApCoCoALib version (stable or developer) from the [http://www.apcocoa.org/hg/ repo site].
 +
A brief instruction using TortoiseHG is:
 +
* Add a folder on your local harddisk for the local repo copy.
 +
* Open the context menu entry TortoiseHG->Clone a repository. As the source path copy the selected link from the repo site. As the destination path select your created folder. Start the download of the ApCoCoALib with the clone button.
  
Open a cygwin command window and create a path you want to store your repositories to. Mercurial is operated by the hg command.
+
=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:
 +
<c>
 +
_GMP_INCLUDE=..\..\..\gmp_p4_dll
 +
_GMP_LIB=..\..\..\gmp_p4_dll\gmp.lib
 +
</c>
 +
_GMP_INCLUDE contains the path to your GMP binaries. _GMP_LIB points to the gmp.lib file.
  
==Check out: clone==
+
Set the include pathes for the CoCoALib and the Intel MKL in the following lines
To create a copy of your repository on your machine use the ''hg clone RepoLink'' command. RepoLink stands for the repository url. You can find the repository url as the link on the [http://www.apcocoa.org/hg/ repositories index site]. E.g. the url to the ApCoCoALib-devel repository is http://www.apcocoa.org/hg/ApCoCoALib-devel/
+
<c>
 +
_INCLUDES=/I $(_GMP_INCLUDE) /I ..\..\include /I ..\..\..\CoCoALib-0.9914\include \
 +
          /I ..\..\..\IntelMKL\include
 +
</c>
  
This command will create a subfolder on your computer and load all files from the selected repository.
+
Note: All pathes shown here are relative pathes to the ApCoCoALib folder.
  
This command needs to be run only once. To update the repository the command ''hg pull'' is used.
+
==Compilation==
 +
Open a Visual Studio command prompt and change to your local ApCoCoALib folder. Use the nmake command to compile the ApCoCoALib:
 +
<c>nmake -f Makefile.vc</c> Will display all available targets.
 +
<c>nmake -f Makefile.vc ApCoCoALib</c> Will build the ApCoCoALib.
  
==Update: pull==
+
==Problems==
The clone command also created a subdirectory called .hg which contains all the relevant information for mercurial to update the repository.
+
If you encounter problems check out the forum: [http://www.apcocoa.org/forum/ ApCoCoA Forum]
  
Before updating ensure that cygwin's current directory is the repository directory you want to update. The command ''hg pull'' will get the infos on the latest updates. After pulling one have to run ''hg update'' to update the local repository copy. To view the changes use the command ''hg log'' or for the last changes: ''hg log | less''.
+
[[Category:HowTo]][[Category:ApCoCoALib]]
 
 
==Patches: import==
 
In case you are contributing to the ApCoCoALib you might want to apply patches before they have been pushed to the repository for download. To apply a mercurial patch use the command ''hg import name.patch'' where ''name'' stands for the filename of the patch. Note that it is assumed that you copied the patch into your local repository folder. Otherwise ''name'' needs to be the path to your patch-file location.
 
 
 
==Upload: commit==
 
To submit a change in the source code two steps have to be taken: committing the change and export as patch. Publish the patch in the [http://www.apcocoa.org/forum/viewforum.php?f=20 forum] and ask the admins to push your patch to the repsoitory (for more details see next section: Patches: export).
 
 
 
Before making changes it is highly recommended to create a copy of your repository clone as your working set in which changes are being made. Thus it is easier to keep track of different development trees while having a latest repository clone in your prefered ''hg pull'' folder.
 
 
 
The changes you have made can be shown by using the command ''hg status'' (names the files which have been changed) and the command ''hg diff'' (displays the lines which have been changed).
 
 
 
To make a change use the command ''hg commit''. This will open the editor (e.g. nano) asking for a description. Alternatively use the command ''hg commit -m "Your description"'' Where "Your description" stands for a brief description of the changes being made in this commit.
 
 
 
Again use the command ''hg log | less'' to see the last change. There will also be a changeset number displayed e.g. 121:xxx where xxx stands for a hashcode.
 
 
 
==Patches: export==
 
To export the patch and ask for pushing (by attaching it to your forum request) get the changeset hashcode (''hg log | less''). Then use the command ''hg export xxx > patchname.patch'' where ''xxx'' stands for the hashcode and ''patchname'' for a patchname. Ensure that the patchname contains no blanks and is a short description. See the forum for examples of patch names.
 
 
 
= How to compile =
 
The libs are compiled with the MSVC command ''nmake''. To run this command open a MSVC command prompt and change to the repository folder you wish to compile.
 
 
 
Due to the dependencies the stated repositories have to be compiled in the order:
 
#CoCoALib
 
#ApCoCoALib
 
#MatlabToolbox
 
 
 
The compilation command is ''nmake -f Makefile.vc''.
 
 
 
Note: Ensure using Makefile.vc and not Makefile.
 
 
 
This will display a list of possible compilation options. Among them are:
 
* CoCoALib / ApCoCoALib - This will compile the corresponding Lib
 
* tests - This will compile several tests
 
* clean - This will remove the files created during the last compilation
 
* ........
 
 
 
To compile one of these options type the command: ''nmake -f Makefile.vc option'' where ''option'' stands for one of the listed options
 
 
 
e.g. ''nmake -f Makefile.vc CoCoALib''.
 
 
 
==Setting paths==
 
This section will be described later. It is depending on the coming releases.
 
 
 
 
 
[[Category:HowTo]][[Category:ApCoCoALib]][[Category:MatlabToolbox]]
 

Revision as of 11:19, 25 February 2008

Introduction

  • This site is set up to collect all necessary bits and pieces to compile the ApCoCoALib on Windows.
  • This description is made for compiling the ApCoCoALib with MSVC 2003/2005.

Preparation

Before compiling the ApCoCoALib you need to install the following files/libraries:

  • CoCoALib: The ApCoCoALib is based on and extends the functionalities of the CoCoALib. You need to compile the CoCoALib prior to the ApCoCoALib.
    • Find a description on how to install the CoCoALib on Windows here.
  • Blas and Lapack Library: You will need those libraries to enable a few features in the ApCoCoALib. You can either download the full libraries or get a selection of files needed for the ApCoCoALib.
    • Download and install the complete libraries via ATLAS.
    • A selection of needed files can be found [http:// here]. Download the archive and extract it to your local harddisk. We will refer to these files with the keyword %BLLApath
  • Optionally you can install LinBox which can improve the FGLM techniques especially over finite fields and lets you call LinBox functions from within the ApCoCoA GUI.
  • HG mercurial: You will need this software to download the latest ApCoCoALib from a repository. The ApCoCoALib is managed with the source control system mercurial. 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.
    • General information on the ApCoCoALib source code management can be found here.
  • Intel MKL: You need the Intel MKL installed on your computer.

Download Instructions

Get your prefered ApCoCoALib version (stable or developer) from the repo site. A brief instruction using TortoiseHG is:

  • Add a folder on your local harddisk for the local repo copy.
  • Open the context menu entry TortoiseHG->Clone a repository. As the source path copy the selected link from the repo site. As the destination path select your created folder. Start the download of the ApCoCoALib with the clone button.

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: <c> _GMP_INCLUDE=..\..\..\gmp_p4_dll _GMP_LIB=..\..\..\gmp_p4_dll\gmp.lib </c> _GMP_INCLUDE contains the path to your GMP binaries. _GMP_LIB points to the gmp.lib file.

Set the include pathes for the CoCoALib and the Intel MKL in the following lines <c> _INCLUDES=/I $(_GMP_INCLUDE) /I ..\..\include /I ..\..\..\CoCoALib-0.9914\include \

         /I ..\..\..\IntelMKL\include

</c>

Note: All pathes shown here are relative pathes to the ApCoCoALib folder.

Compilation

Open a Visual Studio command prompt and change to your local ApCoCoALib folder. Use the nmake command to compile the ApCoCoALib: <c>nmake -f Makefile.vc</c> Will display all available targets. <c>nmake -f Makefile.vc ApCoCoALib</c> Will build the ApCoCoALib.

Problems

If you encounter problems check out the forum: ApCoCoA Forum