sagemath / sage

Main repository of SageMath. Now open for Issues and Pull Requests.
https://www.sagemath.org
Other
1.09k stars 394 forks source link

Upgrade polymake to version 3.4 #24905

Closed mkoeppe closed 5 years ago

mkoeppe commented 6 years ago

https://polymake.org/doku.php/download/start#get_latest_stable_release33

To build it for Sage do:

(cd upstream && wget https://polymake.org/lib/exe/fetch.php/download/polymake-3.4-minimal.tar.bz2)

pull this ticket and build sage

make build

Then Read (and follow) the installation instructions regarding Perl prereqs on your platform:

./sage -info polymake

Finally:

./sage -i polymake

Upstream: Reported upstream. No feedback yet.

CC: @simon-king-jena @jplab @videlec @slel @sophiasage paffenholz@mathematik.tu-darmstadt.de kastner@math.tu-berlin.de

Component: packages: optional

Keywords: IMA-PolyGeom, thursdaysbdx

Author: Matthias Koeppe, Jean-Philippe Labbé, Dima Pasechnik

Branch/Commit: public/upgrade_polymake_to_version_3_2r4 @ 2eda6e1

Reviewer: Matthias Koeppe, Jean-Philippe Labbé, Dima Pasechnik

Issue created by migration from https://trac.sagemath.org/ticket/24905

mkoeppe commented 6 years ago

Dependencies: #24921

mkoeppe commented 6 years ago

Description changed:

--- 
+++ 
@@ -1,2 +1,10 @@
 https://polymake.org/doku.php/news/release_3_2

+To build it for Sage do:
+
+pull this ticket
+
+```
+(cd upstream && wget https://polymake.org/lib/exe/fetch.php/download/polymake-3.2r2-minimal.tar.bz2)
+sage -i polymake
+```
mkoeppe commented 6 years ago

Branch: u/mkoeppe/upgrade_polymake_to_version_3_2r2

7ed8c4ca-6d56-4ae9-953a-41e42b4ed313 commented 6 years ago

Branch pushed to git repo; I updated commit sha1. New commits:

ca75153polymake: Add ninja_build as dependency
7ed8c4ca-6d56-4ae9-953a-41e42b4ed313 commented 6 years ago

Commit: ca75153

mkoeppe commented 6 years ago

Author: Matthias Koeppe

jdemeyer commented 6 years ago
comment:5

ninja_build should be an order-only dependency (after the | symbol)

jdemeyer commented 6 years ago
comment:6

All other packages have $(MP_LIBRARY) in their dependencies instead of $(INST)/$(SAGE_MP_LIBRARY). I guess this should be changed.

jdemeyer commented 6 years ago
comment:7

Unfortunately, I cannot test this because perl_term_readline_gnu fails to install:

[perl_term_readline_gnu-1.34] Could not find neither libtermcap.a, libncurses.a, or libcurses.

Indeed, there is no libncurses.a installed (but libncurses.so is).

mkoeppe commented 6 years ago
comment:8

Replying to @jdemeyer:

Unfortunately, I cannot test this because perl_term_readline_gnu fails to install:

[perl_term_readline_gnu-1.34] Could not find neither libtermcap.a, libncurses.a, or libcurses.

Indeed, there is no libncurses.a installed (but libncurses.so is).

Could you create a separate ticket for this (and include more log detail)?

7ed8c4ca-6d56-4ae9-953a-41e42b4ed313 commented 6 years ago

Branch pushed to git repo; I updated commit sha1. New commits:

4fc26ffninja_build: Add python dependency
3d6ae67ninja_build: Make Python an order-only dependency
acc3026Merge remote-tracking branch 'trac/u/mkoeppe/add_optional_package__ninja_build___build_system_for_polymake_' into t/24905/upgrade_polymake_to_version_3_2r2
196eb49polymake dependencies: Use current format for MP_LIBRARY, make ninja_build order-only
7ed8c4ca-6d56-4ae9-953a-41e42b4ed313 commented 6 years ago

Changed commit from ca75153 to 196eb49

mkoeppe commented 6 years ago

Work Issues: Failures in test suite

mkoeppe commented 6 years ago
comment:12

This upgrade seems to break the whole polymake interface. Next step: Compare what's happening on the wire (pexpect log) between the two polymake versions.

mkoeppe commented 6 years ago
comment:13

Replying to @mkoeppe:

Replying to @jdemeyer:

Unfortunately, I cannot test this because perl_term_readline_gnu fails to install:

[perl_term_readline_gnu-1.34] Could not find neither libtermcap.a, libncurses.a, or libcurses.

Indeed, there is no libncurses.a installed (but libncurses.so is).

Could you create a separate ticket for this (and include more log detail)?

We have reproduced this problem on another linux box. Fix is in #25112.

mkoeppe commented 6 years ago

Changed dependencies from #24921 to #24921, #25112

7ed8c4ca-6d56-4ae9-953a-41e42b4ed313 commented 6 years ago

Branch pushed to git repo; I updated commit sha1. New commits:

3ffafdfUpdate perl_term_readline_gnu to 1.35
672a3a2perl_term_readline_gnu: Find ncurses
0b818c3Merge remote-tracking branch 'trac/u/mkoeppe/perl_term_readline_gnu__upgrade_to_1_35_and_patch_away_ncurses_problem' into t/24905/upgrade_polymake_to_version_3_2r2
7ed8c4ca-6d56-4ae9-953a-41e42b4ed313 commented 6 years ago

Changed commit from 196eb49 to 0b818c3

mkoeppe commented 6 years ago

Description changed:

--- 
+++ 
@@ -8,3 +8,11 @@
 (cd upstream && wget https://polymake.org/lib/exe/fetch.php/download/polymake-3.2r2-minimal.tar.bz2)
 sage -i polymake

+ +Also don't forget the upstreams of dependencies: + + +(cd upstream && wget https://github.com/ninja-build/ninja/archive/v1.8.2.tar.gz -O ninja_build-1.8.2.tar.gz && wget wget http://search.cpan.org/CPAN/authors/id/H/HA/HAYASHI/Term-ReadLine-Gnu-1.35.tar.gz) + + +

mkoeppe commented 6 years ago

Description changed:

--- 
+++ 
@@ -12,7 +12,7 @@
 Also don't forget the upstreams of dependencies:

-(cd upstream && wget https://github.com/ninja-build/ninja/archive/v1.8.2.tar.gz -O ninja_build-1.8.2.tar.gz && wget wget http://search.cpan.org/CPAN/authors/id/H/HA/HAYASHI/Term-ReadLine-Gnu-1.35.tar.gz) +(cd upstream && wget https://github.com/ninja-build/ninja/archive/v1.8.2.tar.gz -O ninja_build-1.8.2.tar.gz && wget http://search.cpan.org/CPAN/authors/id/H/HA/HAYASHI/Term-ReadLine-Gnu-1.35.tar.gz)

mkoeppe commented 6 years ago

Description changed:

--- 
+++ 
@@ -6,7 +6,6 @@

(cd upstream && wget https://polymake.org/lib/exe/fetch.php/download/polymake-3.2r2-minimal.tar.bz2) -sage -i polymake


 Also don't forget the upstreams of dependencies:
@@ -15,4 +14,10 @@
 (cd upstream && wget https://github.com/ninja-build/ninja/archive/v1.8.2.tar.gz -O ninja_build-1.8.2.tar.gz && wget http://search.cpan.org/CPAN/authors/id/H/HA/HAYASHI/Term-ReadLine-Gnu-1.35.tar.gz)

+Finally:

+ +./sage -i polymake + + +

mkoeppe commented 6 years ago

Description changed:

--- 
+++ 
@@ -14,6 +14,12 @@
 (cd upstream && wget https://github.com/ninja-build/ninja/archive/v1.8.2.tar.gz -O ninja_build-1.8.2.tar.gz && wget http://search.cpan.org/CPAN/authors/id/H/HA/HAYASHI/Term-ReadLine-Gnu-1.35.tar.gz)

+Read the installation instructions regarding Perl prereqs: + + +./sage -info polymake + + Finally:

jplab commented 6 years ago
comment:20

Compilation fails on Debian stretch. I copy the relevant section of the log file:

[706/940] LD /home/jplabbe/sage/local/var/tmp/sage/build/polymake-3.2r2/src/build/Opt/lib/polytope.so
FAILED: /home/jplabbe/sage/local/var/tmp/sage/build/polymake-3.2r2/src/build/Opt/lib/polytope.so 
g++ -shared -L/usr/local/lib -fstack-protector-strong -Wl,-z,lazy -Wl,--as-needed  -o 
LOOOOOOOOGGGGGGGGGGGGGGGGGGGGG LIST OF .o and .so files 
/home/jplabbe/sage/local/var/tmp/sage/build/polymake-3.2r2/src/build/Opt/staticlib/sympol/libsympol.a  -L/home/jplabbe/sage/local/lib -Wl,-rpath,/home/jplabbe/sage/local/lib -lsoplex -lz -lppl -llrsgmp -lnormaliz -lgmpxx -lcddgmp -L/home/jplabbe/sage/local/lib -Wl,-rpath,/home/jplabbe/sage/local/lib  -fopenmp -lmpfr -lgmp -lpthread  -ldl
/usr/bin/ld: /home/jplabbe/sage/local/lib/libsoplex.a(rational.cpp.o): relocation R_X86_64_TPOFF32 against symbol `_ZN6soplex8Rational10useListMemE' can not be used when making a shared object; recompile with -fPIC
/usr/bin/ld: /home/jplabbe/sage/local/lib/libsoplex.a(spxdefines.cpp.o): relocation R_X86_64_TPOFF32 against symbol `_ZN6soplex5Param9s_epsilonE' can not be used when making a shared object; recompile with -fPIC
/usr/bin/ld: final link failed: Nonrepresentable section on output
collect2: error: ld returned 1 exit status
7ed8c4ca-6d56-4ae9-953a-41e42b4ed313 commented 6 years ago

Changed commit from 0b818c3 to 24aec38

7ed8c4ca-6d56-4ae9-953a-41e42b4ed313 commented 6 years ago

Branch pushed to git repo; I updated commit sha1. New commits:

24aec38polymake: disable SoPlex to avoid linking errors
jplab commented 6 years ago
comment:22

Now the compilation finishes without errors. Testing with --optional=polymake, I get:

----------------------------------------------------------------------
sage -t backend_polymake.py  # 53 doctests failed
sage -t base.py  # 13 doctests failed
----------------------------------------------------------------------

The first is:

sage: p = Polyhedron(vertices=[(0,0),(1,0),(0,1)], rays=[(1,1)],lines=[], backend='polymake')

for which I get:

Traceback (most recent call last):
...
TypeError: Can't locate File/Slurp.pm in @INC (you may need to install the File::Slurp module) (@INC contains: CODE(0x562008f51e88) /home/jplabbe/sage/local/share/polymake/perllib /home/jplabbe/sage/local/lib/polymake/perlx/5.24.1/x86_64-linux-gnu-thread-multi /home/jplabbe/sage/local/lib/polymake/perlx/5.24.1 /home/jplabbe/sage/local/lib/polymake/perlx /home/jplabbe/sage/local/lib/perl5/x86_64-linux-gnu-thread-multi /home/jplabbe/sage/local/lib/perl5 /etc/perl /usr/local/lib/x86_64-linux-gnu/perl/5.24.1 /usr/local/share/perl/5.24.1 /usr/lib/x86_64-linux-gnu/perl5/5.24 /usr/share/perl5 /usr/lib/x86_64-linux-gnu/perl/5.24 /usr/share/perl/5.24 /usr/local/lib/site_perl /usr/lib/x86_64-linux-gnu/perl-base)
BEGIN failed--compilation aborted

Another type of error seems to be that not putting () at the end of a CAPITALIZEDPOLYMAKEMETHOD returns a function and not the result anymore.

mkoeppe commented 6 years ago

Changed dependencies from #24921, #25112 to #24921, #25112, #24152

mkoeppe commented 6 years ago
comment:23

For the error with Slurp, merge #24152 (needs review) and then re-read the polymake SPKG.txt regarding the Perl libraries that need to be installed.

mkoeppe commented 6 years ago
comment:24

Replying to @jplab:

Another type of error seems to be that not putting () at the end of a CAPITALIZEDPOLYMAKEMETHOD returns a function and not the result anymore.

Yes, that's exactly what I meant when I wrote "break[s] the whole polymake interface".

jplab commented 6 years ago
comment:25

Replying to @mkoeppe:

Replying to @jplab:

Another type of error seems to be that not putting () at the end of a CAPITALIZEDPOLYMAKEMETHOD returns a function and not the result anymore.

Yes, that's exactly what I meant when I wrote "break[s] the whole polymake interface".

I wanted to emphaSIZE the problem! ;)

jplab commented 6 years ago

Changed commit from 24aec38 to 2748391

jplab commented 6 years ago

Changed branch from u/mkoeppe/upgrade_polymake_to_version_3_2r2 to public/upgrade_polymake_to_version_3_2r2

jplab commented 6 years ago
comment:26

Merged the dependency to #24152.


New commits:

a924632polymake SPKG.txt: Mention File::Slurp and CPAN
30ea0b0Merge branch 'u/mkoeppe/bug_when_converting_a_sage_polyhedron_into_polymake_pexpect' of trac.sagemath.org:sage into 24152
2748391Merge branch '24152' into 24905
mkoeppe commented 6 years ago

Changed keywords from none to IMA-PolyGeom

mkoeppe commented 5 years ago
comment:28

3.2r3 is out

jplab commented 5 years ago
comment:29

Ok, good to know. At the beginning of October, I have a week where I'll try this once more.

Further, I had a comment recently that one might want to add a link to the backend polymake in the documentation page for the interface (because the interface is not the only way to use polymake in sage...).

7ed8c4ca-6d56-4ae9-953a-41e42b4ed313 commented 5 years ago

Branch pushed to git repo; I updated commit sha1. New commits:

791f766Merge branch 'develop' into public/upgrade_polymake_to_version_3_2r2
7ed8c4ca-6d56-4ae9-953a-41e42b4ed313 commented 5 years ago

Changed commit from 2748391 to 791f766

7ed8c4ca-6d56-4ae9-953a-41e42b4ed313 commented 5 years ago

Changed commit from 791f766 to f4dee94

7ed8c4ca-6d56-4ae9-953a-41e42b4ed313 commented 5 years ago

Branch pushed to git repo; I updated commit sha1. New commits:

3ec32e8Merge branch 'public/upgrade_polymake_to_version_3_2r2' of trac.sagemath.org:sage into new_24905
f4dee94Updated polymake to 3.2r4
jplab commented 5 years ago
comment:32

It seems that the commit 791f766 merged the develop branch into the upgrade polymake branch?

We then get all the diffs from the develop branch on this ticket... I would revert back to a previous commit if no changes were done at the same time as this merge... Let's see how it goes with this update on top of the last beta.

Now version 3.2.r4 is out as well and I updated the description of the ticket.

Polymake days are January 24-26 2019, I will ask them if a stable release is to be expected soon...

jplab commented 5 years ago

Description changed:

--- 
+++ 
@@ -5,7 +5,7 @@
 pull this ticket

-(cd upstream && wget https://polymake.org/lib/exe/fetch.php/download/polymake-3.2r2-minimal.tar.bz2) +(cd upstream && wget https://polymake.org/lib/exe/fetch.php/download/polymake-3.2r4-minimal.tar.bz2)


 Also don't forget the upstreams of dependencies:
jplab commented 5 years ago
comment:33

I accidently erased the patch to compile with gcc7 form a previous ticket... I do not have gcc7 on my computer... But I guess it would be good to check it again anyways on this new release...

jplab commented 5 years ago
comment:34

I am looking at the broken polymake interface. I noticed a few things:

    sage: polymake("'ok'")                              # optional - polymake
    'ok'

So we need to handle this differently when calling member functions.

polytope > $c = cube(3);
polytope > $t = typeof $c;
polymake:  ERROR: Compilation error

This breaks pretty much everything, as the object is not able to catch its type and get the proper names for functions, and lots of other things...

jplab commented 5 years ago

New commits:

d5b94d6Fixed quotes and wiggled around
b2e133cFixed the typeof
d9af561small fixes
40c6098pep8
jplab commented 5 years ago

Changed branch from public/upgrade_polymake_to_version_3_2r2 to public/upgrade_polymake_to_version_3_2r4

jplab commented 5 years ago

Changed commit from f4dee94 to 40c6098

jplab commented 5 years ago
comment:36

The previous commits fix the polymake interface, see https://forum.polymake.org/viewtopic.php?f=8&t=1675 for a discussion of the issue.

In short, the command

$t = typeof $c;

Stopped working (as in the tutorials mentionned in the discussion) and we should use:

$t = $c -> type;

This seems to have fixed the problems.

There is still a spurious failing test in the interface which is an appearing blankline. I ignore it for now...

Next, I'll check the polymake backend for polyhedron. There seems to be around 4 failing doctests. That's much better than the 100s... there was.

jplab commented 5 years ago
comment:37

Replying to @jplab:

I am looking at the broken polymake interface. I noticed a few things:

  • Quotes do not work the same way as before:
    sage: polymake("'ok'")                              # optional - polymake
    'ok'

This was simply because of the failing evaluation when setting variables. It seems fine now.

jplab commented 5 years ago
comment:38

On the release page of polymake 3.2 https://polymake.org/doku.php/news/release_3_2

one can read under "polytope":

This breaks a few of our tests.