What's the reasoning behind it?
Thanks!
On any given Ubuntu release, build-essential
provides the most commonly needed tools for building packages for that release, by declaring dependencies on various other packages.
Two of the packages build-essential
always depends on are gcc
and g++
. On each release, those packages provide (parts of) the GNU Compiler Collection at the default version for that release, which is the version that is typically used to compile programs for that release. In particular, it is the version that is used to build all the binary packages provided in Ubuntu's official repositories. Another way to say this is that it's the version that is used to build that release of Ubuntu.
Others have pointed out why Ubuntu releases deliberately often do not provide the very latest versions of software. Although the StableReleaseUpdates policy does apply to packages that provide development tools, that nonetheless doesn't really answer why build-essential
doesn't always depend on the latest tools, because build-essential
often doesn't even depend on the latest tools that are officially packaged for the release.
For example, as I write this, the latest stable version of Ubuntu is 19.04. (It's not an LTS release, but it's a stable release.) The gcc
and g++
packages, which build-essential
depends on, provide GCC 8.3 on Ubuntu 19.04. However, GCC 9.1 is packaged in the official repositories for Ubuntu 19.04; it is provided by packages whose names end in -9
. In particular, for GCC 9.1 instead of GCC 8.3, you would install the gcc-9
package instead of the gcc
package and the g++-9
package instead of the g++
package. (You don't really have to install one version instead of the other; gcc
and gcc-9
, as well as g++
and g++-9
, can be installed at the same time with no conflicts.)
It's true that the stable release updates policy is the reason Ubuntu 18.04 LTS does not happen to have GCC 9. But that's not the reason the build-essential
, gcc
, and g++
packages give you the older version of GCC--the version that was used to build the binary packages available for the system. (In 18.04 LTS, that version happens to be GCC 7.2.) The point of build-essential
is to give you the tools that are recommended, and officially used, for building packages for your release, and the purpose of the gcc
and g++
packages is to provide the components of GCC, including the gcc
and g++
commands, that are used for that purpose.
So even when an Ubuntu release officially provides later versions of GCC than the version that is used to build the system, those packages provide the earlier version.
build-essential
doesn't always depend on the latest compilers, and why packages likegcc
andg++
don't always provide them, isn't really that the latest compilers aren't always officially packaged for Ubuntu (even though it's true that they aren't, and that the reason for that is the StableReleaseUpdates policy that is explained there). Shortly before this was closed, I posted an answer. – Eliah Kagan Jul 02 '19 at 01:25