下載以下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. 一直提示刪除同一個文件,終端標籤欄顯示sleep字樣,一直等待刪除文件。我在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。這帖子是2003年發的。近十年了,這BUG依然沒修
復!解決方法就是使其在同一個目錄。也就是你的源碼所在文件夾的路徑要和你將
要安裝的位置在同一個分區下才行。這裏我要將GCC安裝在/usr/local/gcc-4.7
下面。於是我將源碼包解壓到/usr下,然後編譯在解壓後的文件夾下建個文件夾進
行編譯。問題解決!!