Failed to build Sage from source using gcc 10

asked 2021-12-21 16:41:38 +0100

jordana309 gravatar image

updated 2021-12-24 20:08:35 +0100

slelievre gravatar image

I'm trying to build SageMath from source on Ubuntu 20.04. Below is the exact process I tried to follow (taking notes to be able to pass to other students with little/no linux experience--like me--so I try to explain each step), but the build crashed on on gcc-10 build with "undefined reference to ZSTD_compress" and a bunch of other ZSTD-related items. Two questions: why doesn't the below install all needed dependencies, but more importantly, with what I passed in, I don't think it should be trying to build gcc-10 anyway, so why is it? Thanks!

  • This method will install a new sage python environment that will show up in our anaconda-navigator called sage-pyenv.
  • Install all the prerecs. Highly recommended ones for better experience are after yasm; optional ones to speed up build time after tk-dev (Note: gcc-7, g++-c, and gfortran-7 installed to /usr/bin.):

    sudo apt-get install bc binutils bzip2 ca-certificates cliquer cmake curl ecl eclib-tools fflas-ffpack flintqs g++ gcc 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 libfreetype6-dev libgc-dev libgd-dev libgf2x-dev libgiac-dev libgivaro-dev libglpk-dev libgmp-dev libgsl-dev libhomfly-dev libiml-dev liblfunction-dev liblrcalc-dev liblzma-dev libm4rie-dev libmpc-dev libmpfi-dev libmpfr-dev libncurses5-dev libntl-dev libopenblas-dev libpari-dev libpcre3-dev libplanarity-dev libppl-dev libpython3-dev libreadline-dev librw-dev libsqlite3-dev libssl-dev libsuitesparse-dev libsymmetrica2-dev libz-dev libzmq3-dev libzn-poly-dev m4 make nauty openssl palp pari-doc pari-elldata pari-galdata pari-galpol pari-gp2c pari-seadata patch perl pkg-config planarity ppl-dev python3 python3 python3-distutils r-base-dev r-cran-lattice sqlite3 sympow tachyon tar tox xcas xz-utils yasm gcc-7 g++-7 gfortran-7 dvipng ffmpeg imagemagick texlive texlive-latex-recommended texlive-latex-recommended-doc texlive-fonts-recommended texlive-fonts-recommended-doc texlive-xetex latexmk pandoc default-jdk libavdevice-dev tk tk-dev coinor-cbc coinor-libcbc-dev git graphviz libfile-slurp-perl libigraph-dev libisl-dev libjson-perl libmongodb-perl libnauty-dev libperl-dev libsvg-perl libterm-readkey-perl libterm-readline-gnu-perl libterm-readline-gnu-perl libxml-libxslt-perl libxml-writer-perl libxml2-dev libxml2-dev lrslib ninja-build pari-gp2c

  • Get the source code:

    mkdir ~/Codes

    cd ~/Codes

    git clone -c core.symlinks=true --branch master https://github.com/sagemath/sage.git

  • Set up Python environment:

    cd ~/Codes/sage

    ./bootstrap

    • After building the environment, I was told that conda went ahead and built the environment as Python 3.10, which is too new for Sage. Per this post, 3.8 and 3.9 are supported. It will build a 3.9 during build. So, tweak some things to make sure we get that version.
    • Go into ~/Codes/sage/environment-optional.yml, and
      • change the environment name to sage-pyenv
      • add python=3.9 to dependencies, per this post

    conda env create -f environment-optional.yml

    conda activate sage-pyenv

  • Build it:

    ./bootstrap

    • Point it to system gcc-7 and fortran-7 for compilation, since it seems to fail when trying to build gcc-10. It can’t use gcc-11 as of the time of this writing. Also point it to this conda environment we just created.

    CC=gcc-7 CXX=g++ FC=gfortran-7 ./configure --prefix=$CONDA_PREFIX --with-python=/home/nuker/anaconda3/envs/sage-pyenv/bin/python

    • This came back with a list of things that will provide extra capability and help build time. I just made sure that those got installed:

      conda install arb cddlib curl eclib ecm libflint giac iml lcalc libgd libhomfly openssl pari pari-elldata pari-galdata pari-galpol pari-seadata pari-galdata pari-seadata-small r r-essentials suitesparse xz lrslib pari-nftables

    • Rerun the ./configure line above (other places suggest ./config.status --recheck && ./config.status, but those would still install a new python-3.9 install).

      make

After make, it would crash out with notes about ZSTD.

edit retag flag offensive close merge delete

Comments

It appears that the OpenMP flags fail, causing it to think it needs to install gcc-10.3.0, but I know that the gcc-7 (and later I tried gcc-10) do support OpenMP right out of the box, so I'm confused why the test for the flag fails...

jordana309 gravatar imagejordana309 ( 2021-12-22 07:19:56 +0100 )edit
1

You should probably post your message to https://groups.google.com/g/sage-devel, which is more relevant for such build issue.

eric_g gravatar imageeric_g ( 2021-12-22 15:14:06 +0100 )edit
1

Oh, I didn't know. Thank you! Posted to https://groups.google.com/g/sage-deve..., for anybody who has the same issue and finds this one.

jordana309 gravatar imagejordana309 ( 2021-12-22 19:20:09 +0100 )edit