Installation from Source Code
This page describes how to install polymake from the source code. See the downloads page for other ways of installing polymake. In particular, if you are using Ubuntu or Debian, you might want to consider installing our debian packages.
Warning: Unfortunately polymake is not compatible with perl 5.38.0 or newer. Since several Linux distributions have switched to the new perl version the polymake package had to be removed from their repositories. If you want to continue using polymake you can try our new jll-based binaries or see below to build polymake from source with a custom perl.
Usually, following the description in the quick summary should do the job. Please be aware that the installation procedure described on this page works on UNIX systems with the newest version of polymake. If you have special needs, you might find help in other places:
Mac
We support some versions of MacOS. Please visit the Mac installation page for detailed instructions.
Windows
polymake
is not supported on any native Windows platform. You might try to get it running in a UNIX emulation like Cygwin, but you will be left to your own devices since we are not used to this setup.
Legacy versions
If you for some reason are trying to build an old version of polymake, please consult the legacy installation page additionally, as it may have details that are not necessary for the most recent polymake anymore.
Quick summary
Installing polymake from sources can usually be accomplished using the following six steps:
- Make sure to have a supported perl version older than 5.38. Otherwise check the section on perl-brew.
- Download a source tarball from the download page.
- Unpack the tarball and change into the source directory with
tar xjf polymake-VERSION.tar.bz2 cd polymake-VERSION
- Install all needed dependencies according to your distribution. In the distributions section there are lists of packages for a variety of linux distributions.
- Configure polymake with
./configure
There are many options that you can (de-)activate, see the configuration section and the further options subsection for details.
- Make and install polymake with
make sudo make install
If your system has multiple cores you can speed of the build process, see the build section for further details.
Dependencies
Must have
Before you start you should check whether you have got all the building tools and prerequisite packages. See the distributions section for package lists for some common linux distros. Here's what you'll need:
- C and C++ compilers with full
C++14
support, one of the following is recommended:gcc
andg++
, version at least 5 (Note that these might come in separate packages)clang
, version at least 3.4
- C++ Library (one of the following):
- GNU C++ Library. (On Linux this is usually already in the base system, or comes with
gcc
) - libc++, might come with LLVM/clang
- Ninja build system since polymake version 3.2, depending on the distribution the package might be called
ninja-build
.
- XML processing tools:
libxml2
,libxslt
(both being standard components of Gnome environment)
- GNU Readline & History library v5.0+
- Perl 5.16.0-5.36.x, with all of the following modules:
ExtUtils::Embed
, which some distributions ship separately asperl-ExtUtils-Embed
XML::SAX
XML::Writer
Term::ReadLine::Gnu
Term::ReadKey
JSON
- GMP library 5.1.0+ . Some Linux vendors split the GMP in two packages, shared libraries and development stuff. Please install both. You also need to enable/install the C++ bindings for polymake version 2.11+.
- MPFR library 3.0.0+ . Again both shared libraries and development stuff are required.
- boost headers. The basic
libboost-dev
should suffice, no shared libraries are required for boost. - FLINT 2.5.2+. (This dependency is strongly recommended but can be disabled if it cannot be fulfilled)
Perlbrew
If your perl version is 5.38 or newer you need to build a custom perl to use with polymake. The easiest way to do this is to install perlbrew
with your package manager (or from https://perlbrew.pl/).
Once you have perlbrew installed you need to initialize it with perlbrew init
and add source ~/perl5/perlbrew/etc/bashrc
to your shell rc file as shown in the output.
To build a compatible perl use:
perlbrew install perl-5.36.1 --as pmperl -Duseshrplib
The above command will take a few minutes, once that is done you can (temporarily) switch the perl version for the current shell with perlbrew use pmperl
. This change is active until you close that terminal again.
To install the required perl modules for this perl installation run:
perlbrew use pmperl perlbrew install-cpanm cpanm Term::ReadLine::Gnu Term::ReadKey XML::SAX XML::Writer JSON SVG
In this shell you can now run the configure script for polymake and continue with the installation instructions. Make sure to always switch the perl to pmperl
before running polymake
.
Recommended software
If you want pretty things and use bundled extensions, you might want to consider installing further packages.
Libraries
- bliss for computing automorphism groups of graphs and checking combinatorial equivalence of polytopes. Strongly recommended for the
-minimal
package, see also below. - PPL for convex hull computations, in many cases faster than the bundled cdd or lrs code.
polymake 3.2 requires ppl version at least 1.2. - Singular for Groebner basis computations. Check the installation instructions for Singular.
Perl modules
Visualization
- A webbrowser with WebGL support for the three.js visualization (e.g. chrome, firefox or safari).
- Java Development Kit 1.5+ if you are going to use the visualization tools
JavaView
orjReality
via polymake. ant
1.7.1+ withant-antlr
task is needed if you want to recompile the interface to the Java visualization tools, but normally you won't do it.
Minimal tarball
Since the minimal tarball version does not contain several of the bundled libraries, the packaging system should make sure the following additional dependencies are met. Check ./configure --help
for the corresponding command line arguments.
- convex hull computation, at least cdd is required:
- graph isomorphism computation, exactly one of the following:
- nauty source directory (supported since polymake 3.0r2)
As the PermLib and SymPol librarys polymake uses are not available in most distributions, they are included even in the minimal tarball.
Configuration
The next step after unpacking the tar ball is
./configure
polymake's configuration is not based on autoconf, but it looks similar. If you are working in a standard environment then your configuration probably does not require any further options. For more elaborate ways to configure your setup see below.
After the configuration, you get a new subtree build.ARCH
, where ARCH
is usually an abbreviation of your hardware platform as reported by uname -m
. Inside this directory there is a file conf.make
which can be manually edited, if necessary.
To get the complete picture of the configuration options:
./configure --help
It is common for GNU/Linux programs to be installed into /usr/local
. Obviously, the installation requires write privileges set accordingly. If you want to install to somewhere else use --prefix=/my/installation/directory
. Notice that the installation directory must be distinct from the directory where you compile.
Further options
- Enforcing a different directory layout.
Using the following options you can place the parts of the polymake installation according to any possible layout convention:--prefix=DIR
put everything beneath this directory.--exec-prefix=DIR
put the architecture-dependent parts beneath this directory, namely the main scriptpolymake
and the compiled modules.--bindir=DIR
put the main scriptpolymake
in this directory--includedir=DIR
put the header files in this directory (actually, creates a subdirectorypolymake
there)--libdir=DIR
put the callable librarylibpolymake
in this directory--libexecdir=DIR
put the dynamic modules (loadable at runtime) and Java native interface libraries in this directory (actually, creates a subdirectorypolymake
there)--datadir=DIR
put the architecture-independent parts in this directory, namely the perl modules, rule files, scripts, and java archives.--docdir=DIR
put the automatically generated documentation in HTML format in this directory--build=ARCH
assign this architecture name to the current build configuration; per default, some excerpt fromuname -a
is taken.
- Specifying the compilation options:
CC=program
the C compilerCFLAGS="options"
options for the C compiler, e.g. enabling machine-specific optimization or non-standard include pathsCXX=program
the C++ compilerCXXFLAGS="options"
options for the C++ compilerCXXOPT=-On
optimization level of the C++ compiler (some unlucky versions happen to produce broken code when trying hard to optimize)LDFLAGS="options"
options for the linker, e.g. non-standard library search pathsLIBS="-lLib …"
additional non-standard libraries required for C++ programsPERL=program
the perl interpreter--with-toolchain=DIR
path to a full GCC or LLVM (including clang and libc++) installation, automatically sets the above flags for the compiler and standardC++
library.--with-libcxx
build against the libc++ library instead of the GNU libstdc++, useful when building with LLVM/Clang.--without-native
don't optimize for the current CPU, i.e. don't set-march=native
to allow running on different CPUs (with the same architecture).
- Specifying the build prerequisites:
--with-gmp=DIR
location of the Gnu MultiPrecision library (GMP). Its public header file is expected atDIR/include/gmp.h
and the shared libraries underDIR/lib
orDIR/lib64
.--with-mpfr=DIR
location of the Gnu MultiPrecision Floating-point Reliable library (MPFR). Its public header file is expected atDIR/include/mpfr.h
and the shared libraries underDIR/lib
orDIR/lib64
.--with-boost=DIR
location of the boost headers--with-libxml2=DIR
location of the XML processing library
- Optional libraries, see also the external software page:
--with-ppl=DIR
installation directory of the Parma Polyhedra Library (PPL)--with-cdd=DIR
installation directory of cddlib--with-lrs=DIR
installation directory of lrslib--with-bliss=DIR
installation directory of bliss, headers must be inDIR/include/bliss/
--with-nauty-src=DIR
nauty source directory--with-singular=DIR
singular installation directory--with-soplex=DIR
soplex directory, built withGMP=true
andSHARED=true
--with-permlib=DIR
permlib header directory--with-sympol=DIR
sympol installation directory, headers should beDIR/include/sympol/
,yal
andmatrix
must be in subfolders. Note that using a custom sympol installation is incompatible with the bundled versions of cdd, lrs and permlib; i.e. those then have to be installed separately.--with-libnormaliz=DIR
libnormaliz installation directory
Remark: Please avoid mixing different C++
libraries when building the dependencies and polymake and make sure they use the same C++
ABI version:
Libraries with C++
interface should be built with -std=c++11
or newer.
- Java interface options:
--with-java=DIR
the top directory of the Java SDK installation--with-jni-headers=DIR
the location ofjni.h
header file, if it resides outside the SDK tree (mostly needed on Macs)--without-java
you don't have any Java SDK installed on your machine.--with-fink=DIR
Fink installation top directory (for Mac OS only). Usually it resides at/sw
.
- Preparing the Java interface re-build (normally not needed):
--with-ant=program
the ANT tool--with-javaview=program
the JavaView start script--without-javaview
JavaView is not installed on your machine; jReality will still be recompiled
If you opt to exclude Java components from the build, you won't be able to use any of Java-based visualization tools with polymake. However, you (or other users of your polymake installation) can revise this decision later: after having installed a Java SDK, you'll have to reconfigure the corresponding rule files.
The results of running the configuration script are stored in the file build.ARCH/conf.make
. You might edit it manually if needed. At the very beginning the copy of your last configure
command is stored for documentation purposes. You can pick it there and repeat the configuration for a different platform or with different options. As long as you specify different architecture names, several configurations can peacefully co-exist.
Compilation and Installation
Having finished the configuration, run
make
If your machine is equipped with several CPUs (or cores), you should utilize them all: make -jN
, where N
is the number of cores to be used. Otherwise schedule the compilation step for your extended lunch break. Please be aware that gcc
may require up to 1GB RAM (per core used) during the compilation!
If you want, for whatever reason, recompile the Java interface modules, it can be done with
make all-java
Then, run
sudo make install
If you are building polymake for several hardware platforms sharing the architecture-independent parts, the command from the second platform on should be
sudo make install-arch [Arch=NAME]
Note: If you are installing polymake in your home-directory, i.e. you have set --prefix
, you should omit sudo
in the above commands.
Dependency lists for common distros
Debian and Ubuntu
Packages
We are proud to announce that polymake is part of the debian package library. So for newer debian based distributions like Ubuntu 15.10 (Wily Werewolf) you can install polymake by using the command:
sudo apt-get install polymake
This will install polymake and all its dependencies.
Please note that jReality is not part of the debian package (which is built from the minimal
tarball).
You may want to use other visualization methods like threejs
, tikz
or javaview
.
Installation from Source
On most recent Ubuntu versions installing the following packages (and their dependencies) should suffice to build polymake
4.1 from source:
sudo apt-get install ant ant-optional default-jdk g++ libboost-dev \ libflint-dev libgmp-dev libgmpxx4ldbl libmpfr-dev libperl-dev libterm-readline-gnu-perl \ libxml-perl libxml-writer-perl libterm-readkey-perl libjson-perl ninja-build
If you are going to use the polymake Database, you'll also need to install
libmongodb-perl
The following packages are recommended but not strictly necessary:
libbliss-dev libsvg-perl
Fedora
The following should suffice to be able to build polymake from source on Fedora
sudo dnf install ant java-1.8.0-openjdk-devel gcc-c++ boost-devel \ flint-devel gmp-devel mpfr-devel perl-devel perl-XML-Writer \ perl-ExtUtils-Embed perl-TermReadKey perl-Term-ReadLine-Gnu bliss-devel \ ninja-build perl-JSON
You might need to specify the path to your java installation with --with-java=JAVA_HOME
.
Arch Linux
The following should suffice to be able to build polymake from source on Arch Linux 4.13.12:
sudo pacman -S gcc readline perl libxml-perl perl-xml-writer perl-json \ perl-term-readline-gnu perl-term-readkey mpfr gmp boost ninja flint
OpenSuse
You need to install ant
and ant-antlr
packages to recompile the java sources. PPL is available in ppl-devel
. The package for Ninja is called ninja
.
Scientific Linux
The following packages together with their dependencies should suffice to build polymake on a minimal install of SL7:
lbzip2 perl gcc-c++ perl-XML-Writer perl-Term-ReadLine-Gnu \ perl-Term-ReadKey gmp-devel mpfr-devel boost-devel perl-ExtUtils-Embed\ ninja-build
For visualization via jreality java-1.8.0-openjdk-devel
and and-antlr
are needed, passing --with-java=/usr/lib/jvm/java
to configure should help with the java detection.