2010年8月10日 星期二

undefined reference to `pcap_parse'

Re: [Wireshark-users] Compilation problems with CVS libpcap
http://www.mail-archive.com/wireshark-users@wireshark.org/msg04062.html

nm -po /usr/local/lib/libpcap.a | egrep pcap_parse


http://www.mail-archive.com/wireshark-users@wireshark.org/msg04063.html
nm prints:

/usr/local/lib/libpcap.a:gencode.o: U pcap_parse

http://www.mail-archive.com/wireshark-users@wireshark.org/msg04064.html
It means that the symbol is undefined, and there's a reference to it
from the file "grammar.o" in the library.

nm -po /usr/local/lib/libpcap.a | egrep grammar.o

http://www.mail-archive.com/wireshark-users@wireshark.org/msg04054.html
/usr/local/lib/libpcap.a:grammar.o: U pcap_strcasecmp
/usr/local/lib/libpcap.a:grammar.o:000000a0 T yyparse
/usr/local/lib/libpcap.a:grammar.o:00000004 C yynerrs
/usr/local/lib/libpcap.a:grammar.o:00000004 C yychar

http://www.mail-archive.com/wireshark-users@wireshark.org/msg04065.html
> /usr/local/lib/libpcap.a:grammar.o:000000a0 T yyparse

Well, *that's* annoying. That's supposed to be pcap_parse.

egrep YACC Makefile
which yacc
which bison
which lex
which flex

http://www.mail-archive.com/wireshark-users@wireshark.org/msg04053.html
egrep YACC Makefile:

YACC = bison -y -p pcap_
$(YACC) -d $<

which yacc:
/usr/bin/yacc

which bison:
/usr/bin/bison

which lex:
/usr/bin/lex

which flex:
/usr/bin/flex

http://www.mail-archive.com/wireshark-users@wireshark.org/msg04035.html
> YACC = bison -y -p pcap_

Well, that's what it's supposed to be, and that's supposed to cause the
generated grammar.c to define its functions with names beginning with
pcap_, not yy.

What happens if you go to the source directory for libpcap, do "make
clean", do "make", and then do "nm -po libpcap.a | egrep parse"?

Then it got fixed....

沒有留言: