Current Ubuntu With the GCC version of 4.6, unfortunately in the actual use, but the higher the better the better the problem, so, once you encounter the compilation problem, it is best to check the Readme in the project you downloaded, the default compiler version is the current installation version, if not, you need to note that it is likely to be a version compatibility issue (even you may be the first UG Lucky person), after initial debugging can try to reduce the version test.
There are currently two major GCC versions, one is gcc4.4, one is the latest version of GCC (4.6), and the following describes the two versions of the switch and installation methods.
First, the latest version of GCC installation
[Email protected]:~# apt-get Install build-essential
Here Build-essential will automatically install the latest version of GCC, if you need to specify to use the old version of GCC, can only be manually installed.
Second, GCC 4.4 installation
GCC 4.4 is currently a version of a number of projects, the installation method is as follows:
[Email protected]:~# apt-get Install gcc-4.4 g++-4.4 g++-4.4-multilib gcc-4.4-multilib
Third, set the GCC version switch 1, manually switch
After setting, you need to manually switch the selection when using.
[Email protected]:~# ls/usr/bin/gcc*-llrwxrwxrwx 1 root root Sep 04:42/usr/bin/gcc-/ETC/ALTERNATIVES/GCC-RW Xr-xr-x 1 root root 224544 Apr 22:58/usr/bin/gcc-4.4-rwxr-xr-x 1 root root 306200 Apr 19:45/usr/bin/gcc-4.6[email protected]:~ #update-alternatives--install/usr/bin/gcc gcc/usr/bin/gcc-4.4 50[email protected]:~# Update-alternatives--install/usr/bin/g++ gcc/usr/bin/g++-4.4 50
Select a method (based on the compiler to select one):
[Email protected]:~ #update-alternatives--config gcc[email protected]:~ #update-alternatives--config g++
Reference Selection Interface:
[Email protected]:~# update-alternatives--config G++there is 2 choices for the alternative g++ (providing/usr/bin/g++). Selection Path Priority Status------------------------------------------------------------* 0 /usr/bin/g++- 4.4 Auto mode 1 /usr/bin/g++-4.4 manual mode 2 /usr/bin/g++-4.6 50
2, set the priority level automatically
After setting, the system is automatically selected according to the priority, assuming that to set gcc4.4 takes precedence over gcc4.6, the Setup method is as follows:
Update-alternatives--install/usr/bin/g++ g++/usr/bin/g++-4.4 100update-alternatives--install/usr/bin/g++ g++/usr/ bin/g++-4.6 50update-alternatives--install/usr/bin/gcc gcc/usr/bin/gcc-4.4 100update-alternatives--install/usr/ BIN/GCC gcc/usr/bin/gcc-4.6 50update-alternatives--install/usr/bin/cpp cpp-bin/usr/bin/cpp-4.4 100update-alternatives--install/usr/bin/cpp cpp-bin/usr/bin/cpp-4.6 50
When Setup is complete, GCC automatically switches to use version 4.4 because the above setting 4.4 takes precedence over 4.6
Iv. viewing the GCC version in effect
Gcc-v
Example output:
[email protected]:~# gcc-vusing built-in specs. Collect_gcc=gcccollect_lto_wrapper=/usr/lib/gcc/i686-linux-gnu/4.6/lto-wrappertarget:i686-linux-gnuconfigured With:.. /src/configure-v--with-pkgversion= ' Ubuntu/linaro 4.6.3-1ubuntu5 '--with-bugurl=file:///usr/share/doc/gcc-4.6/ Readme. Bugs--enable-languages=c,c++,fortran,objc,obj-c++--prefix=/usr--program-suffix=-4.6--enable-shared-- Enable-linker-build-id--with-system-zlib--libexecdir=/usr/lib--without-included-gettext--enable-threads=posix- -with-gxx-include-dir=/usr/include/c++/4.6--libdir=/usr/lib--enable-nls--with-sysroot=/--enable-clocale=gnu-- Enable-libstdcxx-debug--enable-libstdcxx-time=yes--enable-gnu-unique-object--enable-plugin--ENABLE-OBJC-GC-- Enable-targets=all--disable-werror--with-arch-32=i686--with-tune=generic--enable-checking=release--build= I686-linux-gnu--host=i686-linux-gnu--target=i686-linux-gnuthread MODEL:POSIXGCC version 4.6.3 (Ubuntu/Linaro 4.6.3-1UBUNTU5) [email protected]:~#
Error in ' gcc ': double free or corruption (top):
->use gcc-6 instead
https://www.raspberrypi.org/forums/viewtopic.php?f=28&t=139091&p=922980
Source: http://www.metsky.com/archives/607.html
From for notes (Wiz)
Ubuntu/raspberry Switch GCC version