solaris10安装gcc,g++,gdb等开发工具

solaris10自带的gcc/g++版本较低,对于C++11不支持,所以需要安装高版本的gcc/g++。

准备好以下安装包:

bash-4.3.33,REV=2015.02.15-SunOS5.10-i386-CSW.pkg             libgcc_s1-4.8.0,REV=2013.03.29-SunOS5.10-i386-CSW.pkg
binutils-2.23.1,REV=2012.12.04-SunOS5.10-i386-CSW.pkg         libgmp10-6.0.0,REV=2014.10.29-SunOS5.10-i386-CSW.pkg
libiconv2-1.14,REV=2012.11.19-SunOS5.10-i386-CSW.pkg
cas_etcshells-1.50,REV=2015.01.17-SunOS5.10-all-CSW.pkg       libintl8-0.18.1.1,p,REV=2011.03.15-SunOS5.9-i386-CSW.pkg
cas_texinfo-1.50,REV=2015.01.17-SunOS5.10-all-CSW.pkg         libintl9-0.19.8,REV=2016.09.07-SunOS5.10-i386-CSW.pkg
common-1.7,REV=2012.11.24-SunOS5.10-all-CSW.pkg               liblzma5-5.0.4,REV=2013.01.01-SunOS5.10-i386-CSW.pkg
expat-2.1.0,REV=2013.01.01-SunOS5.10-i386-CSW.pkg             libmpc3-1.0.2,REV=2014.03.17-SunOS5.10-i386-CSW.pkg
gcc4ada-4.8.0,REV=2013.03.29-SunOS5.10-i386-CSW.pkg           libmpfr4-3.1.2,REV=2014.03.18-SunOS5.10-i386-CSW.pkg
gcc4core-4.8.0,REV=2013.03.29-SunOS5.10-i386-CSW.pkg          libncurses5-5.9,REV=2011.11.21-SunOS5.9-i386-CSW.pkg
gcc4g++-4.8.0,REV=2013.03.29-SunOS5.10-i386-CSW.pkg           libpcap1-1.5.2,REV=2014.01.01-SunOS5.10-i386-CSW.pkg
gcc4gfortran-4.8.0,REV=2013.03.29-SunOS5.10-i386-CSW.pkg      libpcap_dev-1.5.2,REV=2014.01.01-SunOS5.10-i386-CSW.pkg
gcc4java-4.8.0,REV=2013.03.29-SunOS5.10-i386-CSW.pkg          libpython2_6_1_0-2.6.9,REV=2016.03.03-SunOS5.10-i386-CSW.pkg
gcc4objc-4.8.0,REV=2013.03.29-SunOS5.10-i386-CSW.pkg          libreadline6-6.3,REV=2015.10.19-SunOS5.10-i386-CSW.pkg
gdb-7.6,REV=2013.08.14-SunOS5.10-i386-CSW.pkg                 libz1-1.2.8,REV=2013.09.23-SunOS5.10-i386-CSW.pkg
gdb-7.7,REV=2014.02.09-SunOS5.10-i386-CSW.pkg                 
iconv_stub-1.14,REV=2011.08.08-SunOS5.9-all-CSW.pkg           python-2.6.9,REV=2016.03.03-SunOS5.10-i386-CSW.pkg
isaexec-0.2,REV=2009.03.26-SunOS5.8-all-CSW.pkg              
libexpat0-1.95.8,REV=2011.07.15-SunOS5.9-i386-CSW.pkg       
libexpat1-2.1.0,REV=2013.01.01-SunOS5.10-i386-CSW.pkg   

安装包下载位置:https://download.csdn.net/download/dongsongz/12502958    

安装命令

#gzip -d ncurses-5.6-sol10-x86-local.gz
#pkgadd -d ncurses-5.6-sol10-x86-local

若出现类似下面的提示

WARNING:
    The <CSWlibexpat1> package "libexpat1 - XML parser
    toolkit, libexpat.so.1" is a prerequisite package and
    should be installed.
WARNING:
    The <CSWlibexpat0> package "libexpat0 - XML parser
    toolkit, libexpat.so.0" is a prerequisite package and
    should be installed.

安装名字以libexpat0和libexpat1开头的安装包即可。

配置profile示例

# cat /.profile
#
# Copyright (c) 2001 by Sun Microsystems, Inc.
# All rights reserved.
#
# ident "@(#)local.profile      1.10    01/06/23 SMI"
stty istrip

PATH=/opt/csw/gcc4/bin:/usr/bin:/usr/ucb:/etc:/usr/sfw/bin:/usr/sbin/:/usr/local/bin:/usr/xpg4/bin:/opt/csw/bin:.
export PATH
PS1='[\u@\h:$PWD]# '
export PS1
LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/lib:/usr/share/lib/make:/opt/csw/lib
export LD_LIBRARY_PATH
执行source /.profile生效

这样环境就会使用新安装的bash, gcc ,g++等工具。

装好后

# g++ -v
Reading specs from /opt/csw/lib/gcc/i386-pc-solaris2.10/4.8.0/specs
COLLECT_GCC=g++
COLLECT_LTO_WRAPPER=/opt/csw/libexec/gcc/i386-pc-solaris2.10/4.8.0/lto-wrapper
Target: i386-pc-solaris2.10
Configured with: /home/maciej/src/opencsw/pkg/gcc4/trunk/work/solaris10-i386/build-isa-pentium_pro/gcc-4.8.0/configure --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 --enable-cloog-backend=isl --enable-java-awt=xlib --enable-languages=ada,c,c++,fortran,go,java,objc --enable-libada --enable-libssp --enable-nls --enable-objc-gc --enable-threads=posix --program-suffix=-4.8 --with-cloog=/opt/csw --with-gmp=/opt/csw --with-included-gettext --with-ld=/usr/ccs/bin/ld --without-gnu-ld --with-libiconv-prefix=/opt/csw --with-mpfr=/opt/csw --with-ppl=/opt/csw --with-system-zlib=/opt/csw --with-gnu-as --with-as=/opt/csw/bin/gas
Thread model: posix
gcc version 4.8.0 (GCC)

[root@test:/export/home/dongsongz/src/]# make
make: Fatal error in reader: Makefile, line 11: Unexpected end of line seen

使用solaris的make可能会碰到上面的错误,使用gmake即可解决,gmake即gnu make。

猜你喜欢

转载自blog.csdn.net/dongsongz/article/details/106589755