LinuxSir.cn,穿越时空的Linuxsir!

 找回密码
 注册
搜索
热搜: shell linux mysql
查看: 793|回复: 3

如何编译 gcc3.2.3?

[复制链接]
发表于 2009-5-10 00:43:15 | 显示全部楼层 |阅读模式
第一次用 gentoo,请多多指教。

手头上有些库没有源代码,依赖 libstdc++-v3,所以想编一个 gcc3.2.3 或 gcc3.3.6 来编译链接到这些库的程序。从官网 http://gcc.gnu.org 下载源代码,如果正常的话

../configure --enable-shared --enable-threads=posix --disable-checking --with-system-zlib --enable-__cxa_atexit --enable-languages=c,c++ --disable-libgcj --host=i686-pc-linux-gnu --disable-nls --prefix=/usr/local/gcc-3.2.3

make install

ln -s /usr/local/gcc-3.2.3/bin/gcc /usr/local/bin/gcc32
ln -s /usr/local/gcc-3.2.3/bin/g++ /usr/local/bin/g++32

以后只需要指定  CC=gcc32 CXX=g++32 就可以了,而且对现有的系统没影响,使用也简单。

可惜以上操作用 gcc4.3.3 都编译不通过,难道要先编个 gcc3.4.x 然后用 gcc3.4.x 去编一个 gcc3.2.3 ?


foo@BAR ~ $ emerge --info
Portage 2.1.6.13 (default/linux/x86/2008.0, gcc-4.3.3, glibc-2.9_p20081201-r2, 2.6.29-gentoo-r3 i686)
=================================================================
System uname: Linux-2.6.29-gentoo-r3-i686-Intel-R-_Celeron-R-_M_CPU_430_@_1.73GHz-with-gentoo-2.0.0
Timestamp of tree: Sat, 09 May 2009 09:45:01 +0000
ccache version 2.4 [enabled]
app-shells/bash:     4.0_p17-r1
dev-lang/python:     2.5.4-r2, 2.6.2
dev-util/ccache:     2.4-r8
sys-apps/baselayout: 2.0.0
sys-apps/openrc:     0.4.3-r2
sys-apps/sandbox:    1.9
sys-devel/autoconf:  2.63-r1
sys-devel/automake:  1.9.6-r2, 1.10.2
sys-devel/binutils:  2.19.1-r1
sys-devel/gcc-config: 1.4.1
sys-devel/libtool:   2.2.6a
virtual/os-headers:  2.6.28-r1
ACCEPT_KEYWORDS="x86 ~x86"
CBUILD="i686-pc-linux-gnu"
CFLAGS="-march=prescott -O2 -pipe"
CHOST="i686-pc-linux-gnu"
CONFIG_PROTECT="/etc /usr/share/config"
CONFIG_PROTECT_MASK="/etc/ca-certificates.conf /etc/env.d /etc/fonts/fonts.conf /etc/gconf /etc/gentoo-release /etc/init.d /etc/revdep-rebuild /etc/sandbox.d /etc/terminfo /etc/udev/rules.d"
CXXFLAGS="-march=prescott -O2 -pipe"
DISTDIR="/usr/portage/distfiles"
FEATURES="ccache distlocks fixpackages parallel-fetch protect-owned sandbox sfperms strict unmerge-orphans userfetch"
GENTOO_MIRRORS="http://61.135.158.199"
LANG="OSIX"
LDFLAGS="-Wl,-O1"
MAKEOPTS="-j2"
PKGDIR="/usr/portage/packages"
PORTAGE_CONFIGROOT="/"
PORTAGE_RSYNC_OPTS="--recursive --links --safe-links --perms --times --compress --force --whole-file --delete --stats --timeout=180 --exclude=/distfiles --exclude=/local --exclude=/packages"
PORTAGE_TMPDIR="/var/tmp"
PORTDIR="/usr/portage"
PORTDIR_OVERLAY="/usr/local/portage/layman/gentoo-china"
SYNC="rsync://61.135.158.199/gentoo-portage"
USE="X acl acpi alsa bash-completion berkdb bzip2 bzlib cjk cleartype cli cracklib crypt cups dri fb fortran freetype gdbm gpm iconv ipv6 isdnlog jpeg midi mmx mudflap ncurses nls nptl nptlonly openmp pam pcre perl png pppd python readline reflection session spl sse sse2 ssl sysfs tcpd truetype unicode x86 xft xorg zlib" ALSA_CARDS="hda-intel" ALSA_PCM_PLUGINS="adpcm alaw asym copy dmix dshare dsnoop empty extplug file hooks iec958 ioplug ladspa lfloat linear meter mmap_emul mulaw multi null plug rate route share shm softvol" APACHE2_MODULES="actions alias auth_basic authn_alias authn_anon authn_dbm authn_default authn_file authz_dbm authz_default authz_groupfile authz_host authz_owner authz_user autoindex cache dav dav_fs dav_lock deflate dir disk_cache env expires ext_filter file_cache filter headers include info log_config logio mem_cache mime mime_magic negotiation rewrite setenvif speling status unique_id userdir usertrack vhost_alias" ELIBC="glibc" INPUT_DEVICES="keyboard mouse synaptics" KERNEL="linux" LCD_DEVICES="bayrad cfontz cfontz633 glk hd44780 lb216 lcdm001 mtxorb ncurses text" USERLAND="GNU" VIDEO_CARDS="intel"
Unset:  CPPFLAGS, CTARGET, EMERGE_DEFAULT_OPTS, FFLAGS, INSTALL_MASK, LC_ALL, LINGUAS, PORTAGE_COMPRESS, PORTAGE_COMPRESS_FLAGS, PORTAGE_RSYNC_EXTRA_OPTS
发表于 2009-5-10 01:20:29 | 显示全部楼层
你总得给点出错信息吧
回复 支持 反对

使用道具 举报

发表于 2009-5-10 02:28:36 | 显示全部楼层
ebuild就告诉你应该怎么编译了

再不济,还有sys-libs/libstdc++-v3-bin

你根本不需要自己编译
回复 支持 反对

使用道具 举报

 楼主| 发表于 2009-5-10 03:04:41 | 显示全部楼层
嗯,从官网下代码编是不可行的,gcc4对语法检查严格。同时我要得是编译环境而不单单是libstdc++.so.5 的运行环境。

我参考这个
http://wiki.laptop.org/go/Instal ... ntoo_x86_with_GCC_3
最后编出了 gcc3.3.6

总结一下,过程很简单:
emerge -av sys-devel/gcc:3.4
gcc-config i686-pc-linux-gnu-3.4.6
source /etc/profile
emerge -av sys-devel/gcc:3.3
gcc-config i686-pc-linux-gnu-4.3.3
source /etc/profile

这就搞定了
回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 登录 | 注册

本版积分规则

快速回复 返回顶部 返回列表