1

How can I install gcc6.4, g++6.4 and cmake3 on Ubuntu 14.04? I want to rewrite below lines that run on Linux to be run on Ubuntu

$ yum install gcc64-c++ libcurl-devel
$ export CC=gcc64
$ export CXX=g++64
$ yum install cmake3

I tried below commands on ubuntu

$ sudo add-apt-repository ppa:ubuntu-toolchain-r/test
$ sudo apt update
$ sudo apt install -y g++-6
$ sudo apt install -y gcc-6
$ gcc --version
$ g++ --version
$ export CC=gcc6
$ export CXX=g++6
$ gcc --version
$ g++ --version

But version returned is

gcc (Ubuntu 4.8.4-2ubuntu1~14.04.4) 4.8.4

and

g++ (Ubuntu 4.8.4-2ubuntu1~14.04.4) 4.8.4 

Although I expect to be 6.4

And when I tried to install cmake3

 $ sudo apt-get update
 $ sudo apt purge cmake*
 $ wget http://www.cmake.org/files/v3.5/cmake-3.5.1.tar.gz
 $ tar xf cmake-3.5.1.tar.gz
 $ cd cmake-3.5.1
 $ ./configure
 $ make
 $ sudo make install
 $ cmake --version

It gave me an error in ./configure

CMake 3.5.1, Copyright 2000-2016 Kitware, Inc. 
--------------------------------------------- 
Error when bootstrapping CMake: 
Cannot find appropriate C compiler on this system. 
Please specify one using environment variable CC. 
Melebius
  • 11,431
  • 9
  • 52
  • 78
  • 1
    Instead of yum, use apt. Example: sudo apt install g++ – Elias Apr 10 '19 at 23:09
  • If you are familiar with yum, take a look at https://www.digitalocean.com/community/tutorials/package-management-basics-apt-yum-dnf-pkg If you are lost, just search on that page for the correct yum command and you get the alternative of apt-get. – v010dya Apr 11 '19 at 05:17
  • I add more description to the question to be more clearer. Can you please check and give me your advise – Mohammed Hassan Apr 11 '19 at 07:15
  • You have installed the packages gcc-6 and g++-6 and you should be able to run these commands (gcc-6 and g++-6 literally). The system-default version wasn’t replaced as you might have expected. Related: https://askubuntu.com/questions/26498/how-to-choose-the-default-gcc-and-g-version BTW, a terminology notice: “lines that run on Linux to be run on Ubuntu” Ubuntu is Linux, too. – Melebius Apr 11 '19 at 07:38
  • I added below command sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-6 60 --slave /usr/bin/g++ g++ /usr/bin/g++-6 and now gcc version is correct but cmake still gave me the same error – Mohammed Hassan Apr 11 '19 at 08:38
  • I guess you are using Ubuntu 14.04 from your GCC version. If you need more recent GCC and CMake version, why don’t you upgrade Ubuntu and get them automatically? You should be also able to install cmake3 using APT on Ubuntu 14.04. – Melebius Apr 11 '19 at 09:03
  • You are correct I'm using Ubuntu version 14. But I can't upgrade it. its a certain version given by aws CodeBuild. Is there anyway to install cmake3.5 on Ubuntu 14.04.5 LTS ? – Mohammed Hassan Apr 11 '19 at 09:35
  • I found another docker that Ubuntu version 18. But it gives me the same error. – Mohammed Hassan Apr 11 '19 at 10:04
  • 1
    Likely export CC=gcc6 and export CXX=g++6 should be export CC=gcc-6 and export CXX=g++-6 (check the actual names using ls /usr/bin/gcc*) – steeldriver Apr 11 '19 at 11:16
  • 2
    “Is there anyway to install cmake3.5 on Ubuntu 14.04.5 LTS ?” Yes, as I indicated, you should be able to simply run sudo apt install cmake3 to get CMake 3.5.1. – Melebius Apr 11 '19 at 11:30
  • 2
    I used Ubuntu 18 and its working. Thanks a lot for your support :) – Mohammed Hassan Apr 11 '19 at 15:06

0 Answers0