ICE在Linux下的完整编译安装
安装平台要求:最好用gcc 4.x版编译ICE,在Slackware下发现gcc3.3.6和gcc3.4.6都无法编译通过
为了方便管理,将ICE相关的软件都安装到/usr/local/ICE-3.3.0/目录下
首先 安装第三方包:ThirdParty-Sources-3.3.0.tar.gz
解压 ThirdParty-Sources-3.3.0.tar.gz
# cd ThirdParty-Sources-3.3.0
1)mcpp is a C/C++ preprocessor
------
解压 mcpp-2.7.2.tar.gz
# cd mcpp-2.7.2
# ./configure --prefix=/usr/local/ICE-3.3.0/mcpp-2.7.2/ CFLAGS=-fPIC -enable-mcpplib -disable-shared
# make
# make install
2)Berkeley DB 是一个高性能的,嵌入数据库编程库,和C语言, C++, Java, Perl, Python, Tcl以及其他很多语言都有绑定。
--------
解压 db-4.6.21.NC.tar.gz
# cd db-4.6.21.NC
# cd build_unix
# ../dist/configure --prefix=/usr/local/ICE-3.3.0/BerkeleyDB.4.6/ -enable-cxx
# make
# make install
3)bzip2 是 Julian Seward 开发并按照自由软件/开源软件协议发布的数据压缩
...
#
# Select an installation base directory. The directory will be created
# if it does not exist.
#
# prefix ?= /opt/Ice-$(VERSION)
prefix ?= /usr/local/ICE-3.3.0/Ice-$(VERSION)
#
# The "root directory" for runpath embedded in executables. Can be unset
# to avoid adding a runpath to Ice executables.
#
# embedded_runpath_prefix ?= /opt/Ice-$(VERSION_MAJOR).$(VERSION_MINOR)
embedded_runpath_prefix ?= /usr/local/ICE-3.3.0/Ice-$(VERSION_MAJOR).$(VERSION_MINOR)
...
#
#
# If libbzip2 is not installed in a standard location where the
# compiler can find it, set BZIP2_HOME to the bzip2 installation
# directory.
#
BZIP2_HOME ?= /usr/local/ICE-3.3.0/bzip2-1.0.5
# If Berkeley DB is not installed in a standard location where the
# compiler can find it, set DB_HOME to the Berkeley DB installation
# directory.
#
#DB_HOME ?= /opt/db
DB_HOME ?= /usr/local/ICE-3.3.0/BerkeleyDB.4.6
#
# If expat is not installed in a standard location where the compiler
# can find it, set EXPAT_HOME to the expat installation directory.
#
#EXPAT_HOME ?= /opt/expat
EXPAT_HOME ?= /usr/local/ICE-3.3.0/expat-2.0.1
#
# If OpenSSL is not installed in a standard location where the
# compiler can find it, set OPENSSL_HOME to the OpenSSL installation
# directory.
#
#OPENSSL_HOME ?= /opt/openssl
OPENSSL_HOME ?= /usr/local/ICE-3.3.0/openssl
#
# If Mcpp is not installed in a standard location where the compiler
# can find it, set MCPP_HOME to the Mcpp installation directory.
#
#MCPP_HOME ?= /opt/mcpp
MCPP_HOME ?= /usr/local/ICE-3.3.0/mcpp-2.7.2
...
特别注意: cpp/config/Make.rules的相关第三方库的路径
# make
# make install
2)编译python 版本
# cd Ice-3.3.0/py
# vi config/Make.rules
修改方法参考cpp部分描述
# make
# make install
设置ICE环境变量
#vi /etc/profile
export PYTHONPATH=/usr/local/ICE-3.3.0/Ice-3.3/python/:
export ICE_HOME=/usr/local/ICE-3.3.0/Ice-3.3
export PATH=$PATH:$ICE_HOME/bin
export LD_LIBRARY_PATH=$ICE_HOME/lib
export PATH USER LOGNAME MAIL HOSTNAME HISTSIZE INPUTRC ICE_HOME
#source /etc/profile
++++++++++++++++++++++++++++++++++++++++
安装Ice3.4.2之前,应该下载并安装其依赖库。
1. 下载第三方包和Ice源文件:http://www.zeroc.com/download.html(官方下载页面)
在Source Distributions一栏下下载源文件:Ice-3.4.2.tar.gz;在Third-Party Source Code 一栏下选择ThirdParty-Sources-3.4.2.tar.gz第三方压缩包下载。
2. 安装第三方依赖库
解压ThirdParty-Sources-3.4.2.tar.gz:tar -xzvf ThirdParty-Sources-3.4.2.tar.gz 。
2.1) 安装Berkeley DB
$tar zxvf db-4.8.30.NC.tar.gz
$cd db-4.8.30.NC/build_unix
$../dist/configure --prefix=/usr --enable-cxx
(说明:db的默认安装prefix路径是/usr/local/BerkeleyDB.4.6,需要改为/usr,否则make Ice时会找不到路径)
$make #编译
$sudo make install #安装
2.2)安装 bzip2-1.0.6.tar.gz
$tar zxvf bzip2-1.0.6.tar.gz
$cd bzip2-1.0.6
$make install
2.3)安装 expat-2.0.1.tar.gz
$tar zxvf expat-2.0.1.tar.gz
$cd expat-2.0.1
$./configure
$sudo make install
2.4)安装openssl-0.9.8d.tar.gz
$tar zxvf openssl-0.9.8d.tar.gz
$cd openssl-0.9.8d
$./config --prefix=/usr --openssldir=/usr/openssl
(注意:prefix为/usr/local/ssl,openssldir默认为/usr/ssl/openssl,需要改为上面的,否则默认安装路径会找不到。)
$ make
$ make test
$ sudo make install
2.5)安装mcpp
$sudo apt-get install libmcpp-dev
3.安装Ice-3.4.2
$tar zxvf Ice-3.4.2.tar.gz
$cd Ice-3.4.2/cpp
$export LD_LIBRARY_PATH=/opt/Ice-3.4.2/lib
$make
$sudo make install
4.安装过程中出现的一些错误,及解决方法:
4.1)错误提示:/usr/lib.ld:Error:cannot find -lmcpp --->解决方法:应该是mcpp之前没有安装成功,将mcpp重新安装成功后就行
4.2)错误提示:fatal error:db_cxx.h:No such file or directory -->解决方法:之前没有把db-4.8.3安装成功,重新安装一遍
4.3)安装Ice完成后,运行例子错误提示:error while loading shared libraries: libIce.so.34: cannot open shared object file: No such file or directory -->解决办法:应该是之前编译Ice某些目录配置不对;使用命令 export LD_LIBRARY_PATH=/opt/Ice-3.4.2/lib重新来导出动态链接库目录即可。