歡迎來到Linux教程網
Linux教程網
Linux教程網
Linux教程網
Linux教程網 >> Unix知識 >> 關於Unix >> 在Solaris上編譯Ethereal的注意事項

在Solaris上編譯Ethereal的注意事項

日期:2017/2/28 11:14:37   编辑:關於Unix


自從上次'編譯Ethereal On Windows'之後,好久沒有接觸Ethereal了,前期策劃的基於Ethereal開發的一個工具的任務就落到了這批來的一個新員工的頭上了。第一階段他在Windows上開發了一個基於Ethereal的插件用於分析CMPP協議之用;第二個階段我們需要移植到Unix上,我們使用的是Solaris。
目標機器是一個x86的Solaris10的系統,首先是將Ethereal依賴的所有開源包都先裝上。開源的唯一不好的一點就是互相依賴太多,像Ethereal這樣規模的軟件,依賴的包不下十幾種。這裡我們用的源碼包是ethereal-0.99.0。按照常規編譯軟件包的方法:解包=>進入Ethereal目錄=>執行./configure => make。
如果想一次make成功顯然是不太可能的。
我的那個新同事第一次make得到如下結果:
libtool: link: only absolute run-paths are allowed,他查找了好久,終於"投降"了。由於是新同事對Unix上繁蕪復雜的操作不了解也是情有可原的,親自出馬吧。
我對libtool同樣是不熟悉,到網上找答案吧。網上關於這個錯誤的解釋太少了。只能用"only absolute run-paths are allowed"在libtool這個腳本文件裡搜索,果然找到了,有兩個地方有這樣的echo輸出。大致檢查了一下,基本定位問題所在:在libtool執行的語句中,有類似"-R../lib"這樣的參數選項,顯然這個"../lib"不是一個絕對路徑,我們需要針對這個地方進行一下手工修改。
目標就是Makefile文件。打開Makefile搜尋"../lib",一共有4處,分別在SNMP_LIBS、ethereal_LDADD、tethereal_LDADD和dftest_LDADD的定義中,在其中刪除"-R../lib"或者為-R指定一個絕對路徑即可。
問題仍然層出不窮,程序在鏈接tethereal的時候,提示:
ld: fatal: Symbol referencing errors. No output written to .libs/tethereal
Undefined first referenced
symbol in file
gsm_a_pd_str tap-gsm_astat.o
RegistrationRejectReason_vals tap-h225counter.o
register_all_protocol_handoffs tethereal.o
繼續在網上搜索,還好有類似的問題別人也遇到了,解決方法:將epan/dissectors/.libs/libdissectors.a加到Makefile中多個變量的定義中。下面是詳細的修改:
(1)
tethereal_additional_libs = \
=>
tethereal_additional_libs = \
epan/dissectors/.libs/libdissectors.a \
(2)
dftest_additional_libs = \
=>
dftest_additional_libs = \
epan/dissectors/.libs/libdissectors.a
(3)
dumpcap_LDADD = \
$(dumpcap_additional_libs) \
-lgmodule-2.0 -lglib-2.0 \
-lpcap
=>
dumpcap_LDADD = \
$(dumpcap_additional_libs) \
-lgmodule-2.0 -lglib-2.0 \
-lpcap -lsocket -lnsl
(4)
ethereal_additional_libs = \
gtk/libui.a \
=>
ethereal_additional_libs = \
gtk/libui.a \
epan/dissectors/.libs/libdissectors.a \
這回你再make,哇,編譯成功了。
然後敲入make install安裝這個ethereal,在Windows上啟動Xmanager(trial版),連接到目標服務器,用root登錄(如果沒有root權限,是看不到網卡的,也就不能進行協議分析了)。進入/usr/local/bin,在這裡我只發現了tethereal這個程序,執行起來也沒有問題,但是那個圖形界面的ethereal哪裡去了。翻看install的日志,發現根本沒有安裝ethereal。怎麼回事?
繼續網上找答案,很快答案找到了:是否編譯安裝ethereal是configure決定的。在configure的執行日志我看到:
The Ethereal package has been configured with the following options.
Build ethereal : no
Build tethereal : yes
Build capinfos : yes
Build editcap : yes
Build dumpcap : yes
Build mergecap : yes
Build text2pcap : yes
Build idl2eth : yes
Build randpkt : yes
Build dftest : yes
顯然Build ethereal : no。網上的理由是:GTK+版本安裝不當。從configure日志看到:
checking for GTK+ - version >= 2.0.0... no
*** Could not run GTK+ test program, checking why...
*** The test program failed to compile or link. See the file config.log for the
*** exact error that occured. This usually means GTK+ is incorrectly installed.
這時只能重新檢查GTK+,甚至是重新安裝GTK+。
搞定這個後,再重新configure,注意別忘了備份上述對Makefile的修改,否則configure會覆蓋你的成果。之後的工作這裡就不說了。
Copyright © Linux教程網 All Rights Reserved