|
1 |
| -gcc: The GNU Compiler Collection, including the C, C++ and Fortran compiler |
2 |
| -=========================================================================== |
| 1 | +gcc: The GNU Compiler Collection or other suitable C and C++ compilers |
| 2 | +====================================================================== |
3 | 3 |
|
4 | 4 | Description
|
5 | 5 | -----------
|
6 | 6 |
|
7 |
| -The GNU Compiler Collection, including the C, C++ and Fortran compiler. |
| 7 | +This package represents the required C and C++ compilers. |
| 8 | + |
| 9 | +- GCC (GNU Compiler Collection) versions 8.x to 12.x are supported. |
| 10 | + |
| 11 | +- Clang (LLVM) is also supported. |
| 12 | + |
| 13 | +The required Fortran compiler is represented by the package ``gfortran``. |
| 14 | + |
| 15 | +You can pass the names of compilers to use to ``./configure`` using |
| 16 | +the environment variables :envvar:`CC`, :envvar:`CXX`, and |
| 17 | +:envvar:`FC`, for C, C++, and Fortran compilers, respectively. |
| 18 | + |
| 19 | +For example, if your C compiler is ``clang``, your C++ compiler is |
| 20 | +``clang++``, and your Fortran compiler is ``flang``, then you would |
| 21 | +need to run:: |
| 22 | + |
| 23 | + $ ./configure CC=clang CXX=clang++ FC=flang |
| 24 | + |
| 25 | +Vendor and versions of the C and C++ compilers should match. |
| 26 | + |
| 27 | +Users of older Linux distributions (in particular, ``ubuntu-xenial`` |
| 28 | +or older, ``debian-stretch`` or older, ``linuxmint-18`` or older) |
| 29 | +should upgrade their systems before attempting to install Sage from |
| 30 | +source. Users of ``ubuntu-bionic``, ``linuxmint-19.x``, and |
| 31 | +``opensuse-15.x`` can install a versioned ``gcc`` system package |
| 32 | +and then use:: |
| 33 | + |
| 34 | + $ ./configure CC=gcc-8 CXX=g++-8 FC=gfortran-8 |
| 35 | + |
| 36 | +or similar. Users on ``ubuntu`` can also install a modern compiler |
| 37 | +toolchain `using the ubuntu-toolchain-r ppa |
| 38 | +<https://askubuntu.com/questions/1140183/install-gcc-9-on-ubuntu-18-04/1149383#1149383>`_. |
| 39 | +On ``ubuntu-trusty``, also the package ``binutils-2.26`` is required; |
| 40 | +after installing it, make it available using ``export |
| 41 | +PATH="/usr/lib/binutils-2.26/bin:$PATH"``. Instead of upgrading their |
| 42 | +distribution, users of ``centos-7`` can install a modern compiler |
| 43 | +toolchain `using Redhat's devtoolset |
| 44 | +<https://stackoverflow.com/a/67212990/557937>`_. |
| 45 | + |
| 46 | +This package uses the non-standard default |
| 47 | +``configure --with-system-gcc=force``, giving an error at ``configure`` |
| 48 | +time when no suitable system compilers are configured. |
| 49 | + |
| 50 | +You can override this using ``./configure --without-system-gcc``. In |
| 51 | +this case, Sage builds and installs the GNU Compiler Collection, |
| 52 | +including the C, C++ and Fortran compiler. This is not recommended. |
| 53 | +You will need suitable C and C++ compilers from which GCC can |
| 54 | +bootstrap itself. There are some known problems with old assemblers, |
| 55 | +in particular when building the ``ecm`` and ``fflas_ffpack`` |
| 56 | +packages. You should ensure that your assembler understands all |
| 57 | +instructions for your processor. On Linux, this means you need a |
| 58 | +recent version of ``binutils`` (not provided by an SPKG); on macOS |
| 59 | +you need a recent version of Xcode. |
| 60 | + |
| 61 | +(Installing the |
| 62 | +``gfortran`` SPKG becomes a no-op in this case.) |
| 63 | + |
| 64 | +Building Sage from source on Apple Silicon (M1/M2) requires the use of |
| 65 | +Apple's Command Line Tools, and those tools include a suitable |
| 66 | +compiler. Sage's ``gcc`` SPKG is not suitable for M1/M2; building it |
| 67 | +will likely fail. |
8 | 68 |
|
9 | 69 | License
|
10 | 70 | -------
|
|
0 commit comments