Install gcc-8 only on Ubuntu 18.04?











up vote
13
down vote

favorite
6












I just installed Lubuntu 18.04 LTS. There are two options for installing gcc: gcc-7 and gcc-8. Both are available from apt-get install out of the box.



Even after I installed gcc-8, the system is still going to install gcc-7 when I install other packages such as build-essential.



Since gcc-8 is newer, is there a way to make it install gcc-8 and gcc-8 only?










share|improve this question




















  • 1




    Just don't install build-essential but the other packages it depend on directly? dpkg-dev g++-8 gcc-8 libc6-dev libc-dev make
    – muru
    Apr 27 at 5:41










  • gcc-7 is required by gcc-8. Note : You can have as many gcc/g++ versions as you want, installed at the same time. Bionic extras : g++-4.8 g++-5 g++-6 g++-8 ... ... g++-7/gcc-7 is the system compiler. The older versions are required for building some older applications.
    – Knud Larsen
    Apr 27 at 9:40












  • @KnudLarsen "gcc-7 is required by gcc-8" what?
    – ZachB
    Sep 25 at 17:47















up vote
13
down vote

favorite
6












I just installed Lubuntu 18.04 LTS. There are two options for installing gcc: gcc-7 and gcc-8. Both are available from apt-get install out of the box.



Even after I installed gcc-8, the system is still going to install gcc-7 when I install other packages such as build-essential.



Since gcc-8 is newer, is there a way to make it install gcc-8 and gcc-8 only?










share|improve this question




















  • 1




    Just don't install build-essential but the other packages it depend on directly? dpkg-dev g++-8 gcc-8 libc6-dev libc-dev make
    – muru
    Apr 27 at 5:41










  • gcc-7 is required by gcc-8. Note : You can have as many gcc/g++ versions as you want, installed at the same time. Bionic extras : g++-4.8 g++-5 g++-6 g++-8 ... ... g++-7/gcc-7 is the system compiler. The older versions are required for building some older applications.
    – Knud Larsen
    Apr 27 at 9:40












  • @KnudLarsen "gcc-7 is required by gcc-8" what?
    – ZachB
    Sep 25 at 17:47













up vote
13
down vote

favorite
6









up vote
13
down vote

favorite
6






6





I just installed Lubuntu 18.04 LTS. There are two options for installing gcc: gcc-7 and gcc-8. Both are available from apt-get install out of the box.



Even after I installed gcc-8, the system is still going to install gcc-7 when I install other packages such as build-essential.



Since gcc-8 is newer, is there a way to make it install gcc-8 and gcc-8 only?










share|improve this question















I just installed Lubuntu 18.04 LTS. There are two options for installing gcc: gcc-7 and gcc-8. Both are available from apt-get install out of the box.



Even after I installed gcc-8, the system is still going to install gcc-7 when I install other packages such as build-essential.



Since gcc-8 is newer, is there a way to make it install gcc-8 and gcc-8 only?







gcc 18.04






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Jul 27 at 17:33









valiano

1,096413




1,096413










asked Apr 27 at 3:35









tinlyx

7472923




7472923








  • 1




    Just don't install build-essential but the other packages it depend on directly? dpkg-dev g++-8 gcc-8 libc6-dev libc-dev make
    – muru
    Apr 27 at 5:41










  • gcc-7 is required by gcc-8. Note : You can have as many gcc/g++ versions as you want, installed at the same time. Bionic extras : g++-4.8 g++-5 g++-6 g++-8 ... ... g++-7/gcc-7 is the system compiler. The older versions are required for building some older applications.
    – Knud Larsen
    Apr 27 at 9:40












  • @KnudLarsen "gcc-7 is required by gcc-8" what?
    – ZachB
    Sep 25 at 17:47














  • 1




    Just don't install build-essential but the other packages it depend on directly? dpkg-dev g++-8 gcc-8 libc6-dev libc-dev make
    – muru
    Apr 27 at 5:41










  • gcc-7 is required by gcc-8. Note : You can have as many gcc/g++ versions as you want, installed at the same time. Bionic extras : g++-4.8 g++-5 g++-6 g++-8 ... ... g++-7/gcc-7 is the system compiler. The older versions are required for building some older applications.
    – Knud Larsen
    Apr 27 at 9:40












  • @KnudLarsen "gcc-7 is required by gcc-8" what?
    – ZachB
    Sep 25 at 17:47








1




1




Just don't install build-essential but the other packages it depend on directly? dpkg-dev g++-8 gcc-8 libc6-dev libc-dev make
– muru
Apr 27 at 5:41




Just don't install build-essential but the other packages it depend on directly? dpkg-dev g++-8 gcc-8 libc6-dev libc-dev make
– muru
Apr 27 at 5:41












gcc-7 is required by gcc-8. Note : You can have as many gcc/g++ versions as you want, installed at the same time. Bionic extras : g++-4.8 g++-5 g++-6 g++-8 ... ... g++-7/gcc-7 is the system compiler. The older versions are required for building some older applications.
– Knud Larsen
Apr 27 at 9:40






gcc-7 is required by gcc-8. Note : You can have as many gcc/g++ versions as you want, installed at the same time. Bionic extras : g++-4.8 g++-5 g++-6 g++-8 ... ... g++-7/gcc-7 is the system compiler. The older versions are required for building some older applications.
– Knud Larsen
Apr 27 at 9:40














@KnudLarsen "gcc-7 is required by gcc-8" what?
– ZachB
Sep 25 at 17:47




@KnudLarsen "gcc-7 is required by gcc-8" what?
– ZachB
Sep 25 at 17:47










2 Answers
2






active

oldest

votes

















up vote
25
down vote













gcc-7 and gcc-8 will happily co-live together.



I would suggest to let gcc-7 be installed, for satisfying build-essential and perhaps other dependent packages, and configure gcc-8 to be your default gcc installation.



Use update-alternatives for having gcc redirected automatically to gcc-8:



sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-7 700 --slave /usr/bin/g++ g++ /usr/bin/g++-7
sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-8 800 --slave /usr/bin/g++ g++ /usr/bin/g++-8


This will give you the convenience of gcc being at the latest version, and still you will be able to invoke gcc-7 or gcc-8 directly.



If you'll wish to change the default gcc version later on, run sudo update-alternatives --config gcc. It will bring a prompt similar to this, which lets you pick the version to be used:



There are 2 choices for the alternative gcc (providing /usr/bin/gcc).

Selection Path Priority Status
------------------------------------------------------------
* 0 /usr/bin/gcc-8 800 auto mode
1 /usr/bin/gcc-7 700 manual mode
2 /usr/bin/gcc-8 800 manual mode

Press <enter> to keep the current choice[*], or type selection number:


The higher priority is the one that is picked automatically by update-alternatives.






share|improve this answer























  • This should be the accepted answer.
    – Maduka Jayalath
    Aug 18 at 15:09


















up vote
4
down vote













GCC 8 on Ubuntu 16.04



sudo add-apt-repository ppa:ubuntu-toolchain-r/test
sudo apt-get update
sudo apt-get install gcc-8 g++-8
gcc-8 --version


gives 8.1.0 as of 2018-11. See also: How to install gcc-7 or clang 4.0?






share|improve this answer





















    Your Answer








    StackExchange.ready(function() {
    var channelOptions = {
    tags: "".split(" "),
    id: "89"
    };
    initTagRenderer("".split(" "), "".split(" "), channelOptions);

    StackExchange.using("externalEditor", function() {
    // Have to fire editor after snippets, if snippets enabled
    if (StackExchange.settings.snippets.snippetsEnabled) {
    StackExchange.using("snippets", function() {
    createEditor();
    });
    }
    else {
    createEditor();
    }
    });

    function createEditor() {
    StackExchange.prepareEditor({
    heartbeatType: 'answer',
    convertImagesToLinks: true,
    noModals: true,
    showLowRepImageUploadWarning: true,
    reputationToPostImages: 10,
    bindNavPrevention: true,
    postfix: "",
    imageUploader: {
    brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
    contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
    allowUrls: true
    },
    onDemand: true,
    discardSelector: ".discard-answer"
    ,immediatelyShowMarkdownHelp:true
    });


    }
    });














    draft saved

    draft discarded


















    StackExchange.ready(
    function () {
    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2faskubuntu.com%2fquestions%2f1028601%2finstall-gcc-8-only-on-ubuntu-18-04%23new-answer', 'question_page');
    }
    );

    Post as a guest















    Required, but never shown

























    2 Answers
    2






    active

    oldest

    votes








    2 Answers
    2






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes








    up vote
    25
    down vote













    gcc-7 and gcc-8 will happily co-live together.



    I would suggest to let gcc-7 be installed, for satisfying build-essential and perhaps other dependent packages, and configure gcc-8 to be your default gcc installation.



    Use update-alternatives for having gcc redirected automatically to gcc-8:



    sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-7 700 --slave /usr/bin/g++ g++ /usr/bin/g++-7
    sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-8 800 --slave /usr/bin/g++ g++ /usr/bin/g++-8


    This will give you the convenience of gcc being at the latest version, and still you will be able to invoke gcc-7 or gcc-8 directly.



    If you'll wish to change the default gcc version later on, run sudo update-alternatives --config gcc. It will bring a prompt similar to this, which lets you pick the version to be used:



    There are 2 choices for the alternative gcc (providing /usr/bin/gcc).

    Selection Path Priority Status
    ------------------------------------------------------------
    * 0 /usr/bin/gcc-8 800 auto mode
    1 /usr/bin/gcc-7 700 manual mode
    2 /usr/bin/gcc-8 800 manual mode

    Press <enter> to keep the current choice[*], or type selection number:


    The higher priority is the one that is picked automatically by update-alternatives.






    share|improve this answer























    • This should be the accepted answer.
      – Maduka Jayalath
      Aug 18 at 15:09















    up vote
    25
    down vote













    gcc-7 and gcc-8 will happily co-live together.



    I would suggest to let gcc-7 be installed, for satisfying build-essential and perhaps other dependent packages, and configure gcc-8 to be your default gcc installation.



    Use update-alternatives for having gcc redirected automatically to gcc-8:



    sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-7 700 --slave /usr/bin/g++ g++ /usr/bin/g++-7
    sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-8 800 --slave /usr/bin/g++ g++ /usr/bin/g++-8


    This will give you the convenience of gcc being at the latest version, and still you will be able to invoke gcc-7 or gcc-8 directly.



    If you'll wish to change the default gcc version later on, run sudo update-alternatives --config gcc. It will bring a prompt similar to this, which lets you pick the version to be used:



    There are 2 choices for the alternative gcc (providing /usr/bin/gcc).

    Selection Path Priority Status
    ------------------------------------------------------------
    * 0 /usr/bin/gcc-8 800 auto mode
    1 /usr/bin/gcc-7 700 manual mode
    2 /usr/bin/gcc-8 800 manual mode

    Press <enter> to keep the current choice[*], or type selection number:


    The higher priority is the one that is picked automatically by update-alternatives.






    share|improve this answer























    • This should be the accepted answer.
      – Maduka Jayalath
      Aug 18 at 15:09













    up vote
    25
    down vote










    up vote
    25
    down vote









    gcc-7 and gcc-8 will happily co-live together.



    I would suggest to let gcc-7 be installed, for satisfying build-essential and perhaps other dependent packages, and configure gcc-8 to be your default gcc installation.



    Use update-alternatives for having gcc redirected automatically to gcc-8:



    sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-7 700 --slave /usr/bin/g++ g++ /usr/bin/g++-7
    sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-8 800 --slave /usr/bin/g++ g++ /usr/bin/g++-8


    This will give you the convenience of gcc being at the latest version, and still you will be able to invoke gcc-7 or gcc-8 directly.



    If you'll wish to change the default gcc version later on, run sudo update-alternatives --config gcc. It will bring a prompt similar to this, which lets you pick the version to be used:



    There are 2 choices for the alternative gcc (providing /usr/bin/gcc).

    Selection Path Priority Status
    ------------------------------------------------------------
    * 0 /usr/bin/gcc-8 800 auto mode
    1 /usr/bin/gcc-7 700 manual mode
    2 /usr/bin/gcc-8 800 manual mode

    Press <enter> to keep the current choice[*], or type selection number:


    The higher priority is the one that is picked automatically by update-alternatives.






    share|improve this answer














    gcc-7 and gcc-8 will happily co-live together.



    I would suggest to let gcc-7 be installed, for satisfying build-essential and perhaps other dependent packages, and configure gcc-8 to be your default gcc installation.



    Use update-alternatives for having gcc redirected automatically to gcc-8:



    sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-7 700 --slave /usr/bin/g++ g++ /usr/bin/g++-7
    sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-8 800 --slave /usr/bin/g++ g++ /usr/bin/g++-8


    This will give you the convenience of gcc being at the latest version, and still you will be able to invoke gcc-7 or gcc-8 directly.



    If you'll wish to change the default gcc version later on, run sudo update-alternatives --config gcc. It will bring a prompt similar to this, which lets you pick the version to be used:



    There are 2 choices for the alternative gcc (providing /usr/bin/gcc).

    Selection Path Priority Status
    ------------------------------------------------------------
    * 0 /usr/bin/gcc-8 800 auto mode
    1 /usr/bin/gcc-7 700 manual mode
    2 /usr/bin/gcc-8 800 manual mode

    Press <enter> to keep the current choice[*], or type selection number:


    The higher priority is the one that is picked automatically by update-alternatives.







    share|improve this answer














    share|improve this answer



    share|improve this answer








    edited Apr 27 at 7:13

























    answered Apr 27 at 7:07









    valiano

    1,096413




    1,096413












    • This should be the accepted answer.
      – Maduka Jayalath
      Aug 18 at 15:09


















    • This should be the accepted answer.
      – Maduka Jayalath
      Aug 18 at 15:09
















    This should be the accepted answer.
    – Maduka Jayalath
    Aug 18 at 15:09




    This should be the accepted answer.
    – Maduka Jayalath
    Aug 18 at 15:09












    up vote
    4
    down vote













    GCC 8 on Ubuntu 16.04



    sudo add-apt-repository ppa:ubuntu-toolchain-r/test
    sudo apt-get update
    sudo apt-get install gcc-8 g++-8
    gcc-8 --version


    gives 8.1.0 as of 2018-11. See also: How to install gcc-7 or clang 4.0?






    share|improve this answer

























      up vote
      4
      down vote













      GCC 8 on Ubuntu 16.04



      sudo add-apt-repository ppa:ubuntu-toolchain-r/test
      sudo apt-get update
      sudo apt-get install gcc-8 g++-8
      gcc-8 --version


      gives 8.1.0 as of 2018-11. See also: How to install gcc-7 or clang 4.0?






      share|improve this answer























        up vote
        4
        down vote










        up vote
        4
        down vote









        GCC 8 on Ubuntu 16.04



        sudo add-apt-repository ppa:ubuntu-toolchain-r/test
        sudo apt-get update
        sudo apt-get install gcc-8 g++-8
        gcc-8 --version


        gives 8.1.0 as of 2018-11. See also: How to install gcc-7 or clang 4.0?






        share|improve this answer












        GCC 8 on Ubuntu 16.04



        sudo add-apt-repository ppa:ubuntu-toolchain-r/test
        sudo apt-get update
        sudo apt-get install gcc-8 g++-8
        gcc-8 --version


        gives 8.1.0 as of 2018-11. See also: How to install gcc-7 or clang 4.0?







        share|improve this answer












        share|improve this answer



        share|improve this answer










        answered Oct 25 at 12:23









        Ciro Santilli 新疆改造中心 六四事件 法轮功

        9,08444246




        9,08444246






























            draft saved

            draft discarded




















































            Thanks for contributing an answer to Ask Ubuntu!


            • Please be sure to answer the question. Provide details and share your research!

            But avoid



            • Asking for help, clarification, or responding to other answers.

            • Making statements based on opinion; back them up with references or personal experience.


            To learn more, see our tips on writing great answers.





            Some of your past answers have not been well-received, and you're in danger of being blocked from answering.


            Please pay close attention to the following guidance:


            • Please be sure to answer the question. Provide details and share your research!

            But avoid



            • Asking for help, clarification, or responding to other answers.

            • Making statements based on opinion; back them up with references or personal experience.


            To learn more, see our tips on writing great answers.




            draft saved


            draft discarded














            StackExchange.ready(
            function () {
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2faskubuntu.com%2fquestions%2f1028601%2finstall-gcc-8-only-on-ubuntu-18-04%23new-answer', 'question_page');
            }
            );

            Post as a guest















            Required, but never shown





















































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown

































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown







            Popular posts from this blog

            Quarter-circle Tiles

            build a pushdown automaton that recognizes the reverse language of a given pushdown automaton?

            Mont Emei