有許多朋友在Ubuntu下不能成功編譯安裝GCC4.3.2,編譯時經常會碰到了一些錯誤。下面摘記下Ubuntu社區simonwolf的成功經驗,或許對大家有所幫助。
a.下載源代碼
b.解壓
c.查看裡面的INSTALL文件夾, 裡面有一些關於安裝的幫助信息
--下面描述兩個必要的組件GMP, GPFR
Installing GMP method1:
sudo apt-get install m4
method2:------recommended
download the src.
unzip.
--to the following steps, please look into the INSTALL file in the source.
./configure
make
make check
make install: the default target path is /usr/local
Installing GPFR
download the src.
unzip.
--to the following steps, please look into the INSTALL file in the source.
./configure
make
make check
make install: the default target path is /usr/local
------
from the prerequisities of gcc. you may be need to install gawk (sudp apt-get install gawk )too.
d.configure進行注冊
假設加壓後的源代碼目錄是 gcc-4.3.2
這個目錄下還有不少別的目錄 比如INSTALL, gcc, ...
進入這個目錄,執行如下操作(可能需要管理員權限,即加sudo )
% mkdir objdir
% cd objdir
sudo ./../configure --enable-languages=c,c++
--prefix=/usr/local/gcc-4.3.2 --enable-shared --with-system-zlib
--without-included-gettext --enable-threads=posix --enable-nls
--enable-libstdcxx-debug --enable-mpfr --enable-targets=all
--enable-checking=release --build=i486-linux-gnu --host=i486-linux-gnu
--target=i486-linux-gnu --disable-multilib