天天看點

ICE專題:編譯環境建構

ICE作為一種無平台的中間件,提供了最靈活的編譯方式,即自定義的平台無關語言slice,這種以語言方式來配置的做法,極大的統一了網絡服務的标準,有點類似于java語言的實作與編譯,正是因為java語言的定義與實作都是由SUN公司提供的,才極大的推動了java語言的發發展。

1、mkdir ThirdParty

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

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都有相對應的包,安裝步驟是一樣的。

打開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://www.cnblogs.com/sgsoft/archive/2007/05/03/735220.html,如需轉載請自行聯系原作者