ApCoCoALib:CompilationInstructions

From ApCoCoAWiki

This page describes how to compile the ApCoCoALib as of 0.99.08.

Requirements

You need the following libraries:

  • CoCoALib 0.98.2 (or later), we use 0.99.07 at the moment
  • GMP 4.2.1 is recommended, you need at least release 4.1.4 due to bugs in earlier releases. CoCoALib will not work correctly with 4.1.3 or earlier

Optional:

  • BLAS and Lapack: Those libraries are needed for ABM and the numerical functions.
  • LinBox: LinBox requires BLAS and Lapack as well as the C++ GMP wrapper library. You need at least LinBox 1.1.4 released on October 30th, 2007.

The Config File

Describe examples and link to config files in ApCoCoALib hg.

Step by Step build instructions

Get a copy of the sources for CoCoALib and ApCoCoALib, for example from our download page.

Build the CoCoALib. You should consult the CoCoALib documentation in case of problems.

Build the ApCoCoALib: Unpack the tarball in the same directory as CoCoALib-0.99. This is the default location that ApCoCoALib will look for. You can change it but at the moment this requires editing of the COCOA_DIR_NAME in the file configuration/autoconf.mk. We will offer the location of CoCoALib as a config option in the libconfig file in a later release. Now run configure:

[mabshoff@dhcp75 ApCoCoALib-0.99]$ ./configure
ERROR: Specified config file is not a readable file: ""
Please specify a config file for the external numerical libraries via --with-libconfig

You get an error because ApCoCoALib needs to be told where to find several external libraries and options. One option is to set CONFIG_LIB="lib.config" in the configure script and create the file called lib.config with the following text:

# we don't want to compile in any numerical libraries
NUMFLAGS=-DUSENoLapack 
# empty NUMLIBS
NUMLIBS=
LINBOXFLAGS=

With this config file you deactivate all numerical methods provided by ApCoCoALib. Chances are you do not want to do this. But since building the numerical libraries can be a little complicated we provide precompiled libraries and config examples at http://apcocoa.org/hg/NumLibs/file/ FIXME: Add more details and tarballs.

In case you have Mac Os X as your operating system, it is very easy to include the numerical Libraries. Per default, you have an installed Accelerate Framework, which includes BLAS and Lapack, which are the numerical libraries we currently use. To activate the accelerate framework, your lib.config should include the lines:

NUMFLAGS=-DUSEAccFW

# linker options:
NUMLIBS=-bind_at_load -framework accelerate

With a working set of libraries we rerun configure and get:

[mabshoff@dhcp75 ApCoCoALib-0.99]$ ./configure  --with-libconfig=../NumLibs/lib.config.USEF77Lapack
The C++ compiler is g++ 4.1.1 20070105 (Red Hat 4.1.1-51)
The C++ optimized compilation flags are "-Wall -pedantic -fPIC -O2"
Using GMP library version 4.2.1 found in "/usr/local/gmp-4.2.1-static/lib/libgmp.a".
and GMP header file found in "/usr/local/gmp-4.2.1-static/include/gmp.h" 
Configuration process complete: info saved in configuration/autoconf.mk
-----------------------------------------------------------------------

Everything is fine now. Just enter

 make

and the ApCoCoAServer as well as the ApCoCoALib should be build.

In case of problems please complain in the forum.

You can optionally compile with LinBox support. You should check out 1.1.3svn, the 1.1.3 release does not work. To compile LinBox support set the following:

LINBOXFLAGS=-DUSELinBox

Building External Dependencies

Windows

Compilers

MSVC 2003, MSVC 2005, Intel C++, Cygwin

CoCoALib

Build from source, prebuild packages for MSVC 2005, MSVC 2003, Cygwin

GMP

Brian Gladman's build for MSVC, from source for Cygwin/MinGW.

BLAS/Lapack

Cygwin ships with BLAS and Lapack from netlib.org compiled as a dynamic library. These are regularly tested and do work well. Alterntively you can compile ATLAS, but there are occasional linker issues.

If you use the Microsoft's compilers you can use the Intel MKL, GotoBLAS or ATLAS 3.8.0. It is also possible to build netlib.org's BLAS and Lapack using a Fortran compiler from Intel.

LinBox

Build from source, Cygwin only at the moment. It is highly recommened that you build LinBox as a static library, there have been linking issues with a dynamic LinBox in the past. You might also need to tweak LinBox's m4 BLAS detection macros when using netlib.org's BLAS and Lapack.

Linux

Compilers

g++ 3.3 up to 4.2

CoCoALib

Build from source

GMP

Distribution package, build from source

BLAS/Lapack

Distribution package, build from source: ATLAS, netlib.org, GotoBLAS, IntelMKL

LinBox

build from source

MacOSX

Compilers

Xcode 2.4.1 recommened

CoCoALib

Build from source

GMP

build from source, can be tricky, need the right patch and working xcode

BLAS/Lapack

AccelerateFrameWork recommended (installed per default). Also possible: build from sources: ATLAS, netlib.org installer: IntelMKL

LinBox

build from source

Solaris/UNIX

Compilers

g++ 3.3 up to 4.2, SunPro compiler difficult to use due to problem with gmpxx.h

CoCoALib

Build from source

GMP

Distribution package, build from source

BLAS/Lapack

recommneded: SunPerfLib build from sources: ATLAS, netlib.org

LinBox

build from source

ToDo

  • configure no longer errors out, but write a warning
  • make links to targz'ed libraries available