How to install g++ 4.9 on Debian Wheezy armel?

前端 未结 4 571
挽巷
挽巷 2021-02-13 22:43

My Debian 7 armel embedded system currently has g++ 4.6, and I\'d like to upgrade to g++ 4.9 to use new C++11 features. How do I do that?

My current sources.list conten

4条回答
  •  暗喜
    暗喜 (楼主)
    2021-02-13 23:23

    Another workaround could be to install the g++ 4.9 packages from "Jessie", according to this blog post. Briefly, you would have to tell APT to use the Jessie repos while you are installing the new G++. First bring the current Wheezy up-to-date:

    sudo apt-get update
    sudo apt-get upgrade
    

    Then do a backup :-) and edit /etc/apt/sources.list so that you replace the string "wheezy" with "jessie":

    sudo cp /etc/apt/sources.list /etc/apt/sources.list.WHEEZY
    sudo vi /etc/apt/sources.list
    

    Now update the package list and install the 4.9 version of GCC/G++:

    sudo apt-get update
    sudo apt-get install gcc-4.9 g++-4.9
    

    After this revert to the "original" package list:

    sudo cp /etc/apt/sources.list.WHEEZY /etc/apt/sources.list
    sudo apt-get update
    

    This leaves the original GCC,G++ in place. If you wish to compile with the 4.9 version, then either set the CC and CXX env vars accordingly or invoke the compilers as gcc-4.9 or g++-4.9 explicitly.

提交回复
热议问题