ICE在Linux下的完整编译安装
ICE在Linux下的完整编译安装
安装平台要求:最好用gcc 4.x版编译ICE,在Slackware下发现gcc3.3.6和gcc3.4.6都无法编译通过
为了方便管理,将ICE相关的软件都安装到/usr/local/ICE-3.3.0/目录下
安装python
./configure --enable-shared
make
make install
首先 安装第三方包: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 开发并按照自由软件/开源软件协议发布的数据压缩算法及程序
--------
解压 bzip2-1.0.5.tar.gz
# cd bzip2-1.0.5
修改Makefile,将PREFIX指向/usr/local/ICE-3.3.0/bzip2-1.0.5
# make
# make install
4) expat 是一个 XML parsing C library
--------
解压 expat-2.0.1.tar.gz
# cd expat-2.0.1
# ./configure --prefix=/usr/local/ICE-3.3.0/expat-2.0.1/
# make
# make install
5) openssl 是 Secure Socket Layer (SSL) binary and related cryptographic tools
--------
解压 openssl-0.9.8g.tar.gz
# cd openssl-0.9.8g
# ./config --prefix=/usr/local/ICE-3.3.0/openssl
# make
# make install
现在正式安装 Ice-3.3.0.tar.gz
--------
解压 Ice-3.3.0.tar.gz
1) 编译 cpp版本:
# cd Ice-3.3.0/cpp
# vi config/Make.rules
...
#
# 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 ?= /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
安装过程出现的问题:
第一
/usr/bin/ld: /usr/local/python27/lib/python2.7/config/libpython2.7.a(abstract.o): relocation R_X86_64_32 against `a local symbol' can not be used when making a shared object; recompile with -fPIC
/usr/local/python27/lib/python2.7/config/libpython2.7.a: could not read symbols: Bad value
解决:重新安装python 加入--enable-shared
第二
error while loading shared libraries: libpython2.7.so.1.0: cannot open shared object file
解决:
Whereis libpython2.7.so.1.0
LB_DEBUG=libs python –V 查看缺少的库
做个软连接即可
第三
ICE的编译报错 libIce.so: undefined reference to `libiconv',解决:
这个问题很恶心,是ICE自己makefile的问题,找到cpp/config/Makefile.rules中,找到193行 :
ICONV_LIBS = $(if $(ICONV_HOME),-L$(ICONV_HOME)/$(libsubdir)) $(ICONV_LIB)
把这一行修改成下面的就好了, ICONV_LIB根本没有定义
ICONV_LIBS = $(if $(ICONV_HOME),-L$(ICONV_HOME)/$(libsubdir)) -liconv
安装过程可能还会有其他的问题,比如64位的机器lib包名为lib64 ,可以根据错误信息提示响应的做修改,把lib包做个软连接到lib64等。