install:installsingular

This is an old revision of the document!


The following instructions explain how to install libsingular and enabling polymake to access Singular. Please tell us about any obstacles you might encounter.

With release 2.13 polymake uses the Singular 4.x.x infrastructure. Previous libsingular installations are not supported anymore.

Note: If you have trouble compiling Singular, you can find the latest singular commit that jenkins has tested with release 2.13 here. And the latest revision for the perpetual beta here.

For Developers: See here for the latest working Singular and polymake git revisions.

Installation for Linux systems

To install libsingular you'll need to do the following:

  1. First download the Singular source (polymake needs a checkout from end of March 2014 or newer):
    git clone https://github.com/Singular/Sources
    cd Sources
    git checkout spielwiese

  2. Now we can build and install singular together with libsingular. If you have superuser access on the computer you can leave out the prefix and singular will install to /usr/local by default.

    ./autogen.sh
    ./configure --disable-static --prefix=/some/custom/prefix
    make
    make install

    Warning: If your gcc is version 6 (or newer) please add the following variables to the configure command:

    CFLAGS="-fno-delete-null-pointer-checks" CXXFLAGS="-fno-delete-null-pointer-checks"

  3. Now you should have bin, lib and some other folders in the prefix.

Next you need to compile polymake with libsingular:

./configure --with-singular="/some/custom/prefix"
make

Outdated Installation for Mac OS Systems

For installing libsingular on Mac OS and using it with polymake you first need a suitable c++-compiler. Currently, the only known compiler that works both for libsingular and polymake is g++-fsf-4.7 that comes with fink (apple's system gcc probably compiles libsingular, but not polymake, and a recent svn snapshot of clang compiles polymake, but the configure script of libsingular does not work well with clang). Note that you will have to compile both polymake and libsingular with the same compiler!

You need gcc,g++, and the gmp from the fink distribution (this is for Mac OS 10.8, please check the correct names for other versions).

fink install gcc47-compiler gcc47-shlibs gmp5 gmp5-shlibs libgmpxx5-shlibs

Next you need the singular sources. Create a directory for singular and switch to this directory. Then

git clone https://github.com/Singular/Sources
cd Sources
git checkout master

We need to create some symbolic links so that singular finds the gmp. In the following “x86_64Mac-darwin” is assumed to be the output of the shell script “singuname.sh”, please check this with

./singuname.sh

and replace the string in the following commands if necessary. Also, “/sw” is assumed to be the root of your fink installation. Replace if necessary.

mkdir -p x86_64Mac-darwin/include
mkdir -p x86_64Mac-darwin/lib
ln -s /sw/include/gmp.h x86_64Mac-darwin/include/
ln -s /sw/lib/libgmp.dylib x86_64Mac-darwin/lib/

We also need to set some flags:

export CC="/sw/bin/gcc-fsf-4.7 -fpic -DPIC -DLIBSINGULAR"
export CXX=/sw/bin/g++-fsf-4.7" -fpic -DPIC -DLIBSINGULAR"

export CFLAGS="-g -I/sw/include"
export CXXFLAGS="-g -I/sw/include"

We also have to edit one file in the Singular tree: In the file “ntl/include/NTL/tools.h” please add the line

#define NTL_STD_CXX

at the top.

Now we can compile libsingular

./configure --without-dynamic-kernel --without-MP 
make install-libsingular

Finally, we have to fix the name of the produced libsingular, so that polymake can find it during loading:

install_name_tool -id <path_to_singular>/Sources/x86_64Mac-darwin/lib/libsingular.dylib x86_64Mac-darwin/lib/libsingular.dylib

Note that <path_to_singular> should be the full path (starting with “/”) to the directory you created in the beginning, i.e. “<path_to_singular>/Sources/x86_64Mac-darwin/lib/libsingular.dylib” should be the full path for libsingular.dylib

Now you can compile polymake with singular. Switch to the polymake root directory. Currently you also have to fix the configure script of polymake: In the file “ext/singular/configure.pl” replace “$Config::Config{dlext}” by “dylib” (twice). This will be fixed in the next beta release. Now call

./configure CC=/sw/bin/gcc-fsf-4.7 CXX=/sw/bin/g++-fsf-4.7 --with-singular=<path_to_singular>/Sources/x86_64Mac-darwin 
make

Depending on your local installation you might need to add further switches.

Usage

Now you should be able to access Singular from within polymake. You can try it out by executing the following in polymake:

application "ideal";
$r=new Ring(qw(x y z));
($x,$y,$z)=$r->variables;
$p1=($x^3)-1;
$p2=($x^2)-1;
$p3=($y^5);
$i = new Ideal(GENERATORS=>[$p1,$p2,$p3]);
print $i->RADICAL->GENERATORS;
print $i->DIM;
$q1 = $x+($y^2);
$q2 = ($y^2);
$j = new Ideal(GENERATORS=>[$q1,$q2]);
print $j->GROEBNER(ORDER=>"lex")->BASIS;
print $j->GROEBNER(ORDER=>"lex")->INITIAL_IDEAL->GENERATORS;
print $j->GROEBNER(ORDER=>"dp")->BASIS;
print $j->GROEBNER(ORDER=>"dp")->reduce($p1);
print $j->GROEBNER(ORDER=>"dp")->reduce($q1);
$m = new Matrix([1,1,1],[0,1,1],[0,0,1]);
print $j->GROEBNER(ORDER_MATRIX=>$m)->BASIS; 
  • install/installsingular.1548798380.txt.gz
  • Last modified: 2019/01/29 21:46
  • by 127.0.0.1