How to install GCC 4.7.2 on Linux Mint? [closed]

↘锁芯ラ 提交于 2019-12-04 12:19:57

问题


I need to install the latest version of GCC on Linux Mint 13. I found some useful terminal commands for Ubuntu 12.04, but it seems that nothing similar for Mint exists on the Internet...

Edit: I solved the problem, so, in order to help everybody else, write these commands:

sudo add-apt-repository ppa:ubuntu-toolchain-r/test

sudo apt-get update

sudo apt-get install g++-4.7 c++-4.7

And everything works fine. :)


回答1:


I built it from source when I did this not too long ago.

I followed the instructions here, but I downloaded and extracted gcc 4.7.2 first instead of last and replaced steps 3 to 5 with running this script that comes with it (which does those steps for you):

gcc-4.7.2/contribs/download_prerequisites

You can download the gcc sources from one of the mirror sites: http://gcc.gnu.org/mirrors.html


Edit: added the instructions in-post

  1. Download and extract g++-4.7.2

  2. $sudo apt-get install gcc-multilib m4

  3. In order to compensate for insufficient path information, added this to .bashrc

    export LD_LIBRARY_PATH=/usr/local/lib:$LD_LIBRARY_PATH

    export LIBRARY_PATH=/usr/lib/i386-linux-gnu export

    export C_INCLUDE_PATH=/usr/include/i386-linux-gnu export

    export CPLUS_INCLUDE_PATH=/usr/include/i386-linux-gnu

  4. Add these symlinks for the same reason:

    $sudo ln -s /usr/include/i386-linux-gnu/gnu/stubs-32.h /usr/include/gnu

    $sudo ln -s /usr/lib/i386-linux-gnu/crti.o /usr/lib/crti.o

    $sudo ln -s /usr/lib/i386-linux-gnu/crt1.o /usr/lib/crt1.o

    $sudo ln -s /usr/lib/i386-linux-gnu/crtn.o /usr/lib/crtn.o

    $sudo ln -s /usr/local/lib/libmpc.so.3 /usr/lib/libmpc.so.3

  5. run gcc-4.7.2/contribs/download_prerequisites

  6. configure, make, make install




回答2:


To find a specific package type

apt-cache search "package"

In your case "gcc". Mine showed at least 40 different gnu compiler packages to choose from. The one it sounds like you want is gcc-4.7-base. Also you could update apt-get before searching.

sudo apt-get update


来源:https://stackoverflow.com/questions/12991401/how-to-install-gcc-4-7-2-on-linux-mint

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!