「protoident」をコンパイルして実行する方法

「protoident」をコンパイルして実行する方法

私はオープンソースのDPIツールをコンパイルして実行しようとしています。プロトイデント.ダウンロードしましたGithubからのソースコードディレクトリ内でコンパイル/ビルド マニュアルを検索しましたが、何も見つかりませんでした。最終的に、そのディレクトリ内でmakeコマンドとMakefileコマンドを実行して開始しましたが、次のエラーが発生しました。

me@me-MS-7693:~/Desktop/protoident-master/src$ ./Makefile 
./Makefile: line 9: TARGET: command not found
./Makefile: line 10: PROTOCOLS: command not found
./Makefile: line 11: PROTOCOLS: command not found
./Makefile: line 11: SOURCES: command not found
./Makefile: line 12: SOURCES:.c=.h: command not found
./Makefile: line 12: HEADERS: command not found
./Makefile: line 13: SOURCES:.c=.o: command not found
./Makefile: line 13: OBJECTS: command not found
./Makefile: line 14: OTHER_FILES: command not found
./Makefile: line 18: CC: command not found
./Makefile: line 19: CFLAGS: command not found
./Makefile: line 21: OFLAG: command not found
./Makefile: line 22: CFLAG: command not found
./Makefile: line 24: CC: command not found
./Makefile: line 24: LINK: command not found
./Makefile: line 25: LINKFLAGS: command not found
./Makefile: line 26: LIBS: command not found
./Makefile: line 31: .SUFFIXES:: command not found
./Makefile: line 32: .c.o:: command not found
./Makefile: line 33: CC: command not found
./Makefile: line 33: CFLAGS: command not found
./Makefile: line 33: CFLAG: command not found
./Makefile: line 33: OFLAG: command not found
./Makefile: line 33: $<: command not found
./Makefile: line 38: SOURCES: command not found
./Makefile: line 38: TARGET: command not found
./Makefile: line 38: all:: command not found
./Makefile: line 40: profile:: command not found
./Makefile: line 41: profile_compile:: command not found
./Makefile: line 42: profile_compile:: command not found
./Makefile: line 43: profile_compile:: command not found
./Makefile: line 46: TARGET: command not found
./Makefile: line 46: OBJECTS: command not found
./Makefile: line 47: LINK: command not found
./Makefile: line 47: LINKFLAGS: command not found
./Makefile: line 47: LIBS: command not found
./Makefile: line 47: OFLAG: command not found
./Makefile: line 47: TARGET: command not found
./Makefile: line 47: OBJECTS: command not found
./Makefile: line 52: archive:: command not found
./Makefile: line 53: TARGET: command not found
./Makefile: line 53: SOURCES: command not found
./Makefile: line 53: HEADERS: command not found
./Makefile: line 53: OTHER_FILES: command not found
tar: Cowardly refusing to create an empty archive
Try 'tar --help' or 'tar --usage' for more information.
./Makefile: line 55: clean:: command not found
./Makefile: line 56: OBJECTS: command not found
./Makefile: line 58: distclean:: command not found
./Makefile: line 59: TARGET: command not found


me@me-MS-7693:~/Desktop/protoident-master/src$ make
gcc  -lpcap -o protoident main.o hashtable.o ip_reassembling.o flow.o global_func.o dns.o http.o sip.o smtp.o
main.o: In function `main':
/home/ghasemi/Desktop/protoident-master/src/main.c:85: undefined reference to `pcap_open_offline'
/home/ghasemi/Desktop/protoident-master/src/main.c:97: undefined reference to `pcap_compile'
/home/ghasemi/Desktop/protoident-master/src/main.c:100: undefined reference to `pcap_geterr'
/home/ghasemi/Desktop/protoident-master/src/main.c:103: undefined reference to `pcap_setfilter'
/home/ghasemi/Desktop/protoident-master/src/main.c:105: undefined reference to `pcap_geterr'
/home/ghasemi/Desktop/protoident-master/src/main.c:118: undefined reference to `pcap_datalink'
/home/ghasemi/Desktop/protoident-master/src/main.c:125: undefined reference to `pcap_loop'
/home/ghasemi/Desktop/protoident-master/src/main.c:134: undefined reference to `pcap_freecode'
/home/ghasemi/Desktop/protoident-master/src/main.c:136: undefined reference to `pcap_close'
collect2: error: ld returned 1 exit status
Makefile:47: recipe for target 'protoident' failed
make: *** [protoident] Error 1

なぜこれらのエラーが発生したのでしょうか? また、このツールをコンパイルして使用するにはどうすればよいでしょうか?

答え1

Makefileは の設定ファイルでありmake、別のコマンドではありません。ビルドとインストールの手順は:

./configure
make
make install   # usually: sudo make install

READMEほとんどのプロジェクトでは、インストール プロセスがテキスト ファイルなどで詳細に説明されていますINSTALL

ただし、これにはスクリプトがなくconfigure、代わりに ready がありますMakefile。セクションが含まれていないINSTALLため、3 番目のコマンドも適用されません。

したがって、以下を実行するだけです:

make

READMEそれはディレクトリ内のファイルに文書化されていますsrc。面白いのは、それがチェコ語で書かれていることです (ちなみにチェコ語は私の母国語です)。

undefined referenceエラーの修正

提供されたMakefileには問題があり、次のパッチ(スタックオーバーフローコメント):

diff --git a/src/Makefile b/src/Makefile
index 367dcc4..dda5fb3 100644
--- a/src/Makefile
+++ b/src/Makefile
@@ -44,7 +44,7 @@ profile_compile: all


 $(TARGET): $(OBJECTS)
-       $(LINK) $(LINKFLAGS) $(LIBS) $(OFLAG) $(TARGET) $(OBJECTS)
+       $(LINK) $(LINKFLAGS) $(OFLAG) $(TARGET) $(OBJECTS) $(LIBS)

 #####################################
 #other rules

答え2

手順についてはリンクを見てみました。見つかりましたが、チェコ語で書かれています。例えば:

Zdrojová a cílová síťová adresa, zdrojový a cílový port není třeba dále
vysvětlovat.

英語に翻訳すると次のようになります:

Source and destination network address, source and destination port does not need to be further explain.

さまざまなソース ファイルを見ると、説明に「テストされていません」と記載されています。

この作者はこのプロジェクトを実験と呼んでいますが、2年間更新されていません。

プロジェクトが壊れている可能性があり、コンパイラと make 関数に問題はない可能性があります。システムが動作していることを確認するには、200 人の貢献者と 243 のリリースがある gnome デスクトップ用のシンプルな計算機を github からダウンロードしてください。gnome計算機2 年間活動がなく、著者によって実験と呼ばれている現在の選択肢の代わりにこれをコンパイルします。

関連情報