On ubuntu 18.04, "gcc -dumpversion" output "7", it result in
that below check will return false:
dpkg --compare-versions 7 ge 7.0
Then, this script will install other gcc.
Actully, the full gcc version "gcc -dumpfullversion" output is
"7.3.0", than below check will turn true:
dpkg --compare-version 7.3.0 ge 7.0
So, there's no need to install other gcc.
In case of hitting error on ubuntu16.04, use below parameter:
gcc -dumpfullversion -dumpversion
Signed-off-by: Changcheng Liu <changcheng.liu@intel.com>
function ensure_decent_gcc_on_ubuntu {
# point gcc to the one offered by g++-7 if the used one is not
# new enough
- local old=$(gcc -dumpversion)
+ local old=$(gcc -dumpfullversion -dumpversion)
local new=$1
local codename=$2
if dpkg --compare-versions $old ge 7.0; then