Difference between revisions of "ApCoCoALib:CompilationInstructions"
S schuster (talk | contribs) m |
|||
(59 intermediate revisions by 10 users not shown) | |||
Line 1: | Line 1: | ||
− | This page describes how to compile the ApCoCoALib | + | This page describes how to compile the most recent version of ApCoCoALib which you can check out from our [[ApCoCoA:SourceCodeManagement|subversion repository]]. To compile the versions which you can find under [[ApCoCoA:Downloads|Downloads]] please follow also these instructions but with respect to the respective build specifications. |
− | |||
=Requirements= | =Requirements= | ||
You need at least the following libraries: | You need at least the following libraries: | ||
− | + | ||
− | + | {| class="wikitable" style="background: #E0E0E0; border: 1px solid rgb(153, 153, 153); text-align: center; border=1; cellpadding=0; border-collapse:collapse;" | |
− | + | |- | |
+ | ! width="10%" | Library !! width="15%" | Recommended !! width ="15%" | Minimum !! width="20%" | Dependencies !! width="25%" | Notes | ||
+ | |- | ||
+ | | [http://cocoa.dima.unige.it/cocoalib/changelog-0.99.html CoCoALib] || 0.99.28 || - || GMP || - | ||
+ | |- | ||
+ | | [http://gmplib.org/ GMP] || [ftp://ftp.gmplib.org/pub/ 4.3.1] || [ftp://ftp.gmplib.org/pub/ 4.2.4] || 4.1.4 || [http://www.gnu.org/software/m4/ M4], [http://www.gnu.org/software/libtool/ libtool] || - | ||
+ | |- | ||
+ | | [http://www.boost.org/ Boost] || 1.39 || 1.36 || none || System, Filesystem & Thread needed for ApCoCoA-Server | ||
+ | |- | ||
+ | |} | ||
+ | |||
Optional: | Optional: | ||
− | + | ||
− | + | {| class="wikitable" style="background: #E0E0E0; border: 1px solid rgb(153, 153, 153); text-align: center; border=1; cellpadding=0; border-collapse:collapse;" | |
− | + | |- | |
− | + | ! width="10%" | Library !! width="15%" | Recommended !! width ="15%" | Minimum !! width="20%" | Dependencies !! width="25%" | Notes | |
− | + | |- | |
− | + | | [http://www.netlib.org/blas/ BLAS] || ? || ? || none || for ABM & numerical functions | |
− | + | |- | |
+ | | [http://www.netlib.org/lapack/ Lapack] || 3.2.1 || - || BLAS || for ABM & numerical functions | ||
+ | |- | ||
+ | | [http://www.linalg.org/ LinBox] || 1.1.6 || 1.1.6 || BLAS, Givaro, Lapack, GMP, [http://www.gnu.org/software/libtool/ libtool] || - | ||
+ | |- | ||
+ | | [http://www.boost.org/ Boost] || 1.39 || 1.36 || none || Thread & Program Options needed for Border Basis Framework | ||
+ | |- | ||
+ | | [http://www.cs.uwaterloo.ca/~astorjoh/iml.html IML] || 1.0.2 || 1.0.2 || GMP, ATLAS, [http://www.gnu.org/software/libtool/ libtool] || - | ||
+ | |- | ||
+ | | [http://www-lmc.imag.fr/CASYS/LOGICIELS/givaro/ Givaro] || 3.2.16 || 3.2 || none || - | ||
+ | |- | ||
+ | | [http://math-atlas.sourceforge.net/ ATLAS] || 3.8.3 (stable) || 3.8.3 || none || - | ||
+ | |- | ||
+ | |} | ||
=The Config File= | =The Config File= | ||
Line 125: | Line 147: | ||
=Step by Step build instructions= | =Step by Step build instructions= | ||
− | Get a copy of the sources for CoCoALib and ApCoCoALib, for | + | |
+ | ==New: Building ApCoCoA with CMake== | ||
+ | Get a copy of the sources for CoCoALib from http://cocoa.dima.unige.it/cocoalib/changelog-0.99.html and ApCoCoALib from the [[ApCoCoA:SourceCodeManagement|subversion repository]]. | ||
+ | |||
+ | $> svn co svn://apcocoa.org/ ApCoCoA | ||
+ | |||
+ | Build the CoCoALib. You should consult the CoCoALib documentation in case of problems. | ||
+ | |||
+ | Go to the ApCoCoA directory and do the following (note again that CMake 2.6 is required). | ||
+ | Making the directory <code>build</code> may seem strange at first, however, it has the advantage that all generated code resides only within this directory and the original <code>src</code>-directory is not polluted. | ||
+ | |||
+ | $> cd ApCoCoA | ||
+ | $> mkdir build | ||
+ | $> cd build | ||
+ | $> ccmake .. | ||
+ | |||
+ | <code>ccmake</code> starts an curses dialog that allows you to configure the necessary project settings. See also the [[cmake documentation]] | ||
+ | |||
+ | |||
+ | # Type <code>c</code>. Starting <code>ccmake</code> the first time, this will probably raise some errors which is ok when your libraries are not in standard locations. | ||
+ | # Edit the respective lines (type <code>Enter</code> to edit). In particular, you should provide the paths to Boost and the CoCoA directory (see below). In case you must also supply compiler flags such as <code>-m64</code>, type t to toggle between the initial "sparse" item selection and the full variable selection. | ||
+ | # Type <code>c</code>. If errors occur, go to step 2. If no errors occur, type <code>e</code>. | ||
+ | # Type <code>g</code>. | ||
+ | |||
+ | Finally, | ||
+ | |||
+ | $> make | ||
+ | |||
+ | The tests will have to be started explicitly: | ||
+ | $> make check | ||
+ | or | ||
+ | $> ctest -V | ||
+ | |||
+ | where <code>-V</code> also prints the output of the test scripts. | ||
+ | |||
+ | |||
+ | We conclude with the description of the most common flags to be set with <code>ccmake</code> | ||
+ | |||
+ | * <code>APCOCOA_USE_*</code> Setting one or more of these to <code>ON</code> will (after <code>c</code>) turn on more flags to be set. | ||
+ | * <code>COCOA_ROOT</code> Must be set to the CoCoA directory which contains the folders <code>lib</code> and <code>include</code>. | ||
+ | * <code>BOOST_ROOT</code> must be set to the directory containing the boost <code>lib</code> and <code>include</code> directories. | ||
+ | * <code>Boost_USE_STATIC_LIBS</code> must be set to <code>ON</code>. | ||
+ | * <code>GMP_LIBRARY</code>, <code>GMP_LIBRARY_DIR</code> must be set to the static GMP libraries. | ||
+ | * <code>CMAKE_CXX_FLAGS</code> Add here <code>-m64</code> and the like. | ||
+ | * <code>CMAKE_EXE_LINKER_FLAGS</code> Add here additional linker flags like <code>-pthread</code> or (on Mac) <code>-bind_at_load -framework accelerate</code>. | ||
+ | * <code>ENABLE_TESTING</code> If set to <code>OFF</code> the tests in <code>src/Tests</code> will not be compiled. | ||
+ | |||
+ | Advanced usage of CMake is collected on the page [[ApCoCoALib:Working_with_CMake|Working with CMake]] | ||
+ | |||
+ | ==Old: Building ApCoCoA== | ||
+ | Get a copy of the sources for CoCoALib from http://cocoa.dima.unige.it/cocoalib/changelog-0.99.html and ApCoCoALib from the [[ApCoCoA:SourceCodeManagement|subversion repository]]. | ||
Build the CoCoALib. You should consult the CoCoALib documentation in case of problems. | Build the CoCoALib. You should consult the CoCoALib documentation in case of problems. | ||
Line 175: | Line 247: | ||
=Building External Dependencies= | =Building External Dependencies= | ||
+ | |||
+ | ==Visualization of the build dependencies== | ||
+ | The arrows of the following pictures indicate the order of the libraries to be built, e.g. you have to build the GMP before CoCoALib. | ||
+ | [[Image:Build_ApCoCoA.png|center|600px]] | ||
+ | |||
+ | ==Linux example build (Fedora 18 with gcc-4.7.2)== | ||
+ | |||
+ | Go to the directory all source files should be downloaded in. Let <ApCoCoA-PATH> be the path to this directory. | ||
+ | |||
+ | This guide installs all libraries in the '''default directories''', i.e. using the '''prefix /usr/local/'''. If you want to install the files somewhere else, use the appropriate flags during the build process of the packages. | ||
+ | |||
+ | Note: You must have '''admin'' rights to perform all steps of this guide and all lines starting with #. are comments. | ||
+ | |||
+ | Use your package manager to install the necessary packages; e.g. | ||
+ | yum install bzip2 cmake gcc-c++ gdb gfortran glibc-static gnome-applets libtool libgfortran-static libstdc++-static make patch subversion zlib | ||
+ | |||
+ | ===GMP (5.0.5)=== | ||
+ | wget ftp://ftp.gmplib.org/pub/gmp-5.0.5/gmp-5.0.5.tar.bz2 | ||
+ | tar -xjvf gmp-5.0.5.tar.bz2 | ||
+ | cd gmp-5.0.5 | ||
+ | ./configure --enable-cxx | ||
+ | make | ||
+ | make check | ||
+ | make install | ||
+ | cd .. | ||
+ | |||
+ | ===CoCoALib (0.9945)=== | ||
+ | wget http://cocoa.dima.unige.it/cocoalib/tgz/CoCoALib-0.9945.tgz | ||
+ | tar -xzvf CoCoALib-0.9945.tgz | ||
+ | cd CoCoALib-0.9945 | ||
+ | ./configure --with-libgmp=/usr/local/lib/libgmp.a | ||
+ | make | ||
+ | cd .. | ||
+ | |||
+ | ===Boost (1.53.0)=== | ||
+ | wget --trust-server-name http://sourceforge.net/projects/boost/files/boost/1.53.0/boost_1_53_0.tar.bz2/download | ||
+ | tar -xjvf boost_1_53_0.tar.bz2 | ||
+ | cd boost_1_53_0 | ||
+ | ./bootstrap.sh | ||
+ | ./bjam install | ||
+ | cd .. | ||
+ | |||
+ | ===Lapack (3.4.1)=== | ||
+ | wget http://www.netlib.org/lapack/lapack-3.4.1.tgz | ||
+ | tar -xzvf lapack-3.4.1.tgz | ||
+ | cd lapack-3.4.1 | ||
+ | cmake . | ||
+ | make | ||
+ | make install | ||
+ | cd .. | ||
+ | |||
+ | ===Givaro (3.2.16)=== | ||
+ | tar -xzvf givaro-3.2.16.tar.gz | ||
+ | cd givaro-3.2.16 | ||
+ | # the -fpermissive flag is necessary for gcc-4.7.x | ||
+ | ./configure CXX_FLAGS=-fpermissive | ||
+ | make | ||
+ | # Note: After '''make check''', some errors might occur. This is no problem for the build. | ||
+ | make check | ||
+ | make install | ||
+ | cd .. | ||
+ | |||
+ | ===ATLAS (3.10.0)=== | ||
+ | wget --trust-server-name http://sourceforge.net/projects/math-atlas/files/Stable/3.10.0/atlas3.10.0.tar.bz2/download | ||
+ | tar -xjvf atlas3.10.0.tar.bz2 | ||
+ | cd ATLAS | ||
+ | mkdir ATLAS_build | ||
+ | cd ATLAS_build | ||
+ | # If CPU throttling is activated, you have to turn it off. | ||
+ | cpufreq-selector -g performance | ||
+ | ../configure | ||
+ | make | ||
+ | make check | ||
+ | make install | ||
+ | # If CPU throttling has been deactivated, you have to turn it on again. | ||
+ | cpufreq-selector -g ondemand | ||
+ | cd ../.. | ||
+ | |||
+ | ===LinBox (1.1.6)=== | ||
+ | wget http://www.linalg.org/linbox-1.1.6.tar.gz | ||
+ | tar -xzvf linbox-1.1.6.tar.gz | ||
+ | cd linbox-1.1.6 | ||
+ | wget ftp://apcocoa.org/pub/patches/1.1.6-multiple-definitions-fix_301008.patch | ||
+ | patch -p1 -i 1.1.6-multiple-definitions-fix_301008.patch | ||
+ | # the -fpermissive flag is necessary for gcc-4.7.x | ||
+ | ./configure CXX_FLAGS=-fpermissive --with-blas=/usr/local/atlas | ||
+ | make | ||
+ | make check | ||
+ | make install | ||
+ | cd .. | ||
+ | |||
+ | ===IML (1.0.3)=== | ||
+ | wget http://www.cs.uwaterloo.ca/~astorjoh/iml-1.0.3.tar.gz | ||
+ | tar -xzvf iml-1.0.3.tar.gz | ||
+ | cd iml-1.0.3 | ||
+ | ./configure --with-atlas-include=/usr/local/atlas/include/ --with-atlas-lib=/usr/local/atlas/lib/ | ||
+ | make | ||
+ | make check | ||
+ | make install | ||
+ | cd .. | ||
+ | |||
+ | ===TBB (2013-03-14)=== | ||
+ | wget http://threadingbuildingblocks.org/sites/default/files/software_releases/source/tbb41_20130314oss_src.tgz | ||
+ | tar -xzvf tbb41_20130314oss_src.tgz | ||
+ | cd tbb41_20130314oss | ||
+ | make | ||
+ | # cd build/linux_<system-specific>_release; e.g. | ||
+ | cd build/linux_intel64_gcc_cc4.7.2_libc2.16_kernel3.8.11_release | ||
+ | ar rcs libtbb.a concurrent_hash_map.o concurrent_queue.o concurrent_vector.o dynamic_link.o itt_notify.o \ | ||
+ | cache_aligned_allocator.o pipeline.o queuing_mutex.o queuing_rw_mutex.o reader_writer_lock.o \ | ||
+ | spin_rw_mutex.o spin_mutex.o critical_section.o task.o tbb_misc.o tbb_misc_ex.o mutex.o recursive_mutex.o \ | ||
+ | condition_variable.o tbb_thread.o concurrent_monitor.o semaphore.o private_server.o rml_tbb.o \ | ||
+ | task_group_context.o governor.o market.o arena.o scheduler.o observer_proxy.o tbb_statistics.o \ | ||
+ | tbb_main.o concurrent_vector_v2.o concurrent_queue_v2.o spin_rw_mutex_v2.o task_v2.o | ||
+ | cd ../../.. | ||
+ | |||
+ | ===PGBC (v0.8)=== | ||
+ | wget http://github.com/svrnm/parallelGBC/archive/v0.8.zip | ||
+ | unzip v0.8.zip | ||
+ | cd parallelGBC-0.8 | ||
+ | # Note: Using relative paths, you have to add ../ as prefix to the path (like in the example). | ||
+ | # Change the following lines in Makefile.rules as follows (using your specific TBB path); e.g. | ||
+ | # TCMALLOC = | ||
+ | # CXXFLAGS = -fPIC -Wall -fopenmp -O2 -pipe -std=c++0x -I../../tbb41_20130314oss/include \ | ||
+ | # -L../../tbb41_20130314oss/build linux_intel64_gcc_cc4.7.2_libc2.16_kernel3.8.11_release/ | ||
+ | make | ||
+ | cd .. | ||
+ | |||
+ | ===PGBC (v0.8 in the case that the SSE instruction set is not enabled)=== | ||
+ | wget http://github.com/svrnm/parallelGBC/archive/v0.8.zip | ||
+ | unzip v0.8.zip | ||
+ | cd parallelGBC-0.8 | ||
+ | wget ftp://apcocoa.org/pub/patches/sse.patch | ||
+ | patch -p1 -i sse.patch | ||
+ | # Note: Using relative paths, you have to add ../ as prefix to the path (like in the example). | ||
+ | # Change the following lines in Makefile.rules as follows (using your specific TBB path); e.g. | ||
+ | # TCMALLOC = | ||
+ | # CXXFLAGS = -fPIC -Wall -fopenmp -O2 -pipe -std=c++0x -I../../tbb41_20130314oss/include \ | ||
+ | # -L../../tbb41_20130314oss/build linux_intel64_gcc_cc4.7.2_libc2.16_kernel3.8.11_release/ | ||
+ | make | ||
+ | cd .. | ||
+ | |||
+ | ===ApCoCoALib (nightly)=== | ||
+ | Note: You must always use static libraries (*.a files) to build ApCoCoALib. | ||
+ | svn co https://www.apcocoa.org/svn/ApCoCoALib/trunk | ||
+ | mv trunk ApCoCoALib | ||
+ | cd ApCoCoALib | ||
+ | mkdir ApCoCoALib_build | ||
+ | cd ApCoCoALib_build | ||
+ | ccmake .. | ||
+ | # Use the GUI to configure your paths appropriately, where | ||
+ | # [<button>] means push button <button> and | ||
+ | # <option>=<value> means that you have to set <option> to <value> . | ||
+ | # [c]; [e] | ||
+ | # APCOCOALIB_BUILD_BBF=ON | ||
+ | # APCOCOALIB_ENABLE_NUMERICAL=ON | ||
+ | # APCOCOALIB_USE_IML=ON | ||
+ | # APCOCOALIB_USE_LINBOX=ON | ||
+ | # APCOCOALIB_USE_PGBC=ON | ||
+ | # COCOALIB_ROOT=<ApCoCoA-PATH>/CoCoALib-0.9945 | ||
+ | # [c]; [e] | ||
+ | # PGBC_INCLUDE_DIR=<ApCoCoA-PATH>/parallelGBC-0.8/include | ||
+ | # PGBC_LIBRARY=<ApCoCoA-PATH>/parallelGBC-0.8/lib/libf4.a | ||
+ | # [c]; [e] | ||
+ | # TBB_INCLUDE_DIR=<ApCoCoA-PATH>/tbb41_20130314oss/include | ||
+ | # TBB_LIBRARY=<ApCoCoA-PATH>/tbb41_20130314oss/build/linux_intel64_gcc_cc4.7.2_libc2.16_kernel3.8.11_release/libtbb.a | ||
+ | # [c]; [e]; [t] | ||
+ | # Set additional libraries for the linker; e.g. | ||
+ | # ADD_LINK_LIBS=/lib/gcc/x86_64-redhat-linux/4.7.2/libgfortran.a;/lib64/librt.a | ||
+ | # (The absolute path to lingfortran.a is necessary to fix compile errors of the form "'undefined reference to '_gfortran_*'".) | ||
+ | # (The absolute path to librt.a is necessary to fix compile errors of the form "undefined reference to 'clock_gettime'".) | ||
+ | # Set additional c++ compiler flags; e.g. | ||
+ | # CMAKE_CXX_FLAGS=-fpermissive | ||
+ | # (This flag is necessary if you want to buil ApCoCoA with Givaro/LinBox.) | ||
+ | # [c]; [e] | ||
+ | # [c]; [e]; [g] | ||
+ | make | ||
+ | make check | ||
+ | make examples | ||
==Windows== | ==Windows== | ||
Line 186: | Line 437: | ||
===GMP=== | ===GMP=== | ||
Brian Gladman's build for MSVC, from source for Cygwin/MinGW. | Brian Gladman's build for MSVC, from source for Cygwin/MinGW. | ||
+ | |||
+ | '''Note:''' Check if the programs '''bison''', '''flex''', '''m4''' and '''libtool''' are installed in cygwin. | ||
+ | |||
+ | ./configure --enable-cxx --host=i386-pc-cygwin --prefix=(install-dir) | ||
+ | make | ||
+ | make check (important!!!) | ||
+ | make install | ||
===BLAS/Lapack=== | ===BLAS/Lapack=== | ||
Line 191: | Line 449: | ||
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. | 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. | ||
+ | |||
+ | ===ATLAS=== | ||
+ | cd atlas-dir | ||
+ | mkdir ATLAS_build | ||
+ | cd ATLAS_build | ||
+ | ../configure -A 6 -V 1 -b 32 --prefix=(install-dir) | ||
+ | make | ||
+ | make check | ||
+ | make install | ||
+ | |||
+ | ===IML=== | ||
+ | ./configure --prefix=(install-dir) --host=i386-pc-cygwin --with-gmp-include= --with-gmp-lib= --with-atlas-include= --with-atlas-lib= | ||
+ | make | ||
+ | make check | ||
+ | make install | ||
+ | '''Note:''' Check if libtool is installed. Might lead to problems if it's not found. | ||
===LinBox=== | ===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. | 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. | ||
+ | |||
+ | '''Note:''' Check if libtool is installed. Might lead to problems if it's not found. | ||
==Linux== | ==Linux== | ||
Line 201: | Line 477: | ||
===CoCoALib=== | ===CoCoALib=== | ||
− | Build from source | + | Build from source. |
+ | |||
+ | ./configure --with-libgmp=(path-to-libgmp.a) | ||
+ | make | ||
===GMP=== | ===GMP=== | ||
− | Distribution package, build from source | + | Distribution package, build from source. |
+ | |||
+ | ./configure --enable-cxx --prefix=(install-dir) | ||
+ | make | ||
+ | make check '''(important!!!)''' | ||
+ | make install | ||
+ | |||
+ | '''Note:''' --enable-cxx gives you C++ support. This is important for some of the optional libs. Check if libtool is installed on your system. The configure script makes some entries to libtool that are needed later for the configure script of linbox. | ||
===BLAS/Lapack=== | ===BLAS/Lapack=== | ||
Line 216: | Line 502: | ||
mkdir ATLAS_build | mkdir ATLAS_build | ||
cd ATLAS_build | cd ATLAS_build | ||
− | ../configure | + | ../configure --prefix=(install-dir) -b 32 (or -b 64 for 64 Bit support) |
make | make | ||
+ | make check | ||
make install | make install | ||
Line 226: | Line 513: | ||
===LinBox=== | ===LinBox=== | ||
− | + | Distribution package. Build from source. | |
+ | |||
+ | ./configure --prefix=(install-dir) --with-blas=(atlas-dir) --with-givaro=... --with-gmp=... | ||
+ | make | ||
+ | make check | ||
+ | make install | ||
+ | |||
+ | '''Note:''' Apply the [http://www.apcocoa.org/forum/viewtopic.php?f=20&t=983 Patch] from the Forum, see 2nd Post. This fixes the multiple definiton errors. | ||
+ | |||
+ | ===Givaro=== | ||
+ | Distribution package. Build from source. | ||
+ | ./configure --prefix=(install-dir) --with-gmp=(gmp-dir) | ||
+ | make | ||
+ | make check | ||
+ | make install | ||
==MacOSX== | ==MacOSX== |
Latest revision as of 17:32, 16 May 2013
This page describes how to compile the most recent version of ApCoCoALib which you can check out from our subversion repository. To compile the versions which you can find under Downloads please follow also these instructions but with respect to the respective build specifications.
Requirements
You need at least the following libraries:
Library | Recommended | Minimum | Dependencies | Notes | |
---|---|---|---|---|---|
CoCoALib | 0.99.28 | - | GMP | - | |
GMP | 4.3.1 | 4.2.4 | 4.1.4 | M4, libtool | - |
Boost | 1.39 | 1.36 | none | System, Filesystem & Thread needed for ApCoCoA-Server |
Optional:
Library | Recommended | Minimum | Dependencies | Notes |
---|---|---|---|---|
BLAS | ? | ? | none | for ABM & numerical functions |
Lapack | 3.2.1 | - | BLAS | for ABM & numerical functions |
LinBox | 1.1.6 | 1.1.6 | BLAS, Givaro, Lapack, GMP, libtool | - |
Boost | 1.39 | 1.36 | none | Thread & Program Options needed for Border Basis Framework |
IML | 1.0.2 | 1.0.2 | GMP, ATLAS, libtool | - |
Givaro | 3.2.16 | 3.2 | none | - |
ATLAS | 3.8.3 (stable) | 3.8.3 | none | - |
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.
###################### # Mandatory settings # ###################### # Path to your Boost library include directory, e.g. #BOOSTFLAGS=-I"/home/skaspar/lib/boost_1_38_0/include/boost-1_38" BOOSTFLAGS= # Mandatory, cannot be left empty # Linker flags of your Boost thread libraries plus linker flags of # additional libraries needed by Boost, e.g. #BOOSTLIBS="/home/skaspar/lib/boost_1_38_0/lib/libboost_thread-gcc43-mt.a" \ # -lpthread BOOSTLIBS= # Mandatory, cannot be left empty ##################### # Optional features # ##################### # Uncomment the following flag if you want to use the # Border Basis Framework #BBFFLAGS=-DUSEBBFramework BBFFLAGS= # 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_38_0/lib/libboost_program_options-gcc43-mt.a" \ # "/home/skaspar/lib/boost_1_38_0/lib/libboost_thread-gcc43-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. # # Example flags on a Linux or cygwin system #NUMLIBS=-llapack -lblas -latlas # # Example flags on a MacOSX system using the # the Accelerate Framework #NUMLIBS=-bind_at_load -framework accelerate NUMLIBS= # Can be left empty if you do # not want to use the BLAS and # Lapack libraries
Step by Step build instructions
New: Building ApCoCoA with CMake
Get a copy of the sources for CoCoALib from http://cocoa.dima.unige.it/cocoalib/changelog-0.99.html and ApCoCoALib from the subversion repository.
$> svn co svn://apcocoa.org/ ApCoCoA
Build the CoCoALib. You should consult the CoCoALib documentation in case of problems.
Go to the ApCoCoA directory and do the following (note again that CMake 2.6 is required).
Making the directory build
may seem strange at first, however, it has the advantage that all generated code resides only within this directory and the original src
-directory is not polluted.
$> cd ApCoCoA $> mkdir build $> cd build $> ccmake ..
ccmake
starts an curses dialog that allows you to configure the necessary project settings. See also the cmake documentation
- Type
c
. Startingccmake
the first time, this will probably raise some errors which is ok when your libraries are not in standard locations. - Edit the respective lines (type
Enter
to edit). In particular, you should provide the paths to Boost and the CoCoA directory (see below). In case you must also supply compiler flags such as-m64
, type t to toggle between the initial "sparse" item selection and the full variable selection. - Type
c
. If errors occur, go to step 2. If no errors occur, typee
. - Type
g
.
Finally,
$> make
The tests will have to be started explicitly:
$> make check
or
$> ctest -V
where -V
also prints the output of the test scripts.
We conclude with the description of the most common flags to be set with ccmake
APCOCOA_USE_*
Setting one or more of these toON
will (afterc
) turn on more flags to be set.COCOA_ROOT
Must be set to the CoCoA directory which contains the folderslib
andinclude
.BOOST_ROOT
must be set to the directory containing the boostlib
andinclude
directories.Boost_USE_STATIC_LIBS
must be set toON
.GMP_LIBRARY
,GMP_LIBRARY_DIR
must be set to the static GMP libraries.CMAKE_CXX_FLAGS
Add here-m64
and the like.CMAKE_EXE_LINKER_FLAGS
Add here additional linker flags like-pthread
or (on Mac)-bind_at_load -framework accelerate
.ENABLE_TESTING
If set toOFF
the tests insrc/Tests
will not be compiled.
Advanced usage of CMake is collected on the page Working with CMake
Old: Building ApCoCoA
Get a copy of the sources for CoCoALib from http://cocoa.dima.unige.it/cocoalib/changelog-0.99.html and ApCoCoALib from the subversion repository.
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.
Again, please note that
- the CoCoALib directory must be named as CoCoALib-0.99
- the CoCoALib and ApCoCoALib directory must reside in the same directory.
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
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.
Building External Dependencies
Visualization of the build dependencies
The arrows of the following pictures indicate the order of the libraries to be built, e.g. you have to build the GMP before CoCoALib.
Linux example build (Fedora 18 with gcc-4.7.2)
Go to the directory all source files should be downloaded in. Let <ApCoCoA-PATH> be the path to this directory.
This guide installs all libraries in the default directories, i.e. using the prefix /usr/local/. If you want to install the files somewhere else, use the appropriate flags during the build process of the packages.
Note: You must have 'admin rights to perform all steps of this guide and all lines starting with #. are comments.
Use your package manager to install the necessary packages; e.g.
yum install bzip2 cmake gcc-c++ gdb gfortran glibc-static gnome-applets libtool libgfortran-static libstdc++-static make patch subversion zlib
GMP (5.0.5)
wget ftp://ftp.gmplib.org/pub/gmp-5.0.5/gmp-5.0.5.tar.bz2 tar -xjvf gmp-5.0.5.tar.bz2 cd gmp-5.0.5 ./configure --enable-cxx make make check make install cd ..
CoCoALib (0.9945)
wget http://cocoa.dima.unige.it/cocoalib/tgz/CoCoALib-0.9945.tgz tar -xzvf CoCoALib-0.9945.tgz cd CoCoALib-0.9945 ./configure --with-libgmp=/usr/local/lib/libgmp.a make cd ..
Boost (1.53.0)
wget --trust-server-name http://sourceforge.net/projects/boost/files/boost/1.53.0/boost_1_53_0.tar.bz2/download tar -xjvf boost_1_53_0.tar.bz2 cd boost_1_53_0 ./bootstrap.sh ./bjam install cd ..
Lapack (3.4.1)
wget http://www.netlib.org/lapack/lapack-3.4.1.tgz tar -xzvf lapack-3.4.1.tgz cd lapack-3.4.1 cmake . make make install cd ..
Givaro (3.2.16)
tar -xzvf givaro-3.2.16.tar.gz cd givaro-3.2.16 # the -fpermissive flag is necessary for gcc-4.7.x ./configure CXX_FLAGS=-fpermissive make # Note: After make check, some errors might occur. This is no problem for the build. make check make install cd ..
ATLAS (3.10.0)
wget --trust-server-name http://sourceforge.net/projects/math-atlas/files/Stable/3.10.0/atlas3.10.0.tar.bz2/download tar -xjvf atlas3.10.0.tar.bz2 cd ATLAS mkdir ATLAS_build cd ATLAS_build # If CPU throttling is activated, you have to turn it off. cpufreq-selector -g performance ../configure make make check make install # If CPU throttling has been deactivated, you have to turn it on again. cpufreq-selector -g ondemand cd ../..
LinBox (1.1.6)
wget http://www.linalg.org/linbox-1.1.6.tar.gz tar -xzvf linbox-1.1.6.tar.gz cd linbox-1.1.6 wget ftp://apcocoa.org/pub/patches/1.1.6-multiple-definitions-fix_301008.patch patch -p1 -i 1.1.6-multiple-definitions-fix_301008.patch # the -fpermissive flag is necessary for gcc-4.7.x ./configure CXX_FLAGS=-fpermissive --with-blas=/usr/local/atlas make make check make install cd ..
IML (1.0.3)
wget http://www.cs.uwaterloo.ca/~astorjoh/iml-1.0.3.tar.gz tar -xzvf iml-1.0.3.tar.gz cd iml-1.0.3 ./configure --with-atlas-include=/usr/local/atlas/include/ --with-atlas-lib=/usr/local/atlas/lib/ make make check make install cd ..
TBB (2013-03-14)
wget http://threadingbuildingblocks.org/sites/default/files/software_releases/source/tbb41_20130314oss_src.tgz tar -xzvf tbb41_20130314oss_src.tgz cd tbb41_20130314oss make # cd build/linux_<system-specific>_release; e.g. cd build/linux_intel64_gcc_cc4.7.2_libc2.16_kernel3.8.11_release ar rcs libtbb.a concurrent_hash_map.o concurrent_queue.o concurrent_vector.o dynamic_link.o itt_notify.o \ cache_aligned_allocator.o pipeline.o queuing_mutex.o queuing_rw_mutex.o reader_writer_lock.o \ spin_rw_mutex.o spin_mutex.o critical_section.o task.o tbb_misc.o tbb_misc_ex.o mutex.o recursive_mutex.o \ condition_variable.o tbb_thread.o concurrent_monitor.o semaphore.o private_server.o rml_tbb.o \ task_group_context.o governor.o market.o arena.o scheduler.o observer_proxy.o tbb_statistics.o \ tbb_main.o concurrent_vector_v2.o concurrent_queue_v2.o spin_rw_mutex_v2.o task_v2.o cd ../../..
PGBC (v0.8)
wget http://github.com/svrnm/parallelGBC/archive/v0.8.zip unzip v0.8.zip cd parallelGBC-0.8 # Note: Using relative paths, you have to add ../ as prefix to the path (like in the example). # Change the following lines in Makefile.rules as follows (using your specific TBB path); e.g. # TCMALLOC = # CXXFLAGS = -fPIC -Wall -fopenmp -O2 -pipe -std=c++0x -I../../tbb41_20130314oss/include \ # -L../../tbb41_20130314oss/build linux_intel64_gcc_cc4.7.2_libc2.16_kernel3.8.11_release/ make cd ..
PGBC (v0.8 in the case that the SSE instruction set is not enabled)
wget http://github.com/svrnm/parallelGBC/archive/v0.8.zip unzip v0.8.zip cd parallelGBC-0.8 wget ftp://apcocoa.org/pub/patches/sse.patch patch -p1 -i sse.patch # Note: Using relative paths, you have to add ../ as prefix to the path (like in the example). # Change the following lines in Makefile.rules as follows (using your specific TBB path); e.g. # TCMALLOC = # CXXFLAGS = -fPIC -Wall -fopenmp -O2 -pipe -std=c++0x -I../../tbb41_20130314oss/include \ # -L../../tbb41_20130314oss/build linux_intel64_gcc_cc4.7.2_libc2.16_kernel3.8.11_release/ make cd ..
ApCoCoALib (nightly)
Note: You must always use static libraries (*.a files) to build ApCoCoALib.
svn co https://www.apcocoa.org/svn/ApCoCoALib/trunk mv trunk ApCoCoALib cd ApCoCoALib mkdir ApCoCoALib_build cd ApCoCoALib_build ccmake .. # Use the GUI to configure your paths appropriately, where # [<button>] means push button <button> and # <option>=<value> means that you have to set <option> to <value> . # [c]; [e] # APCOCOALIB_BUILD_BBF=ON # APCOCOALIB_ENABLE_NUMERICAL=ON # APCOCOALIB_USE_IML=ON # APCOCOALIB_USE_LINBOX=ON # APCOCOALIB_USE_PGBC=ON # COCOALIB_ROOT=<ApCoCoA-PATH>/CoCoALib-0.9945 # [c]; [e] # PGBC_INCLUDE_DIR=<ApCoCoA-PATH>/parallelGBC-0.8/include # PGBC_LIBRARY=<ApCoCoA-PATH>/parallelGBC-0.8/lib/libf4.a # [c]; [e] # TBB_INCLUDE_DIR=<ApCoCoA-PATH>/tbb41_20130314oss/include # TBB_LIBRARY=<ApCoCoA-PATH>/tbb41_20130314oss/build/linux_intel64_gcc_cc4.7.2_libc2.16_kernel3.8.11_release/libtbb.a # [c]; [e]; [t] # Set additional libraries for the linker; e.g. # ADD_LINK_LIBS=/lib/gcc/x86_64-redhat-linux/4.7.2/libgfortran.a;/lib64/librt.a # (The absolute path to lingfortran.a is necessary to fix compile errors of the form "'undefined reference to '_gfortran_*'".) # (The absolute path to librt.a is necessary to fix compile errors of the form "undefined reference to 'clock_gettime'".) # Set additional c++ compiler flags; e.g. # CMAKE_CXX_FLAGS=-fpermissive # (This flag is necessary if you want to buil ApCoCoA with Givaro/LinBox.) # [c]; [e] # [c]; [e]; [g] make make check make examples
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.
Note: Check if the programs bison, flex, m4 and libtool are installed in cygwin.
./configure --enable-cxx --host=i386-pc-cygwin --prefix=(install-dir) make make check (important!!!) make install
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.
ATLAS
cd atlas-dir mkdir ATLAS_build cd ATLAS_build ../configure -A 6 -V 1 -b 32 --prefix=(install-dir) make make check make install
IML
./configure --prefix=(install-dir) --host=i386-pc-cygwin --with-gmp-include= --with-gmp-lib= --with-atlas-include= --with-atlas-lib= make make check make install
Note: Check if libtool is installed. Might lead to problems if it's not found.
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.
Note: Check if libtool is installed. Might lead to problems if it's not found.
Linux
Compilers
g++ 3.3 up to 4.2
CoCoALib
Build from source.
./configure --with-libgmp=(path-to-libgmp.a) make
GMP
Distribution package, build from source.
./configure --enable-cxx --prefix=(install-dir) make make check (important!!!) make install
Note: --enable-cxx gives you C++ support. This is important for some of the optional libs. Check if libtool is installed on your system. The configure script makes some entries to libtool that are needed later for the configure script of linbox.
BLAS/Lapack
Distribution package, build from source: ATLAS, netlib.org, GotoBLAS, IntelMKL
ATLAS
Build from source. Install instructions:
tar -xvzf atlas3.xx.tar.gz cd ATLAS mkdir ATLAS_build cd ATLAS_build ../configure --prefix=(install-dir) -b 32 (or -b 64 for 64 Bit support) make make check make install
Important: For compiling ATLAS you need an extra build-directory, that must be within the directory where you extracted your files to. Call the configure-script from within the build-directory, as noted above. For further informations see atlas_install.pdf in ATLAS/doc. Please also see the .pdf if you have some kind of special architecture like 64bit.
Note for Laptop-Users: You have to set you CPU power scheme to "performance", in order to have maximum speed for the tests, that are performed during the ATLAS compiling routine. If you have a DualCore remember to do this for both cores!
To change the power scheme you can use tools like cpufrequtils, normally found within the repository of your package manager.
LinBox
Distribution package. Build from source.
./configure --prefix=(install-dir) --with-blas=(atlas-dir) --with-givaro=... --with-gmp=... make make check make install
Note: Apply the Patch from the Forum, see 2nd Post. This fixes the multiple definiton errors.
Givaro
Distribution package. Build from source.
./configure --prefix=(install-dir) --with-gmp=(gmp-dir) make make check make install
MacOSX
The following steps were taken on an Apple MacBook (Intel Core 2 Duo), OS X 10.4.
Compilers
Xcode 2.4.1 recommened, for current releases we are using xcode 2.5.
CoCoALib
Build from source.
Boost
This might not be the best way to supply the '-m64' argument, but it works.
./configure [--prefix=<path>] ./tools/jam/src/bin.macosxx86/bjam -d+2 --user-config=user-config.jam architecture=x86 address-model=64 cxxflags=-m64 ./tools/jam/src/bin.macosxx86/bjam --user-config=user-config.jam --prefix=<> --exec-prefix=<> --libdir=<> --includedir=<> architecture=x86 address-model=64 cxxflags=-m64 install
GMP
build from source, can be tricky, need the right patch and working xcode. Try the following:
./configure [--prefix=<>] --enable-cxx make make check make install
BLAS/Lapack
AccelerateFrameWork recommended (installed per default). Also possible: build from sources: ATLAS, netlib.org installer: IntelMKL
LinBox
build from source
Givaro
./configure [--prefix=<>] --with-gmp=</path/to/dir> CXXFLAGS=-m64 make make install
In file givaro-config.h
the flag __GIVARO_GMP_NO_CXX
must not be set. Otherwise we got problems with wrong includes compiling ApCoCoA.
Linbox
Apply the patch given in http://www.apcocoa.org/forum/viewtopic.php?f=20&t=983
./configure --prefix=<> --with-gmp=<> --with-givaro=<> CXXFLAGS=-m64 make make install
IML
Now, that was quite involved. If anyone knows a better way to get IML compiled, please let us know.
./configure -prefix=<> --with-gmp-lib=<> --with-gmp-include=<> --with-atlas-include=<> --with-atlas-lib=<> CFLAGS=-m64
(Yes, its CFLAGS and _not_ CXXFLAGS) After configuring, do the following:
cp librepl.a repl cd repl/.libs ln -s ../librepl.a librepl.a echo "!<arch>" > repl/.libs/librepl.a
On a mac, this seems to be necessary since libtool
does apparently not work properly (any help on this is welcome) and we have to fool ar
(this approach is just mimicked from a working Linux compilation).
make make check chmod 755 config/install-sh
(Do not ask...)
make install
ATLAS
(Used gFortran, downloaded from http://r.research.att.com/tools)
../configure --prefix=<> make make install
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