![Como compilar e executar o "protoident"](https://rvso.com/image/885969/Como%20compilar%20e%20executar%20o%20%22protoident%22.png)
Estou tentando compilar e executar uma ferramenta DPI de código aberto chamadaProtidento. Então eu baixeiseu código-fonte do Githube procurei nos diretórios por manuais de compilação/construção, mas não encontrei nada. Finalmente comecei executando make
comando e Makefile
comando dentro de seu diretório, mas enfrentei os seguintes erros:
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
Por que enfrentei esses erros e como posso compilar e usar esta ferramenta?
Responder1
Makefile
é um arquivo de configuração para make
, não um comando separado. O canônicoprocedimento de construção e instalaçãoé:
./configure
make
make install # usually: sudo make install
A maioria dos projetos descreve detalhadamente seu processo de instalação em arquivos de texto README
ou INSTALL
similares.
Porém, este não possui nenhum configure
script e já possui um pronto Makefile
. Não contém INSTALL
seção, portanto o terceiro comando também não é aplicável.
Então você só precisa executar:
make
Está documentado no README
arquivo no src
diretório. O engraçado é que está escrito em tcheco (que, aliás, é minha língua nativa).
Corrigindo undefined reference
erros
Há um problema no Makefile fornecido que pode ser corrigido usando o seguinte patch (baseado em umComentário de estouro de pilha):
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
Responder2
Dei uma olhada no seu link para obter instruções. Eles podem ser encontrados, mas estão escritos em tcheco. Por exemplo:
Zdrojová a cílová síťová adresa, zdrojový a cílový port není třeba dále
vysvětlovat.
Traduz-se para o inglês como:
Source and destination network address, source and destination port does not need to be further explain.
Olhando para vários arquivos de origem, você verá "Não testado" na descrição.
Este autor chama o projeto de experimento e não é atualizado há 2 anos.
Proponho que o projeto esteja quebrado e pode não haver nada de errado com seu compilador e funções make. Para confirmar se seu sistema está funcionando, baixe uma calculadora simples do github para desktop gnome que tem 200 colaboradores e 243 lançamentos:calculadora gnome. Compile isso em vez de sua escolha atual, que não tem atividade há dois anos e é chamada de experimento pelo autor.