Successfully built Sagemath 9.6 on Bookworm ("apt dist-upgrade"-ed as
of 25 January 2023) using the following script.  (It seems to have
partially built 9.7, and that build might be fixable by an interested
someone.)  The important piece seems to be

    ./configure --without-system-gcc --without-system-pari
--without-system-singular

to avoid the version conflicts reported in Debian Bug report #1028345.
This script redirects output to log files.  These are not small.
9.5: 3.77 MB
9.6: 27.5 MB
9.7: 5.37 GB
One might consider removing the 9.7 target below if one is space constrained.

The script is a little sloppy.  (It's intended to build a much broader
range of Sagemath versions for regression testing.)  For example, it
installs pari and singular, then tells the Sagemath build to ignore
them.  I've edited it down to post here and I *think* this editing
hasn't introduced errors.  (A likely error is newlines appearing in
the "sudo apt install" lines as a result of passing through a mail
system.  This is noted in the script.)

--- begin script ---

#!/bin/bash

# Downloads source code for several versions of Sagemath, then attempts to
# build the sources.  If an argument is given, only that Sagemath
version is acted
# upon.  Each resulting sagemath-[version] directory that contains a
# successful build is a SAGE_ROOT.
#
# TODO: Need to handle [version] argument.  Currently, just downloads
and rebuilds
# everything -- which is the right thing to do when you're still figuring
# out how to get the builds to work.

# Extracted from
https://doc.sagemath.org/html/en/installation/source.html#sec-installation-from-sources
# The following two lines (both "sudo apt install ...") likely have
picked up internal newlines passing through intermediary systems.  If
there's a problem, check for inserted newlines.
sudo apt install bc binutils bzip2 ca-certificates cliquer cmake curl
ecl eclib-tools fflas-ffpack flintqs g++ gcc gengetopt gfan gfortran
glpk-utils gmp-ecm lcalc libatomic-ops-dev libboost-dev
libbraiding-dev libbrial-dev libbrial-groebner-dev libbz2-dev
libcdd-dev libcdd-tools libcliquer-dev libcurl4-openssl-dev libec-dev
libecm-dev libffi-dev libflint-arb-dev libflint-dev libfontconfig1-dev
libfplll-dev libfreetype6-dev libgc-dev libgd-dev libgf2x-dev
libgiac-dev libgivaro-dev libglpk-dev libgmp-dev libgsl-dev
libhomfly-dev libiml-dev liblfunction-dev liblinbox-dev liblrcalc-dev
liblzma-dev libm4ri-dev libm4rie-dev libmpc-dev libmpfi-dev
libmpfr-dev libncurses5-dev libntl-dev libopenblas-dev libpari-dev
libpcre3-dev libplanarity-dev libppl-dev libprimesieve-dev
libpython3-dev libqhull-dev libreadline-dev librw-dev libsingular4-dev
libsqlite3-dev libssl-dev libsuitesparse-dev libsymmetrica2-dev
libz-dev libzmq3-dev libzn-poly-dev m4 make nauty ninja-build openssl
palp pari-doc pari-elldata pari-galdata pari-galpol pari-gp2c
pari-seadata patch perl pkg-config planarity ppl-dev python3
python3-distutils python3-venv r-base-dev r-cran-lattice singular
singular-doc sqlite3 sympow tachyon tar tox xcas xz-utils default-jdk
dvipng ffmpeg imagemagick latexmk libavdevice-dev pandoc tex-gyre
texlive-fonts-recommended texlive-lang-cyrillic texlive-lang-english
texlive-lang-european texlive-lang-french texlive-lang-german
texlive-lang-italian texlive-lang-japanese texlive-lang-polish
texlive-lang-portuguese texlive-lang-spanish texlive-latex-extra
texlive-xetex xclip 4ti2 clang coinor-cbc coinor-libcbc-dev graphviz
libfile-slurp-perl libgraphviz-dev libigraph-dev libisl-dev
libjson-perl libmongodb-perl libnauty-dev libperl-dev libpolymake-dev
libsvg-perl libterm-readkey-perl libterm-readline-gnu-perl
libxml-libxslt-perl libxml-writer-perl libxml2-dev lrslib pari-gp2c
pdf2svg polymake texinfo dvipng ffmpeg imagemagick texlive-full
texlive-extra-utils texlive-science texlive-xetex latexmk pandoc
default-jdk libavdevice-dev tk tk-dev
sudo apt install libflint-arb-dev libbrial-dev libbrial-groebner-dev
ecl libec-dev eclib-tools fflas-ffpack libflint-dev libfreetype6-dev
gcc g++ libgiac-dev xcas libgivaro-dev libgd-dev libntl-dev libppl-dev
ppl-dev libqhull-dev singular libsingular4-dev libzmq3-dev 4ti2
texlive-latex-extra texlive-xetex latexmk dvipng default-jdk
libavdevice-dev lrslib

# Let's simplify the list of versions for building on Bookworm.
# for i in 6.5 6.6 6.7 6.8 6.9 6.10 7.0 7.1 7.2 7.3 7.4 7.5.1 7.6 8.0
8.1 8.2 8.3 8.4 8.5 8.6 8.7 8.8 8.9 9.0 9.1 9.2 9.3 9.4 9.5 9.6 9.7 ;
do
for i in 9.5 9.6 9.7 ; do
    if [ ! -d "sagemath-$i" ]; then
        git clone --depth 1 --branch $i
https://github.com/sagemath/sage.git sagemath-$i
    fi
    mkdir -p log-build-sagemath
    cd sagemath-$i

    ( ( make clean ; make dist-clean ; make configure ; ./configure
--without-system-gcc --without-system-pari --without-system-singular ;
make -j build ; make -j doc ) && ( ./sage -pip install pytest ; make
ptestlong ) ) &> ../log-build-sagemath/sagemath-$i &
done

echo """All git downloads completed.  Various builds will download
some additional components.  Compilations are still running.  Will
terminate when compilations complete.  You can follow the contents of
./log-setup-sagemath if you would like to see more fine-grained
progress."""
wait

--- end script ---

After running the above (and waiting a bit), ...

$ ./sagemath-9.5/sage
************************************************************************
It seems that you are attempting to run Sage from an unpacked source
tarball, but you have not compiled it yet (or maybe the build has not
finished). You should run `make` in the Sage root directory first.
If you did not intend to build Sage from source, you should download
a binary tarball instead. Read README.txt for more information.
************************************************************************

$ ./sagemath-9.6/sage
┌────────────────────────────────────────────────────────────────────┐
│ SageMath version 9.6, Release Date: 2022-05-15                     │
│ Using Python 3.10.9. Type "help()" for help.                       │
└────────────────────────────────────────────────────────────────────┘
sage: quit()

$ ./sagemath-9.7/sage
┌────────────────────────────────────────────────────────────────────┐
│ SageMath version 9.7, Release Date: 2022-09-19                     │
│ Using Python 3.10.9. Type "help()" for help.                       │
└────────────────────────────────────────────────────────────────────┘
┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┓
┃ Warning: sage.all is not available; this is a limited REPL.        ┃
┗━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┛
sage: quit()


--
    -- Eric Towers ! fuzzye...@gmail.com

Reply via email to