有人成功编译gcc4.3.2吗?我编译时碰到了一个错误.

编译打包和其他
回复
simonwolf
帖子: 18
注册时间: 2008-04-19 20:59

有人成功编译gcc4.3.2吗?我编译时碰到了一个错误.

#1

帖子 simonwolf » 2008-10-05 17:09

有人成功编译gcc4.3.2吗?
具体的编译过程是什么呢??

我在编译时碰到了如下的错误:

.....
Checking multilib configuration for libgcc...
Configuring stage 1 in i686-pc-linux-gnu/libgcc
configure: loading cache ./config.cache
checking for --enable-version-specific-runtime-libs... no
checking for a BSD-compatible install... /usr/bin/install -c
checking for gawk... gawk
checking build system type... i686-pc-linux-gnu
checking host system type... i686-pc-linux-gnu
checking for i686-pc-linux-gnu-ar... ar
checking for i686-pc-linux-gnu-lipo... lipo
checking for i686-pc-linux-gnu-nm... /home/simon/gcc/gcc-4.3.2/objdir/./gcc/nm
checking for i686-pc-linux-gnu-ranlib... ranlib
checking for i686-pc-linux-gnu-strip... strip
checking whether ln -s works... yes
checking for i686-pc-linux-gnu-gcc... /home/simon/gcc/gcc-4.3.2/objdir/./gcc/xgcc -B/home/simon/gcc/gcc-4.3.2/objdir/./gcc/ -B/usr/local/gcc-4.3.2/i686-pc-linux-gnu/bin/ -B/usr/local/gcc-4.3.2/i686-pc-linux-gnu/lib/ -isystem /usr/local/gcc-4.3.2/i686-pc-linux-gnu/include -isystem /usr/local/gcc-4.3.2/i686-pc-linux-gnu/sys-include

checking for suffix of object files... configure: error: cannot compute suffix of object files: cannot compile

See `config.log' for more details.

make[2]: *** [configure-stage1-target-libgcc] Error 1
make[2]: Leaving directory `/home/simon/gcc/gcc-4.3.2/objdir'
make[1]: *** [stage1-bubble] Error 2
make[1]: Leaving directory `/home/simon/gcc/gcc-4.3.2/objdir'
make: *** [all] Error 2
-----------------

有人碰到类似的错误吗??

该如何解决.
simonwolf
帖子: 18
注册时间: 2008-04-19 20:59

Re: 有人成功编译gcc4.3.2吗?我编译时碰到了一个错误.

#2

帖子 simonwolf » 2008-10-06 23:01

难道没有人 成功编译过??
头像
kukunya
帖子: 241
注册时间: 2008-04-23 12:38
来自: Hefei P.R.C.

Re: 有人成功编译gcc4.3.2吗?我编译时碰到了一个错误.

#3

帖子 kukunya » 2008-10-06 23:05

还在用4.1的飘过……
爱自由,爱生活
--
Intel Core 2 Duo T6670
Intel GMA X4500 HD
Samsung DDR3 2G
WD 320G
--
U-Studio Karmic
simonwolf
帖子: 18
注册时间: 2008-04-19 20:59

Re: 有人成功编译gcc4.3.2吗?我编译时碰到了一个错误.

#4

帖子 simonwolf » 2008-10-07 23:31

已经 弄好了
mikael
帖子: 1
注册时间: 2008-10-11 17:14

Re: 有人成功编译gcc4.3.2吗?我编译时碰到了一个错误.

#5

帖子 mikael » 2008-10-11 17:17

simonwolf, 能不能把解决方案稍微说一下啊 俺是小菜鸟 最后能加我的qq:794915503 先谢谢了
6510724
帖子: 1
注册时间: 2008-10-18 19:24

Re: 有人成功编译gcc4.3.2吗?我编译时碰到了一个错误.

#6

帖子 6510724 » 2008-10-18 19:27

:em03 你好!打扰了,我在编译的时候遇到的同样的问题,头两天了一直找不到解决方案,能不能把解决方法发给我呀!先谢谢了,邮箱ncx995@163.com
头像
想入非非
帖子: 8078
注册时间: 2008-07-14 22:42
来自: Beijing
联系:

Re: 有人成功编译gcc4.3.2吗?我编译时碰到了一个错误.

#7

帖子 想入非非 » 2008-10-18 21:23

apt直接安装的。。。没有想过编译 :em05
Ubuntu User
zhouhbsea
帖子: 1
注册时间: 2008-09-10 16:34

Re: 有人成功编译gcc4.3.2吗?我编译时碰到了一个错误.

#8

帖子 zhouhbsea » 2008-10-26 17:54

你好!我在编译的时候遇到的同样的问题,能不能把解决方法发给呀!先谢了,邮箱zhouhuabing@gmail.com
simonwolf
帖子: 18
注册时间: 2008-04-19 20:59

Re: 有人成功编译gcc4.3.2吗?我编译时碰到了一个错误.

#9

帖子 simonwolf » 2008-10-31 1:32

-----------编译-gcc 4.3.2----------
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

注意
1. 这里是在objdir目录下,所以使用的是gcc-4.3.2目录下的configure
2. 关于configure的选项我 试了很多个, 也用了好长时间,才发现这个可用。这里给出一些如何发现这个选项的信息。
一开始我的电脑上转的是 gcc4.2.3. 后来我又更新到了gcc.4.3.2. 以下是我看到的已经安装(通过apt-get)的gcc的选项
//--------------gcc 4.3.2 -v 查看选项------------------
Using built-in specs.
Target: i486-linux-gnu
Configured
with: ../src/configure -v --with-pkgversion='Ubuntu 4.3.2-1ubuntu8'
--with-bugurl=file:///usr/share/doc/gcc-4.3/README.Bugs
--enable-languages=c,c++,fortran,objc,obj-c++ --prefix=/usr
--enable-shared --with-system-zlib --libexecdir=/usr/lib
--without-included-gettext --enable-threads=posix --enable-nls
--with-gxx-include-dir=/usr/include/c++/4.3 --program-suffix=-4.3
--enable-clocale=gnu --enable-libstdcxx-debug --enable-objc-gc
--enable-mpfr --enable-targets=all --enable-checking=release
--build=i486-linux-gnu --host=i486-linux-gnu --target=i486-linux-gnu
Thread model: posix
gcc version 4.3.2 (Ubuntu 4.3.2-1ubuntu8)
//----------------

//----------gcc4.2.2 -v 查看选项----------------------
Using built-in specs.
Target: i486-linux-gnu
Configured
with: ../src/configure -v
--enable-languages=c,c++,fortran,objc,obj-c++,treelang --prefix=/usr
--enable-shared --with-system-zlib --libexecdir=/usr/lib
--without-included-gettext --enable-threads=posix --enable-nls
--with-gxx-include-dir=/usr/include/c++/4.2 --program-suffix=-4.2
--enable-clocale=gnu --enable-libstdcxx-debug --enable-objc-gc
--enable-mpfr --enable-targets=all --enable-checking=release
--build=i486-linux-gnu --host=i486-linux-gnu --target=i486-linux-gnu
Thread model: posix
gcc version 4.2.3 (Ubuntu 4.2.3-2ubuntu7)

你可以把上面的一些选项直接拿过来用比如
--enable-languages=c,c++,fortran,objc,obj-c++
--enable-shared --with-system-zlib --libexecdir=/usr/lib
--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

3. 必须加上--disable-multilib否则会发生编译错误

4. 这里你必须指定
--build=i486-linux-gnu --host=i486-linux-gnu --target=i486-linux-gnu
否则会错误,在我的机器上他自己探测为i686-linux-gnu. 这会导致错误。

5. prefix 选项你指定了你想把gcc4.3.2安装到哪一个目录下, 你必须/最好指定

e. test. 参考INSTALL文件夹下面的信息

f. sudo make install
to install gcc4.3.2 to the prefix directory which is specified when configure.
simonwolf
帖子: 18
注册时间: 2008-04-19 20:59

Re: 有人成功编译gcc4.3.2吗?我编译时碰到了一个错误.

#10

帖子 simonwolf » 2008-11-01 23:56


以上是 在我的机器上安装的 过程。。

我想不同的机器 肯定会不同。。

所以 还是需要 想自己手动编译的人不怕麻烦。。。
tyssm2004
帖子: 1
注册时间: 2009-01-03 14:07

Re: 有人成功编译gcc4.3.2吗?我编译时碰到了一个错误.

#11

帖子 tyssm2004 » 2009-01-03 14:33

--build=i486-linux-gnu --host=i486-linux-gnu --target=i486-linux-gnu
一定得指定吗?

还有,“=”后面的值怎么得到滴?
头像
HuntXu
帖子: 5776
注册时间: 2007-09-29 3:09

Re: 有人成功编译gcc4.3.2吗?我编译时碰到了一个错误.

#12

帖子 HuntXu » 2009-01-03 16:08

tyssm2004 写了:--build=i486-linux-gnu --host=i486-linux-gnu --target=i486-linux-gnu
一定得指定吗?

还有,“=”后面的值怎么得到滴?
不一定需要指定...
gcc这种包如果你连这个东西的值代表什么和如何得到都搞不清楚的话那就不要编译了,用源不好么?
HUNT Unfortunately No Talent...
头像
Jarson
帖子: 2371
注册时间: 2008-07-21 9:44
来自: 深圳
联系:

Re: 有人成功编译gcc4.3.2吗?我编译时碰到了一个错误.

#13

帖子 Jarson » 2009-01-03 17:37

关注下,不怕麻烦只求实际的路过 :em05
头像
micro_zhu
帖子: 18
注册时间: 2008-12-22 12:24

Re: 有人成功编译gcc4.3.2吗?我编译时碰到了一个错误.

#14

帖子 micro_zhu » 2009-01-05 16:33

我也在做这个工作,不过没找到GPFR 在shell里面提示安装mpfr和gmp 这2个东东,偶下了结果又装了老半天,gmp可能没装成功,所以一切都还在摸索中。
.......................I love google.....................
yuanchengjun
帖子: 7
注册时间: 2007-01-10 11:55

Re: 有人成功编译gcc4.3.2吗?我编译时碰到了一个错误.

#15

帖子 yuanchengjun » 2009-03-09 10:48

export LD_LIBRARY_PATH=/usr/local/lib
回复