且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

ICE专题:编译环境构建

更新时间:2021-11-05 18:43:20


ICE作为一种无平台的中间件,提供了最灵活的编译方式,即自定义的平台无关语言slice,这种以语言方式来配置的做法,极大的统一了网络服务的标准,有点类似于java语言的实现与编译,正是因为java语言的定义与实现都是由SUN公司提供的,才极大的推动了java语言的发发展。

在linux平台下编译比windows平台简单的多,必须要用g++ 3.x来编译ICE的开发包,否则会报错。在http://www.zeroc.com/download.html 中下载Ice-3.0.1.tar.gzThirdParty-Sources-3.0.1.tar.gz,先编译ThirdParty-Sources-3.0.1.tar.gz:

1、mkdir ThirdParty

2、cp ThirdParty-Sources-3.0.1.tar.gz ThirdParty

3、tar –xzvf ThirdParty-Sources-3.0.1.tar.gz

4、tar –xzvf openssl-0.9.8a.tar.gz

5、cd openssl-0.9.8a

6、./ Configure;make;make install

7、cd ..

8、tar –xzvf expat-1.95.8.tar.gz

9、cd expat-1.95.8

10、./ configure;make;make install

11、cd ..

12、tar –xzvf db-4.3.29.NC.tar.gz

13、cd db-4.3.29.NC

14、cd build_unix

15、../dist/configure;make;make install

16、cd ../..

17、tar –xzvf Ice-3.0.1.tar.gz

18、cd Ice-3.0.1

19、将config文件夹下的Make.rules.Linux,将c++改为g++

20、将config文件夹下的Make.rules里面的变量修改为第三方库的路径,找?号的是系统已经安装的,在linux下STL就是STLport不用另行安装。

#STLPORT_HOME ?= /opt/STLport

#

# 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 ?= /opt/bzip2

#

# 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 = /root2/opt/db

#

# 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 = /root2/opt/openssl

#

# Define if your OpenSSL requires Kerberos, and if Kerberos is not

# installed in a standard location.

#

KERBEROS_HOME ?= /usr/kerberos

#

# 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 = /root2/opt/expat

#

# If readline is not installed in a standard location where the

# compiler can find it, AND you want to use readline,

# set READLINE_HOME to the readline installation directory.

#

#

#READLINE_HOME ?= /opt/readline

21、make;make install

这样ICE就可以编译过去了,可以用make test来测试编译得是否正确。

在windows平台上安装ICE比较简单,就是VC设置麻烦些。因为我用的是VC6.0,但用VC7.0和8.0都有相对应的包,安装步骤是一样的。

首先从http://www.zeroc.com/download.html下载ThirdParty-3.0.1-VC60.msiIce-3.0.1-VC60.msi,直接安装。

打开VC6.0,在include和lib设置时,在include中加入Ice-3.0.1-ThirdParty-VC60\include\stl_port和Ice-3.0.1-VC60\include。同理在lib中加入Ice-3.0.1-ThirdParty-VC60\lib和Ice-3.0.1-VC60\lib

将Ice-3.0.1-ThirdParty-VC60\include和Ice-3.0.1-ThirdParty-VC60\lib放在第一行,否则编译STL的时候还是没有用STL_port,就会编译失败。

在编译console类型的程序时,要将Porject->setting->c/c++->code gereration中的Use run-time library中的Debug Multithreaded DLL选上,实现多线程,因为ICE本身天生就是多线程的。

在任何情况下编译ICE程序,都要将Porject->setting->C++ Language中的Enable Run-Time Type Information (RTTI)选中,否则STL_port会报Access violation - no RTTI data In Visual Studio (Visual C++)错误。

这样,两种平台上的ICE都安装完毕,可以用Demo来测试环境。

转自:http://blog.chinaunix.net/u/20057/showart_122073.h...




本文转自斯克迪亚博客园博客,原文链接:http://www.cnblogs.com/sgsoft/archive/2007/05/03/735220.html,如需转载请自行联系原作者