这里写自定义目录标题
Solaris 10 安装gcc 4.6.3
Solaris 10 官方只在系统中集成了3.4.3的gcc,需要其他版本的可以在镜像站:
http://mirror.opencsw.org/opencsw/allpkgs/
找到对应的版本下载安装。
所需安装包
以4.6.3为例,需要下载以下安装包:
gcc4ada-4.6.3,REV=2012.03.05-SunOS5.10-sparc-CSW.pkg
gcc4core-4.6.3,REV=2012.03.05-SunOS5.10-sparc-CSW.pkg
gcc4g+±4.6.3,REV=2012.03.05-SunOS5.10-sparc-CSW.pkg
gcc4g++rt_stub-4.6.3,REV=2012.03.06-SunOS5.10-all-CSW.pkg
gcc4gfortran-4.6.3,REV=2012.03.05-SunOS5.10-sparc-CSW.pkg
gcc4java-4.6.3,REV=2012.03.05-SunOS5.10-sparc-CSW.pkg
gcc4objc-4.6.3,REV=2012.03.05-SunOS5.10-sparc-CSW.pkg
libiconv2-1.14,REV=2012.11.19-SunOS5.10-sparc-CSW.pkg
安装过程
opencsw的安装包可以直接使用pkgadd安装
例:
pkgadd -d /tmp/gcc/gcc4core-4.6.3,REV=2012.03.05-SunOS5.10-sparc-CSW.pkg
安装lib库
以4.6.3为例可能需要以下lib库,这些安装包都可以在上面的opencsw镜像站中找到:
lib_gnu_awt_xlib12-4.6.3,REV=2012.03.05-SunOS5.10-sparc-CSW.pkg
libffi4-4.6.3,REV=2012.03.05-SunOS5.10-sparc-CSW.pkg
libgcc_s1-4.6.3,REV=2012.03.05-SunOS5.10-sparc-CSW.pkg
libgcj12-4.6.3,REV=2012.03.05-SunOS5.10-sparc-CSW.pkg
libgcj_tools12-4.6.3,REV=2012.03.05-SunOS5.10-sparc-CSW.pkg
libgfortran3-4.6.3,REV=2012.03.05-SunOS5.10-sparc-CSW.pkg
libgij12-4.6.3,REV=2012.03.05-SunOS5.10-sparc-CSW.pkg
libgomp1-4.6.3,REV=2012.03.05-SunOS5.10-sparc-CSW.pkg
libobjc3-4.6.3,REV=2012.03.05-SunOS5.10-sparc-CSW.pkg
libobjc_gc3-4.6.3,REV=2012.03.05-SunOS5.10-sparc-CSW.pkg
libssp0-4.6.3,REV=2012.03.05-SunOS5.10-sparc-CSW.pkg
libstdc++6-4.6.3,REV=2012.03.05-SunOS5.10-sparc-CSW.pkg
安装同样可以直接使用pkgadd安装
安装完成
安装完成后的gcc路径为:
/opt/csw/gcc4/bin/gcc
在profile中添加环境变量,或直接在/usr/bin中创建软连接:
ln -s /opt/csw/gcc4/bin/gcc gcc
root@JSDB2 # uname -a
SunOS JSDB2 5.10 Generic_137111-08 sun4u sparc SUNW,Sun-Fire
root@JSDB2 # gcc -v
Reading specs from /opt/csw/lib/gcc/sparc-sun-solaris2.10/4.6.3/specs
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/opt/csw/libexec/gcc/sparc-sun-solaris2.10/4.6.3/lto-wrapper
Target: sparc-sun-solaris2.10
Configured with: /home/maciej/src/opencsw/pkg/gcc4/trunk/work/solaris10-sparc/build-isa-sparcv8plus/gcc-4.6.3/configure --program-suffix=-4.6 --prefix=/opt/csw --exec_prefix=/opt/csw --bindir=/opt/csw/bin --sbindir=/opt/csw/sbin --libexecdir=/opt/csw/libexec --datadir=/opt/csw/share --sysconfdir=/etc/opt/csw --sharedstatedir=/opt/csw/share --localstatedir=/var/opt/csw --libdir=/opt/csw/lib --infodir=/opt/csw/share/info --includedir=/opt/csw/include --mandir=/opt/csw/share/man --with-gnu-as --with-as=/opt/csw/bin/gas --without-gnu-ld --with-ld=/usr/ccs/bin/ld --enable-nls --with-included-gettext --with-libiconv-prefix=/opt/csw --with-x --with-mpfr=/opt/csw --with-gmp=/opt/csw --with-ppl=/opt/csw --with-cloog=/opt/csw --enable-cloog-backend=isl --enable-java-awt=xlib --enable-libada --enable-libssp --enable-objc-gc --enable-threads=posix --enable-languages=ada,c,c++,fortran,java,objc --with-system-zlib=/opt/csw --with-cpu=v8
Thread model: posix
gcc version 4.6.3 (GCC)