Ubuntu 14.04 LTS 下使用源码编译安装 Sagemath 6.7 x64 (小结)

时间:2024-04-12 14:07:06

原先博客放弃使用,几篇文章搬运过来

  1. 下载源码包
  2. 系统的最低要求: 6GB 硬盘 ; 2GB RAM.
  3. 命令行工具:
    1. A C/C++ compiler: Since Sage builds its own GCC if needed, a wide variety of C/C++ compilers is supported.
      Many GCC versions work, from as old as version 3.4.3 to the most recent release. Clang also works. On Solaris
      systems, the Sun compiler should also work. See also Using alternative compilers.
    2. make: GNU make, version 3.80 or later. Version 3.82 or later is recommended.
    3. m4: GNU m4 1.4.2 or later (non-GNU or older versions might also work).
    4. perl: version 5.8.0 or later.
    5. ar and ranlib: can be obtained as part of GNU binutils.
    6. tar: GNU tar version 1.17 or later, or BSD tar.
  4. 命令行工具安装
     sudo apt-get install binutils gcc make m4 perl tar
  5. 系统特殊需求,Debian/Ubuntu需要安装dpkg-dev包
     sudo apt-get install dpkg-dev
  6. 可选软件
    • dvipng
    • ffmpeg
    • ImageMagick
    • latex --十分建议安装
  7. 安装可选软件.
     sudo apt-get install dvipng imagemagick texlive
  8. 安装ffmpeg
     sudo add-apt-repository ppa:samrog131/ppa
    sudo apt-get update
    sudo apt-get install ffmpeg-real
    sudo ln -sf /opt/ffmpeg/bin/ffmpeg /usr/bin/ffmpeg
  9. 开始编译
     cd ~/sage-6.7    #进入目录
    export SAGE_FAT_BINATY=''yes'' 
    MAKE='make -j4' make #不可以使用root
    Warning::系统默认的GCC-4.9.2.p1在会出现问题后,Sage默认使用自带的GCC,由于版本问题导致R安装不上,出现如下ERROR
    /home/user/build/sage/snapperkob/sage_git/build/local/var/tmp/sage/build/r-3.1.1.p0/src/bin/exec/R: /usr/lib/x86_64-linux-gnu/libgomp.so.1: version `GOMP_4.0' not found (required by /home/user/build/sage/snapperkob/sage_git/build/local/var/tmp/sage/build/r-3.1.1.p0/src/lib/libR.so)
    make[7]: *** Error sysdate
    make[6]: *** [all] Error 1
    make[6]: Leaving directory `/home/user/build/sage/snapperkob/sage_git/build/local/var/tmp/sage/build/r-3.1.1.p0/src/src/library/tools'
    make[5]: *** [R] Error 1
    make[5]: Leaving directory `/home/user/build/sage/snapperkob/sage_git/build/local/var/tmp/sage/build/r-3.1.1.p0/src/src/library'
    make[4]: *** [R] Error 1
    make[4]: Leaving directory `/home/user/build/sage/snapperkob/sage_git/build/local/var/tmp/sage/build/r-3.1.1.p0/src/src'
    make[3]: *** [R] Error 1
    make[3]: Leaving directory `/home/user/build/sage/snapperkob/sage_git/build/local/var/tmp/sage/build/r-3.1.1.p0/src'
    Error building R.

    设置第二步可以避免出现错误 SAGE_FAT_BINARY参数的作用:

    to prepare a binary distribution that will run on the widest range of target machines.
    ./sage --bdisk x.y.z-fat  #生成 .tar.gz 包文件
  10. 测试
    ./sage --testall
  11. 安装可选包
    1. sage -i <package name> 自动下载安装可选包,注意包名含有版本号
    2. Sage Optional Packages
  12. 命令行启动方式
    1. ln -s /path/to/sage-x.y.z/sage /usr/local/bin/sage
    2. 拷贝$SAGE_ROOT/sage至PATH(通常至/usr/local/bin).编辑拷贝中#SAGE_ROOT=/path/to/sage-version.
  13. 时间统计(Intel Core i5 3230m+8GB RAM +Ubuntu 14.04.02 amd64)
    项目 make ./sage --testall
    耗时 约2.5h 约1.2h