1. 程式人生 > >ubuntu下編譯安裝wireshark

ubuntu下編譯安裝wireshark

天在ubuntu下進行安裝wireshark,費了很多時間,過程中出了很多錯誤,但最終安裝成功了,這裡寫下自己的安裝步驟和方法,供大家參考。

安裝編譯工具:

  $sudo apt-get install build-essential

  為了成功編譯Wireshark,您需要安裝GTK+的開發檔案和GLib庫(libraries)。

  $sudo apt-get install libgtk2.0-dev libglib2.0-dev

  安裝Checkinstall以便管理您系統中直接由原始碼編譯安裝的軟體。

  $sudo apt-get install checkinstall

下載後的檔名:wireshark-1.2.2.tar.bz2

cd到檔案目錄解壓:$tar -xvf wireshark-1.2.2.tar.bz2

$cd wireshark-1.2.2

編譯安裝命令如下:

$./configure

$make
$sudo make install

其中make編譯時間會比較長,這樣下來就基本安裝了。

以下是執行./configure命令時遇到的問題。

1.configure: error: I couldn't find yacc (or bison or ...); make sure it's installed and in your path 

    sudo apt-get install flex bison  

yacc(Yet Another Compiler Compiler),是Unix/Linux上一個用來生成編譯器的編譯器(編譯器程式碼生成器)。

2.configure: error: Qt is not available

sudo apt-get install qt5-default

3.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.
configure: error: GTK+ 3 is not available

sudo apt-get install libgtk-3-dev

4. configure: error: Header file pcap.h not found; if you installed libpcap from source, did you also do "make install-incl", and if you installed a binary package of libpcap, is there also a developer's package of libpcap,  
    and did you also install that package?  
問題原因是ubuntu下缺少pcap.h等檔案。
解決方法:
編譯安裝libpcap.
在www.tcpdump.org頁面中可下載原始碼:libpcap-1.0.0.tar.gz
cd到檔案目錄:
    $tar -xvf libpcap-1.0.0.tar.gz  
    $cd libpcap-1.0.0.tar.gz  
    $./configure  
    $make  
    $sudo make install  
5.'aclocal-1.14' is missing on your system. 
You should only need it if you modified 'acinclude.m4' or
         'configure.ac' or m4 files included by 'configure.ac'.
         The 'aclocal' program is part of the GNU Automake package:
         <http://www.gnu.org/software/automake>
         It also requires GNU Autoconf, GNU m4 and Perl in order to run:
         <http://www.gnu.org/software/autoconf>
         <http://www.gnu.org/software/m4/>
         <http://www.perl.org/>
用軟體中心安裝Synaptic Package Manager,然後在安裝autotools-dev  autoconf2.13,這樣就可以make通過了。