Index: cmake/modules/CheckCompilerVersion.cmake =================================================================== --- cmake/modules/CheckCompilerVersion.cmake +++ cmake/modules/CheckCompilerVersion.cmake @@ -1,19 +1,33 @@ -# Check if the host compiler is new enough. LLVM requires at least GCC 4.8, -# MSVC 2015 (Update 3), or Clang 3.1. +# Check if the host compiler is new enough. For MSVC, LLVM requires at least +# MSVC 2015 (Update 3). For GCC and Clang, LLVM's policy is to support all +# major compiler versions released within 3 years from the date in which the +# previous version was branched. Additionally, a CMake warning is issued for +# versions older than 1.5 years. +# +# For current LLVM trunk (version 7.0), the effective date is January 3rd, 2018. include(CheckCXXSourceCompiles) +set(GCC_MIN 5.1) +set(GCC_WARN 7.1) +set(CLANG_MIN 3.6) +set(CLANG_WARN 3.8) + if(NOT DEFINED LLVM_COMPILER_CHECKED) set(LLVM_COMPILER_CHECKED ON) if(NOT LLVM_FORCE_USE_OLD_TOOLCHAIN) if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU") - if(CMAKE_CXX_COMPILER_VERSION VERSION_LESS 4.8) - message(FATAL_ERROR "Host GCC version must be at least 4.8!") + if(CMAKE_CXX_COMPILER_VERSION VERSION_LESS GCC_MIN) + message(FATAL_ERROR "Host GCC version must be at least ${GCC_MIN}!") + elseif(CMAKE_CXX_COMPILER_VERSION VERSION_LESS GCC_WARN) + message(WARNING "GCC ${CMAKE_CXX_COMPILER_VERSION} will soon be unsupported (version < GCC ${GCC_WARN}).") endif() elseif(CMAKE_CXX_COMPILER_ID STREQUAL "Clang") - if(CMAKE_CXX_COMPILER_VERSION VERSION_LESS 3.1) - message(FATAL_ERROR "Host Clang version must be at least 3.1!") + if(CMAKE_CXX_COMPILER_VERSION VERSION_LESS CLANG_MIN) + message(FATAL_ERROR "Host Clang version must be at least ${CLANG_MIN}!") + elseif(CMAKE_CXX_COMPILER_VERSION VERSION_LESS CLANG_WARN) + message(WARNING "Clang ${CMAKE_CXX_COMPILER_VERSION} will soon be unsupported (version < Clang ${CLANG_WARN}).") endif() if (CMAKE_CXX_SIMULATE_ID MATCHES "MSVC") Index: docs/CodingStandards.rst =================================================================== --- docs/CodingStandards.rst +++ docs/CodingStandards.rst @@ -184,7 +184,7 @@ traits header to emulate it. .. _the libstdc++ manual: - https://gcc.gnu.org/onlinedocs/gcc-4.8.0/libstdc++/manual/manual/status.html#status.iso.2011 + https://gcc.gnu.org/onlinedocs/gcc-5.1.0/libstdc++/manual/manual/status.html#status.iso.2011 Other Languages --------------- Index: docs/GettingStarted.rst =================================================================== --- docs/GettingStarted.rst +++ docs/GettingStarted.rst @@ -222,7 +222,7 @@ Package Version Notes =========================================================== ============ ========================================== `GNU Make `_ 3.79, 3.79.1 Makefile/build processor -`GCC `_ >=4.8.0 C/C++ compiler\ :sup:`1` +`GCC `_ >=5.1.0 C/C++ compiler\ :sup:`1` `python `_ >=2.7 Automated test suite\ :sup:`2` `zlib `_ >=1.2.3.4 Compression library\ :sup:`3` =========================================================== ============ ========================================== @@ -272,18 +272,23 @@ ------------------------------------------------------ LLVM is very demanding of the host C++ compiler, and as such tends to expose -bugs in the compiler. We are also planning to follow improvements and -developments in the C++ language and library reasonably closely. As such, we -require a modern host C++ toolchain, both compiler and standard library, in -order to build LLVM. +bugs in the compiler. We also attempt to follow improvements and developments in +the C++ language and library reasonably closely. As such, we require a modern +host C++ toolchain, both compiler and standard library, in order to build LLVM. For the most popular host toolchains we check for specific minimum versions in our build systems: -* Clang 3.1 -* GCC 4.8 +* Clang 3.6 +* GCC 5.1 * Visual Studio 2015 (Update 3) +For Clang and GCC, the policy of LLVM is to remove host compiler support of a +compiler once its major version exceeds 3 years old from the previous LLVM +release's branch date. In order to assist developers to properly prepare their +environments, a CMake warning will be emitted for any older than 1.5 years from +the previous LLVM release's branch date. + Anything older than these toolchains *may* work, but will require forcing the build system with a special option and is not really a supported host platform. Also note that older versions of these compilers have often crashed or @@ -334,33 +339,35 @@ distribution on which users have struggled with the version requirements is Ubuntu Precise, 12.04 LTS. For this distribution, one easy option is to install the `toolchain testing PPA`_ and use it to install a modern GCC. There is -a really nice discussions of this on the `ask ubuntu stack exchange`_. However, -not all users can use PPAs and there are many other distributions, so it may be -necessary (or just useful, if you're here you *are* doing compiler development -after all) to build and install GCC from source. It is also quite easy to do -these days. +a really nice discussions of this on the `ask ubuntu stack exchange`_ and a +`github gist`_ with updated commands. However, not all users can use PPAs and +there are many other distributions, so it may be necessary (or just useful, if +you're here you *are* doing compiler development after all) to build and install +GCC from source. It is also quite easy to do these days. .. _toolchain testing PPA: https://launchpad.net/~ubuntu-toolchain-r/+archive/test .. _ask ubuntu stack exchange: - http://askubuntu.com/questions/271388/how-to-install-gcc-4-8-in-ubuntu-12-04-from-the-terminal + https://askubuntu.com/questions/466651/how-do-i-use-the-latest-gcc-on-ubuntu/581497#58149 +.. _github gist: + https://gist.github.com/application2000/73fd6f4bf1be6600a2cf9f56315a2d91 -Easy steps for installing GCC 4.8.2: +Easy steps for installing GCC 5.1.0: .. code-block:: console - % wget https://ftp.gnu.org/gnu/gcc/gcc-4.8.2/gcc-4.8.2.tar.bz2 - % wget https://ftp.gnu.org/gnu/gcc/gcc-4.8.2/gcc-4.8.2.tar.bz2.sig + % wget https://ftp.gnu.org/gnu/gcc/gcc-5.1.0/gcc-5.1.0.tar.bz2 + % wget https://ftp.gnu.org/gnu/gcc/gcc-5.1.0/gcc-5.1.0.tar.bz2.sig % wget https://ftp.gnu.org/gnu/gnu-keyring.gpg - % signature_invalid=`gpg --verify --no-default-keyring --keyring ./gnu-keyring.gpg gcc-4.8.2.tar.bz2.sig` + % signature_invalid=`gpg --verify --no-default-keyring --keyring ./gnu-keyring.gpg gcc-5.1.0.tar.bz2.sig` % if [ $signature_invalid ]; then echo "Invalid signature" ; exit 1 ; fi - % tar -xvjf gcc-4.8.2.tar.bz2 - % cd gcc-4.8.2 + % tar -xvjf gcc-5.1.0.tar.bz2 + % cd gcc-5.1.0 % ./contrib/download_prerequisites % cd .. - % mkdir gcc-4.8.2-build - % cd gcc-4.8.2-build - % $PWD/../gcc-4.8.2/configure --prefix=$HOME/toolchains --enable-languages=c,c++ + % mkdir gcc-5.1.0-build + % cd gcc-5.1.0-build + % $PWD/../gcc-5.1.0/configure --prefix=$HOME/toolchains --enable-languages=c,c++ % make -j$(nproc) % make install @@ -368,7 +375,7 @@ of this information from. .. _GCC wiki entry: - http://gcc.gnu.org/wiki/InstallingGCC + https://gcc.gnu.org/wiki/InstallingGCC Once you have a GCC toolchain, configure your build of LLVM to use the new toolchain for your host compiler and C++ standard library. Because the new