下载以下3个文件,还有GCC 4.7.2.

gmp-5.0.5  (关于GMP: http://gmplib.org/ 

mpfr-3.1.1  (关于MPFR: http://www.mpfr.org/mpfr-current/mpfr.html 

mpc-1.0  (关于MPC: http://www.multiprecision.org/ 

按网上其他人的方法,依次安装GMP,MPFR和MPC。

==========================

最后安装GCC,我按他们的方法安装的时候,出现,libtool: link  for XXX  to be removed.  一直提示删除同一个文件,我在FINDER里面找到手动删除,依然无效。于是只能放弃。然后百度找解决方法。

在国外论坛看到一个人说:

I know this is old but will post here in hopes that anybody doing a search (which is the Right Thing(tm) ) with this problem in the future can get the solution. 

This is a bug/issue with libtool. When you see an endless line of 

"Waiting for somefile.o.lock to be removed" 

The usual explanation is that libtool is confused because your build directory is not on the same file system as that of libtool (usually for libtool, /usr). 

With Gentoo, the most likely explanation is that you have set PORTAGE_TMPDIR to duh, a tmp location that is not on the same partition as /usr. Short solution: reset PORTAGE_TMPDIR for this package only, i.e.: 

export PORTAGE_TMPDIR=/var/tmp 

emerge whatever it is you are working on and set PORTAGE_TMPDIR back to it's original location. This behavior should be fixed in libtool eventually, but that's a different discussion. 

Extended info: 

If you are building something manually, many configure scripts allow you to override the lock check via "./configure --disable-libtool-lock". Keep in mind the original purpose of the lock is to prevent error between concurrent builds on multi-user systems - if you are in that circumstance potentially, use at your own peril.

大致意思是说 你要编译的东西所在目录和你写入东西所在的目录不在一个分区。导致出现这种问题。是个BUG。

解决方法就是使其在同一个目录。也就是你的源码所在文件夹的路径要和你将要安装的位置在同一个分区下才行。这里我要将GCC安装在/usr/local/gcc-4.7下面。于是将源码包解压到/usr下,然后编译。问题解决!!

12-08 09:38