由于工作需要,需要在我的64位的ubuntu15.04上搭建Ice3.4.1的開發環境。經過幾天的斷斷續續的百度谷歌終于把它搭建起來。發現自己無論做什麼,完全按照網上的步驟來,但總會遇到各種問題,無法像網上給出的步驟那樣順利安裝。好了,廢話少說,下面開始。
1.首先給出ice的官網,後面需要的資料都會在這裡下載下傳:https://zeroc.com/。
2.由于開始接觸ice,是以我先安裝了ice3.6。其實3.6的安裝步驟是很簡單,官網已經給出了。步驟如下:
Ubuntu 15.04
wget https://zeroc.com/download/GPG-KEY-zeroc-release
sudo apt-key add GPG-KEY-zeroc-release
sudo apt-add-repository "deb https://zeroc.com/download/apt/ubuntu15.04 stable main"
sudo apt-get update
sudo apt-get install zeroc-ice-all-runtime zeroc-ice-all-dev
3.但我需要的是3.4.1,是以體驗完就要解除安裝了:
sudo apt-get remove --purge zeroc-ice-all-runtime zeroc-ice-all-dev
sudo apt-get autoremove --purge zeroc-ice-all-runtime zeroc-ice-all-dev
4.下載下傳ice3.4.1,位址:https://zeroc.com/download/Ice/3.4/
需要下載下傳的包括:Ice-3.4.1.tar.gz 和ThirdParty-Sources-3.4.1.tar.gz其中ThirdParty-Sources-3.4.1.tar.gz 是所需的第三方庫,有點坑爹的是,我當時沒有注意到官網也有提供,是以到各個第三方庫的官網去找,浪費了很多時間。下面是安裝步驟:
4.1 解壓Ice-3.4.1.tar.gz到/opt/Ice-3.4.1;解壓ThirdParty-Sources-3.4.1.tar.gz。
4.2編譯安裝第三方庫
解壓:tar xzf 檔案名
bzip2-1.0.5:
cd bzip2-1.0.5
修改Makefile:PREFIX=/opt/Ice-3.4.1/bzip2-1.0.5
make
make install
mcpp-2.7.2:
./configure --prefix=/opt/Ice-3.4.1/mcpp-2.7.2/ CFLAGS=-fPIC -enable-mcpplib -disable-shared
make
make install
db-4.8.30:
cd db-4.8.30.NC/build_unix/
../dist/configure --prefix=/opt/Ice-3.4.1/db-4.8.30 -enable-cxx
make
make install
expat-2.0.1:
./configure --prefix=/opt/Ice-3.4.1/expat-2.0.1
make
make install
openssl:
./config --prefix=/opt/Ice-3.4.1/openssl
make
make install
5.安裝ice3.4.1
5.1修改Ice-3.4.1/cpp/config/Make.rules
BZIP2_HOME ?=/opt/Ice-3.4.1/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/Ice-3.4.1/BerkeleyDB.6.1
DB_HOME ?=/opt/Ice-3.4.1/db-4.8.30
#
# 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/Ice-3.4.1/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/Ice-3.4.1/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/Ice-3.4.1/mcpp-2.7.2
5.2編譯:make
發生錯誤:
1.各種缺少頭檔案,手動添加。
2.到最後如果顯示跟 upCast 有關的錯誤。則需要到https://forums.zeroc.com/forum/patches/5799-patch-for-compiling-ice-with-clang-and-gcc4-7?t=5647下載下傳更新檔,打完更新檔後,重新編譯。中間可能會有跟XXX.o找不到的錯誤有關,我這裡是有些需要lib64,是以将第三方支援庫的一些lib改為lib64,後面如遇到symbol bad什麼的錯誤,就将對應的庫删掉。
5.3 make install
6.配置/etc/profile
export ICE_HOME=/opt/Ice-3.4.1
export PATH=$ICE_HOME/bin:$PATH
export LD_LIBRARY_PATH=$ICE_HOME/lib64:$LD_LIBRARY_PATH
7.test
icegridnode -v
3.4.1
到此,64位ubuntu15.04下的Ice3.4.1編譯安裝成功。