Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

libpcap "_pcap_version" #5

Closed
VagelisD opened this issue Apr 21, 2017 · 6 comments
Closed

libpcap "_pcap_version" #5

VagelisD opened this issue Apr 21, 2017 · 6 comments

Comments

@VagelisD
Copy link

VagelisD commented Apr 21, 2017

Hello, i have a problem compiling tcptraceroute, although there is a libpcap on my system, i dont get what is going wrong at the compilation process.

gcc -g -O2 -Wall -o tcptraceroute main.o datalink.o util.o probe.o capture.o -lnet -lpcap Undefined symbols for architecture x86_64: "_pcap_version", referenced from: _main in main.o ld: symbol(s) not found for architecture x86_64 clang: error: linker command failed with exit code 1 (use -v to see invocation) make: *** [tcptraceroute] Error 1

And also with homebrew after successful installation and "sudo tcptraceroute"

dyld: Symbol not found: _pcap_version Referenced from: /usr/local/bin/tcptraceroute Expected in: /usr/lib/libpcap.A.dylib in /usr/local/bin/tcptraceroute Abort trap: 6

Im on macOS Sierra 10.12.4 version

@VagelisD
Copy link
Author

VagelisD commented Apr 21, 2017

Problem solved with ./configure --with-libpcap=/usr/local/Cellar/libpcap/1.8.1/

Even though i symlinked libpcap from homebrew with brew link libpcap it didn't make any difference, it went ahead compiling with libpcap installed from Xcode

I guess tcptraceroute doesn't like the libpcap version from Xcode, is there any way installing tcptraceroute from homebrew and providing libpcap this way? thanks in advance

@ghost
Copy link

ghost commented Apr 23, 2017

Seems tcpreplay folks found a similar problem and solved it if anyone wants to check it out the link is below.
tcpreplay Issue #353

@VagelisD
Copy link
Author

VagelisD commented Apr 29, 2017

@begsthehessian thanks, i also checked the pcap_ver with nm like he did, same version, same problem

nm /usr/lib/libpcap.A.dylib | grep pcap_ver
0000000000025df0 s _pcap_version_string

@sarim
Copy link

sarim commented May 5, 2017

Same problem for me in 10.12.4. For now i just added

 inreplace "capture.h", "extern char pcap_version[]", "char *pcap_version"

in homebrew to make it run.
Seems like pcap_version is not used anywhere other than logging pcap version in debug, so its not really needed for regular usage.

@mct
Copy link
Owner

mct commented May 5, 2017

Thanks for the catch!

Googling around a little, it looks like we shouldn't be using the symbol pcap_version directly, but rather calling the exported function pcap_lib_version() to access the version string.

@sarim
Copy link

sarim commented May 5, 2017

(y)

Also is there any reason to define it in capture.h? maybe just a use a local variable in main.c inside the function where the debug is logged.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants