sagemath/sage

Remove package mpir

Closed this issue · 66 comments

MPIR, a fork of GMP, has not been updated upstream. The latest release, 3.0.0, is from 2017-03-01 (https://mpir.org/downloads.html).

Sage currently provides an SPKG for MPIR as a configurable alternative to GMP. We should remove this option and package, as previously suggested in #29620 comment:10

Depends on #30350
Depends on #31163

CC: @jhpalmieri @orlitzky @dimpase @wbhart brg@gladman.plus.com riemannic@gmail.com

Component: packages: standard

Author: Matthias Koeppe, John Palmieri, Dima Pasechnik

Branch: 286b39c

Reviewer: Dima Pasechnik, Matthias Koeppe

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

comment:1

It seems there are some commits since then (the last is from December 2020 for Linux version and August 2021 for Windows version), perhaps should we ask to the people involved in MPIR how they see the future of MPIR ?

comment:2

+1

Regardless of the state of MPIR upstream, sage never really developed a coherent plan for packages that are substitutes for one another. The ./configure options that are available now don't really make sense, and the best thing to do for our end users is to eliminate the confusion (if also the choice). If someone later wants to overhaul the build system to handle these choices consistently, then OK; but I don't think anyone does right now.

comment:3

The upstream (Bill) told me some time ago that due to Spectre and other CPU vulns discovered few years ago, parts of MPIR became obsolete, as speedups there relied on CPUs being unpatched.

IMHO it's semi-abandonware now.

comment:4

Replying to @orlitzky:

sage never really developed a coherent plan for packages that are substitutes for one another. The ./configure options that are available now don't really make sense

#29620 tracks this

New commits:

9fa072ebuild/pkgs/mpir: Remove
81331d7build/pkgs/yasm: Remove (was mpir dependency)

Commit: 81331d7

Author: Matthias Koeppe

Changed commit from 81331d7 to fabdbb3

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

fabdbb3build/pkgs/*/SPKG.rst: Clear out redundant 'Dependencies' sections
comment:8

There are a few references to yasm: a comment in m4/sage_spkg_configure.m4 and many mentions in doc/en/developer/portability_testing.rst.

Changed commit from fabdbb3 to 724c3ff

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

724c3ffsrc/doc/en/developer/portability_testing.rst: Remove references to package yasm

Changed commit from 724c3ff to 519dc83

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

519dc83m4/sage_spkg_configure.m4: In documentation, do not use yasm as an example

Changed commit from 519dc83 to 01406bf

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

01406bfbuild/pkgs/*/SPKG.rst: Clear out more redundant 'Dependencies' sections

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

205931csrc/doc/en/installation/source.rst: Remove doc of envvar SAGE_MP_LIBRARY
e7fdb35src/doc/en/installation/source.rst: Remove use of mpir as an example package

Changed commit from 01406bf to e7fdb35

comment:13

In two places of the Sage library, also 'mpir' appears as a possible value of an algorithm parameter:

src/sage/arith/misc.py:        sage: a = binomial(100, 45, algorithm='mpir')
src/sage/rings/integer.pyx:    def binomial(self, m, algorithm='mpir'):

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

1eb83e3build/pkgs/ratpoints/SPKG.rst: Remove redundant 'Dependencies' section

Changed commit from e7fdb35 to 1eb83e3

comment:15

Replying to @mkoeppe:

In two places of the Sage library, also 'mpir' appears as a possible value of an algorithm parameter:

src/sage/arith/misc.py:        sage: a = binomial(100, 45, algorithm='mpir')
src/sage/rings/integer.pyx:    def binomial(self, m, algorithm='mpir'):

this option should be renamed gmp, and respective tests should drop # optional tag.
Indeed, it just calls a gmp/mpir function (which are more or less the same, and mpir provided a replacement for gmp there).

sage: 100.binomial(45, algorithm='mpir')
61448471214136179596720592960

see, it still works, without any mpir installed.

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

f883ea4Integer.binomial: Add algorithm='gmp', keep 'mpir' as an alias

Changed commit from 1eb83e3 to f883ea4

comment:17

Replying to @dimpase:

this option should be renamed gmp

I have kept mpir as an alias, without deprecation warnings; after all, if we use system GMP, that could as well be MPIR

comment:18

there is still an #optional : mpir tag in integer.pyx, line 6427.
And analogous gmp tag few lines down.

Changed commit from f883ea4 to 1647e2f

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

1647e2fsrc/sage/rings/integer.pyx: Rewrite a doctest so it works with gmp, mpir, 64bit, 32bit
comment:20

Replying to @dimpase:

there is still an #optional : mpir tag in integer.pyx, line 6427.
And analogous gmp tag few lines down.

These doctests weren't actually being run because neither mpir nor gmp were optional packages. I've rewritten it in a less specific way, it now runs

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

34526cabuild/pkgs/*/SPKG.rst: Remove some more redundant 'Dependencies' sections

Changed commit from 1647e2f to 34526ca

comment:22

There is a similar test in src/sage/ext/memory.pyx. We can also remove mpir from COPYING.txt. (Was there ever talk of autogenerating that file? Each package could have a file license.txt...)

comment:23

Also in m4/sage_spkg_collect.m4:

    # Packages that should be included in the source distribution
    # This includes all standard packages and two special cases
    case "$SPKG_NAME" in
    mpir)
        in_sdist=yes
        ;;
    esac
comment:24

I don't understand this comment, line 286 in src/sage/all.py:

    # Free globally allocated mpir integers.

Just delete the comment and leave the code? Replace the comment with something else? Remove the code?

comment:25

Here are some proposed changes:

diff --git a/COPYING.txt b/COPYING.txt
index 2da3a8e492..7ce750a1aa 100644
--- a/COPYING.txt
+++ b/COPYING.txt
@@ -86,7 +86,6 @@ mistune                     Modified BSD
 mpc                         LGPLv3+
 mpfi                        COPYING is GPLv2, source files state LGPLv2.1+
 mpfr                        LGPLv3+
-mpir                        LGPLv3+
 mpmath                      Modified BSD
 networkx                    Modified BSD
 ntl                         GPLv2+
diff --git a/build/pkgs/ecm/spkg-configure.m4 b/build/pkgs/ecm/spkg-configure.m4
index e62c21cb32..d5302a89fb 100644
--- a/build/pkgs/ecm/spkg-configure.m4
+++ b/build/pkgs/ecm/spkg-configure.m4
@@ -1,7 +1,7 @@
 SAGE_SPKG_CONFIGURE([ecm], [
     m4_pushdef([SAGE_ECM_MINVER],[7.0.4])
     AC_REQUIRE([SAGE_SPKG_CONFIGURE_GMP])
-    AC_MSG_CHECKING([installing gmp/mpir? ])
+    AC_MSG_CHECKING([installing gmp? ])
     if test x$sage_spkg_install_gmp = xyes; then
         AC_MSG_RESULT([yes; install ecm as well])
         sage_spkg_install_ecm=yes
diff --git a/build/pkgs/gdb/SPKG.rst b/build/pkgs/gdb/SPKG.rst
index b89773fe67..0716ac53fa 100644
--- a/build/pkgs/gdb/SPKG.rst
+++ b/build/pkgs/gdb/SPKG.rst
@@ -19,17 +19,6 @@ Upstream Contact
 
 http://www.gnu.org/software/gdb/
 
-Dependencies
-------------
-
--  python
--  mpc
--  mpfr
--  ppl
--  gmp/mpir
--  makeinfo (external)
-
-
 Special Update/Build Instructions
 ---------------------------------
 
diff --git a/build/pkgs/isl/spkg-configure.m4 b/build/pkgs/isl/spkg-configure.m4
index 1b16f70870..d7bbef80c6 100644
--- a/build/pkgs/isl/spkg-configure.m4
+++ b/build/pkgs/isl/spkg-configure.m4
@@ -1,6 +1,6 @@
 SAGE_SPKG_CONFIGURE([isl], [
     AC_REQUIRE([SAGE_SPKG_CONFIGURE_GMP])
-    AC_MSG_CHECKING([installing gmp/mpir? ])
+    AC_MSG_CHECKING([installing gmp? ])
     if test x$sage_spkg_install_gmp = xyes; then
         AC_MSG_RESULT([yes; install isl as well])
         sage_spkg_install_isl=yes
diff --git a/build/pkgs/mpfr/spkg-configure.m4 b/build/pkgs/mpfr/spkg-configure.m4
index 2300be6707..f64ede4b75 100644
--- a/build/pkgs/mpfr/spkg-configure.m4
+++ b/build/pkgs/mpfr/spkg-configure.m4
@@ -1,6 +1,6 @@
 SAGE_SPKG_CONFIGURE([mpfr], [
     AC_REQUIRE([SAGE_SPKG_CONFIGURE_GMP])
-    AC_MSG_CHECKING([installing gmp/mpir? ])
+    AC_MSG_CHECKING([installing gmp? ])
     if test x$sage_spkg_install_gmp = xyes; then
         AC_MSG_RESULT([yes; install mpfr as well])
         sage_spkg_install_mpfr=yes
diff --git a/m4/sage_spkg_collect.m4 b/m4/sage_spkg_collect.m4
index 1ab62d6fa4..c364ab62b7 100644
--- a/m4/sage_spkg_collect.m4
+++ b/m4/sage_spkg_collect.m4
@@ -259,14 +259,6 @@ for DIR in $SAGE_ROOT/build/pkgs/*; do
         AS_VAR_POPDEF([sage_require])dnl
         AS_VAR_POPDEF([sage_spkg_install])dnl
 
-    # Packages that should be included in the source distribution
-    # This includes all standard packages and two special cases
-    case "$SPKG_NAME" in
-    mpir)
-        in_sdist=yes
-        ;;
-    esac
-
     # Determine package source
     #
     if test -f "$DIR/requirements.txt"; then
comment:26

All looking fine, please push them to the ticket

Changed commit from 34526ca to e3ff6aa

comment:28

Replying to @mkoeppe:

All looking fine, please push them to the ticket

Done


New commits:

e3ff6aatrac 32549: misc small changes, plus don't include mpir in sdist

Changed author from Matthias Koeppe to Matthias Koeppe, John Palmieri

comment:30

Let's use this ticket to update to consistently use SAGE_SPKG_DEPCHECK instead of that if test ... in all the packages affected.

comment:31

the monster isn't completely gone yet:

build//pkgs/ppl/spkg-install.in:# Make sure that we prefer Sage's mpir library over system-wide gmp/mpir installs
src/doc/it/faq/faq-usage.rst:    rm spkg/installed/mpir* spkg/installed/atlas*
src/doc/it/faq/faq-general.rst:`MPIR <http://www.mpir.org>`_,
src/doc/en/faq/faq-usage.rst:    $ rm spkg/installed/mpir* spkg/installed/atlas*
src/doc/en/faq/faq-general.rst:`MPIR <http://www.mpir.org>`_,
src/sage/ext_data/valgrind/sage-additional.supp:   fun:sage_mpir_malloc
src/sage/ext_data/valgrind/sage-additional.supp:   mpir_realloc
src/sage/ext_data/valgrind/sage-additional.supp:   fun:sage_mpir_realloc
src/sage/ext/memory.pyx:    sage: 2^(2^63-2)      # optional - mpir
src/sage/all.py:    # Free globally allocated mpir integers.

taking care of this now.


New commits:

ccd0ff5use SAGE_SPKG_DEPCHECK

Changed commit from e3ff6aa to ccd0ff5

Changed commit from ccd0ff5 to 07da6c3

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

e400f0emakes gmp test unconditional, remove mpir test
07da6c3fix mpir mentions in FAQs and source comments

Reviewer: Dima Pasechnik

Changed author from Matthias Koeppe, John Palmieri to Matthias Koeppe, John Palmieri, Dima Pasechnik

comment:34

Looking good. Let's merge #30350 (ATLAS removal) to resolve merge conflicts in the documentation and other places

Changed reviewer from Dima Pasechnik to Dima Pasechnik, Matthias Koeppe

Dependencies: #30350

Changed commit from 07da6c3 to 9ed04f7

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

9ed04f7Merge tag '9.5.beta2' into t/32549/remove_package_mpir
comment:37

there were a couple of docbuild errors in FAQs in my branch. Should merge the latest commit from u/dimpase/remove_package_mpir

Changed commit from 9ed04f7 to 7c84f31

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

8c071a8https-fy consistently
7c84f31Merge branch 'u/dimpase/remove_package_mpir' of git://trac.sagemath.org/sage into t/32549/remove_package_mpir
comment:39

OK, this works.

comment:40

Merge conflict

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

2576f86build/make/Makefile.in: If a script package has no spkg-install, run "sage -info" and exit with error
feb8de7build/pkgs/: Remove spkg-install scripts for dummy script packages
8f782c0.github/workflows/tox-{optional,experimental}.yml: Do not try to test dummy script packages
4b292bebuild/pkgs/perl_mongodb/spkg-install: Remove
a7b6352build/bin/sage-spkg-info: Fix display of system packages
e65b309bootstrap: Do not provide ./configure --enable-SPKG options for dummy optional packages
b485d46m4/sage_spkg_collect.m4: Do not advertise dummy optional packages as installable
286b39cMerge #31163

Changed commit from 7c84f31 to 286b39c

Changed dependencies from #30350 to #30350, #31163

comment:44

perhaps should we ask to the people involved in MPIR how they see the future of MPIR ?

Bill also told me recently that MPIR is not going forward at this point for a combination of reasons. +1 to this ticket.

Changed commit from 286b39c to none