Difference between revisions of "ApCoCoALib:CompilationInstructions"

From ApCoCoAWiki
(Updated description)
(Corrected example lib.config)
Line 41: Line 41:
 
   #IMLFLAGS=$(IMLFLAGS) -I"/home/skaspar/lib/iml-1.0.2/include"
 
   #IMLFLAGS=$(IMLFLAGS) -I"/home/skaspar/lib/iml-1.0.2/include"
 
    
 
    
   IMLFLAGS=$(IMLFLAGS)  # Can be left empty if you do not
+
   IMLFLAGS:=$(IMLFLAGS)  # Can be left empty if you do not
                        # want to use IML-driven
+
                          # want to use IML-driven
                        # computations
+
                          # computations
 
    
 
    
 
   # Linker flags of your IML library plus linker flags of
 
   # Linker flags of your IML library plus linker flags of
Line 63: Line 63:
 
   #            -I"/home/skaspar/lib/linbox-1.1.6/include" \
 
   #            -I"/home/skaspar/lib/linbox-1.1.6/include" \
 
   #            -I"/home/skaspar/lib/givaro-3.2.13rc1/include"
 
   #            -I"/home/skaspar/lib/givaro-3.2.13rc1/include"
   LINBOXFLAGS=$(LINBOXFLAGS)  # Can be left empty if you
+
   LINBOXFLAGS:=$(LINBOXFLAGS)  # Can be left empty if you
                              # do not want to use LinBox-
+
                                # do not want to use LinBox-
                              # driven computations
+
                                # driven computations
 
    
 
    
 
   # Linker flags of your LinBox library plus linker flags
 
   # Linker flags of your LinBox library plus linker flags
Line 79: Line 79:
 
   # to use the BLAS and Lapack libraries
 
   # to use the BLAS and Lapack libraries
 
   NUMFLAGS=-DUSENoLapack
 
   NUMFLAGS=-DUSENoLapack
 +
 
 
   # Uncomment the following flag if you want to use
 
   # Uncomment the following flag if you want to use
 
   # the BLAS and Lapack libraries and you are using
 
   # the BLAS and Lapack libraries and you are using

Revision as of 15:53, 19 November 2008

This page describes how to compile the ApCoCoALib as of 0.99.08. To compile ApCoCoALib with Windows, please consider HowTo:Compile_ApCoCoALib_on_Windows

Requirements

You need the following libraries:

  • CoCoALib 0.99.21
  • 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, Givaro, and Lapack as well as the C++ GMP wrapper library. You need at least LinBox 1.1.6 released on September 22nd, 2008.
  • Boost: The Boost libraries program_options and thread are needed for the Border Basis Framework. The version number of Boost should be at least 1.35.
  • IML: If you want to use IML-driven computations.

The Config File

ApCoCoALib lets you choose which of the optional features you want to compile in a very flexible way. Usually you store all build related configuration parameters in a file called lib.config and pass its location to the configure script via the --with-libconfig= parameter. The lib.config file looks as follows.

 # Uncomment the following flag if you want to use the
 # Border Basis Framework
 #BBFFLAGS=-DUSEBBFramework
 
 # Path to your Boost library include directory, e.g.
 #BBFINCLUDES=-I"/home/skaspar/lib/boost_1_36_0/include/boost-1_36"
 BBFINCLUDES=   # Can be left empty if you do not want to use
                # the Border Basis Framework
 
 # Linker flags of your Boost program_options and thread
 # libraries plus linker flags of additional libraries needed
 # by Boost, e.g.
 #BBFLIBS="/home/skaspar/lib/boost_1_36_0/lib/libboost_program_options-gcc41-mt.a" \
 #        "/home/skaspar/lib/boost_1_36_0/lib/libboost_thread-gcc41-mt.a" \
 #        -lpthread
 BBFLIBS=   # Can be left empty if you do not want to use
            # the Border Basis Framework
 
 # Uncomment the following flag if you want to use
 # IML-driven computations    
 #IMLFLAGS=-DUSEIML
 
 # Path to your IML include directory, e.g.
 #IMLFLAGS=$(IMLFLAGS) -I"/home/skaspar/lib/iml-1.0.2/include"
 
 IMLFLAGS:=$(IMLFLAGS)   # Can be left empty if you do not
                         # want to use IML-driven
                         # computations
 
 # Linker flags of your IML library plus linker flags of
 # additional libraries needed by IML, e.g.
 #IMLLIBS="/home/skaspar/lib/iml-1.0.2/lib/libiml.a" \
 #        -lcblas \
 #        -latlas \
 #        "/usr/lib/libgmp.a"
 IMLLIBS=  # Can be left empty if you do not want to use
           # IML driven computations
 
 # Uncomment the following flag if you want to use LinBox-
 # driven computations
 #LINBOXFLAGS=-DUSELinBox
 
 # Path to your LinBox include directory plus path to
 # additional include directories needed by LinBox, e.g.
 #LINBOXFLAGS=$(LINBOXFLAGS) \
 #            -I"/home/skaspar/lib/linbox-1.1.6/include" \
 #            -I"/home/skaspar/lib/givaro-3.2.13rc1/include"
 LINBOXFLAGS:=$(LINBOXFLAGS)   # Can be left empty if you
                               # do not want to use LinBox-
                               # driven computations
 
 # Linker flags of your LinBox library plus linker flags
 # of additional libraries needed by LinBox, e.g. 
 #LINBOXLIBS=/home/skaspar/lib/linbox-1.1.6/lib/liblinbox.a \
 #           -lgmpxx \
 #           /home/skaspar/lib/givaro-3.2.13rc1/lib/libgivaro.a
 LINBOXLIBS=   # Can be left empty if you do not
               # want to use LinBox-driven
               # computations
 
 # Uncomment the following flag if you do not want
 # to use the BLAS and Lapack libraries
 NUMFLAGS=-DUSENoLapack
 
 # Uncomment the following flag if you want to use
 # the BLAS and Lapack libraries and you are using
 # Linux or Cygwin
 #NUMFLAGS=-DUSEF77Lapack
 
 # Uncomment the following flag if you want to use
 # the BLAS and Lapack libraries provided by the
 # Accelerate Framework on MacOSX
 #NUMFLAGS=-DUSEAccFW
 
 # Linker flags of your BLAS and Lapack libraries
 # plus linker flags of additional libraries needed
 # by BLAS and/or Lapack on a Linux or cygwin system,
 # e.g.
 #NUMLIBS=-llapack -lblas -latlas
 NUMLIBS=   # Can be left empty if you do
            # not want to use the BLAS and
            # Lapack libraries on a Linux
            # or cygwin system
 
 # Linker flags of your BLAS and Lapack libraries
 # plus linker flags of additional libraries needed
 # by BLAS and/or Lapack provided by the Accelerate
 # Framework on a MacOSX system, e.g.
 #NUMLIBS=-bind_at_load -framework accelerate
 NUMLIBS=   # Can be left empty if you do
            # not want to use the BLAS and
            # Lapack libraries provided by
            # the Accelerate Framework on
            # MacOSX

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