说明:依赖缺失现象
-bash-3.2# pkgadd -d gcc4core-4.9.2\,REV\=2014.11.07-SunOS5.10-i386-CSW.pkg
The following packages are available:
1 CSWgcc4core gcc4core - GNU C compiler
(i386) 4.9.2,REV=2014.11.07
Select package(s) you wish to process (or 'all' to process
all packages). (default: all) [?,??,q]:
Processing package instance <CSWgcc4core> from </myb/gcc4core-4.9.2,REV=2014.11.07-SunOS5.10-i386-CSW.pkg>
gcc4core - GNU C compiler(i386) 4.9.2,REV=2014.11.07
Please see /opt/csw/share/doc/gcc4core/license for license information.
## Processing package information.
## Processing system information.
5 package pathnames are already properly installed.
## Verifying package dependencies.
WARNING:
The <CSWalternatives> package "alternatives -
Alternatives implementation specific to OpenCSW" is a
prerequisite package and should be installed.
WARNING:
The <CSWlib-gnu-awt-xlib15> package "lib_gnu_awt_xlib15
- The GNU Compiler Collection, lib-gnu-awt-xlib.so.15"
is a prerequisite package and should be installed.
WARNING:
The <CSWlibatomic1> package "libatomic1 - The GNU
Compiler Collection, libatomic.so.1" is a prerequisite
package and should be installed.
WARNING:
The <CSWlibgcj15> package "libgcj15 - The GNU Compiler
Collection, libgcj.so.15" is a prerequisite package and
should be installed.
WARNING:
The <CSWlibgcj-tools15> package "libgcj_tools15 - The
GNU Compiler Collection, libgcj-tools.so.15" is a
prerequisite package and should be installed.
WARNING:
The <CSWlibgij15> package "libgij15 - The GNU Compiler
Collection, libgij.so.15" is a prerequisite package and
should be installed.
WARNING:
The <CSWlibgo5> package "libgo5 - The GNU Compiler
Collection, libgo.so.5" is a prerequisite package and
should be installed.
WARNING:
The <CSWlibitm1> package "libitm1 - The GNU Compiler
Collection, libitm.so.1" is a prerequisite package and
should be installed.
WARNING:
The <CSWlibmpc3> package "libmpc3 - C library for the
arithmetic of complex numbers with arbitrarily high
precision, libmpc.so.3" is a prerequisite package and
should be installed.
WARNING:
The <CSWlibcilkrts5> package "libcilkrts5 - The GNU
Compiler Collection, libcilkrts.so.5" is a prerequisite
package and should be installed.
Do you want to continue with the installation of <CSWgcc4core> [y,n,?] y
## Verifying disk space requirements.
## Checking for conflicts with packages already installed.
## Checking for setuid/setgid programs.
如上,是安装一个程序,但存在依赖缺失,这个在安装种需要记录并逐个都进行解决安装缺失的依赖。
说明:solaris软件包官方源离线下载网址
本文提到的都是在该网站下载到。
说明:solaris软件包网盘分享下载地址
链接:https://pan.baidu.com/s/1Hh-v1VChBFNbXNI1c3Bigg?pwd=what
提取码:what
安装gccg++、make、vim方法说明
安装gcc和g++核心安装4个包,其他都是解决这四个的依赖包。
gcc4g++-4.9.2,REV=2014.11.07-SunOS5.10-i386-CSW.pkg.gz
gcc4core-4.9.2,REV=2014.11.07-SunOS5.10-i386-CSW.pkg.gz
libgcc_s1-4.9.2,REV=2014.11.07-SunOS5.10-i386-CSW.pkg.gz
libstdc++6-5.5.0,REV=2017.10.23-SunOS5.10-i386-CSW.pkg.gz
安装vim核心安装1个包,其他都是解决依赖的包安装
vim-8.0.238,REV=2017.01.30-SunOS5.9-i386-CSW.pkg.gz
安装make核心安装1个包,其他都是解决依赖的包安装
gmake-4.4.1,REV=2024.01.30-SunOS5.10-i386-CSW.pkg.gz
安装gccg++、make、vim详情
gcc需要4.7以后版本支持C++11,这里安装4.9版本,安装以下,
其中,vim、vimrt、terminfo这些是安装vim。
其中,gmake是安装make
'alternatives-1.2,REV=2013.10.15-SunOS5.10-all-CSW.pkg.gz' 'libgnugetopt-1.3,REV=2010.01.18-SunOS5.8-i386-CSW.pkg.gz'
'binutils-2.26,REV=2016.05.19-SunOS5.10-i386-CSW.pkg.gz' 'libgo5-4.9.2,REV=2014.11.07-SunOS5.10-i386-CSW.pkg.gz'
'cas_texinfo-1.50,REV=2015.01.17-SunOS5.10-all-CSW.pkg.gz' 'libgomp1-4.6.3,REV=2012.03.06-SunOS5.10-i386-CSW.pkg.gz'
'common-1.7,REV=2012.11.24-SunOS5.10-all-CSW.pkg.gz' 'libiconv-1.13.1,REV=2009.07.31-SunOS5.8-i386-CSW.pkg.gz'
'coreutils-8.22,REV=2014.06.14-SunOS5.10-i386-CSW.pkg.gz' 'libiconv2-1.14,REV=2012.11.19-SunOS5.10-i386-CSW.pkg.gz'
'gcc4core-4.9.2,REV=2014.11.07-SunOS5.10-i386-CSW.pkg.gz' 'libintl8-0.18.1.1,p,REV=2011.03.15-SunOS5.9-i386-CSW.pkg.gz'
'gcc4g++-4.9.2,REV=2014.11.07-SunOS5.10-i386-CSW.pkg.gz' 'libintl9-0.19.8,REV=2016.09.08-SunOS5.10-i386-CSW.pkg.gz'
'gcc4g++rt_stub-4.6.3,REV=2012.03.06-SunOS5.10-all-CSW.pkg.gz' 'libisl7-0.16.3,REV=2011.09.08-SunOS5.9-i386-CSW.pkg.gz'
'ggettext_data-0.19.8,REV=2016.09.08-SunOS5.10-all-CSW.pkg.gz' 'libitm1-5.5.0,REV=2017.10.23-SunOS5.10-i386-CSW.pkg.gz'
'ggrep-3.8,REV=2022.09.03-SunOS5.10-i386-CSW.pkg.gz' 'libmpc3-1.0.2,REV=2014.03.17-SunOS5.9-i386-CSW.pkg.gz'
'gmake-4.4.1,REV=2024.01.30-SunOS5.10-i386-CSW.pkg.gz' 'libmpfr4-3.1.5,REV=2016.11.28-SunOS5.10-i386-CSW.pkg.gz'
'gsed-4.8,REV=2020.02.05-SunOS5.10-i386-CSW.pkg.gz' 'libncurses5-5.9,REV=2011.11.21-SunOS5.9-i386-CSW.pkg.gz'
'lib_gnu_awt_xlib15-4.9.2,REV=2014.11.07-SunOS5.10-i386-CSW.pkg.gz' 'libpcre2_8_0-10.34,REV=2020.04.26-SunOS5.10-i386-CSW.pkg.gz'
'libatomic1-5.5.0,REV=2017.10.23-SunOS5.10-i386-CSW.pkg.gz' 'libppl9-0.11.2,REV=2011.09.25-SunOS5.9-i386-CSW.pkg.gz'
'libcilkrts5-5.5.0,REV=2017.10.23-SunOS5.10-i386-CSW.pkg.gz' 'libppl_c4-0.11.2,REV=2011.09.25-SunOS5.9-i386-CSW.pkg.gz'
'libcloog_isl2-0.16.3,REV=2011.09.08-SunOS5.9-i386-CSW.pkg.gz' 'libpwl5-0.11.2,REV=2011.09.25-SunOS5.9-i386-CSW.pkg.gz'
'libffi4-4.6.3,REV=2012.03.06-SunOS5.10-i386-CSW.pkg.gz' 'libpython2_7_1_0-2.7.8,REV=2014.09.23-SunOS5.10-i386-CSW.pkg.gz'
'libfl2-2.6.4,REV=2019.05.21-SunOS5.10-i386-CSW.pkg.gz' 'libquadmath0-5.5.0,REV=2017.10.23-SunOS5.10-i386-CSW.pkg.gz'
'libgcc_s1-4.9.2,REV=2014.11.07-SunOS5.10-i386-CSW.pkg.gz' 'libssp0-5.5.0,REV=2017.10.23-SunOS5.10-i386-CSW.pkg.gz'
'libgcj15-4.9.2,REV=2014.11.07-SunOS5.10-i386-CSW.pkg.gz' 'libstdc++6-5.5.0,REV=2017.10.23-SunOS5.10-i386-CSW.pkg.gz'
'libgcj_tools15-4.9.2,REV=2014.11.07-SunOS5.10-i386-CSW.pkg.gz' 'libz1-1.3,REV=2023.11.03-SunOS5.10-i386-CSW.pkg.gz'
'libgij15-4.9.2,REV=2014.11.07-SunOS5.10-i386-CSW.pkg.gz' 'terminfo-6.2,REV=2020.05.15-SunOS5.10-all-CSW.pkg.gz'
'libgmp10-6.1.2,REV=2017.03.09-SunOS5.10-i386-CSW.pkg.gz' 'vim-8.0.238,REV=2017.01.30-SunOS5.9-i386-CSW.pkg.gz'
'libgmpxx4-6.1.2,REV=2017.03.09-SunOS5.10-i386-CSW.pkg.gz' 'vimrt-8.0.238,REV=2017.01.30-SunOS5.10-all-CSW.pkg.gz'
创建gccg++、make、vim链接
ln -s /opt/csw/gcc4/bin/gcc
ln -s /opt/csw/gcc4/bin/g++
ln -s /opt/csw/bin/vim /usr/bin/vim
ln -s /opt/csw/gnu/make /usr/bin/make
系统默认自带说明
本身solaris 10已经自带了gcc、g++、make,但其不在path环境变量所以直接执行不了。通过find查看。一般在如下位置,但注意其版本过低,无法使用,还是需要安装如上方法进行升级。
/opt/csw/gnu/make
/usr/sfw/bin/gcc
/usr/sfw/bin/g++
验证c++11程序和makefile
issupportc11.cpp
cat issupportc11.cpp
#include <iostream>
#include <string>
using namespace std;
int main()
{
string str = "support c++ 11";
for (auto &c : str) {
c = toupper(c);
}
cout << str << endl;
}
// g++ -std=c++11 -o issupportc11 issupportc11.cpp
Makefile
OBJ := issupportc11.o
issupportc11: $(OBJ)
g++ -std=c++11 -o issupportc11 $(OBJ)
$(OBJ): %.o : %.cpp
g++ -c -std=c++11 $< -o $@
clean:
rm -rf $(OBJ)
rm -rf issupportc11
部署完毕后执行make,确认以上make可执行成功,并成功编译出运行输出“support c++ 11”的issupportc11程序。
-bash-3.2# make
g++ -c -std=c++11 issupportc11.cpp -o issupportc11.o
g++ -std=c++11 -o issupportc11 issupportc11.o
-bash-3.2# ./issupportc11
SUPPORT C++ 11
-bash-3.2#
其他solaris软件包管理pkgxxx说明
查看包
pkginfo | grep make
-bash-3.2# pkginfo | grep make
application CSWgmake gmake - GNU Make controls generation of executables and other compile-related tasks
system SUNWgm4 gmake - GNU m4
system SUNWgmake gmake - GNU make
system SUNWxcu4t XCU4 make and sccs utilities
-bash-3.2#
解压gz包
离线下载下来的包都是 xxxx.pkg.gz,通过命令
gunzip xxxx.pkg.gz命令,将xxxx.pkg.gz包解压为xxxx.pkg
.pkg为solaris的软件包。
安装包
命令为: pkgadd -d xxxx.pkg
注意安装种产生WARNING则必须解决,否则装的不完整,如vim只装一半,会在使用中发现键盘上下左右操作有问题。
案例:参见前边说明的依赖缺失现象 的章节。
卸载包
pkginfo | grep make查询到。如下:
-bash-3.2# pkginfo | grep make
application CSWgmake gmake - GNU Make controls generation of executables and other compile-related tasks
system SUNWgm4 gmake - GNU m4
system SUNWgmake gmake - GNU make
system SUNWxcu4t XCU4 make and sccs utilities
-bash-3.2#
其中加入卸载make程序,即包CSWgmake,使用命令 pkgrm CSWgmake 即可删除卸载。