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

error: redefinition of 'bpf_program' #415

Closed
ryandesign opened this issue Dec 6, 2013 · 17 comments
Closed

error: redefinition of 'bpf_program' #415

ryandesign opened this issue Dec 6, 2013 · 17 comments

Comments

@ryandesign
Copy link

Hello, I'm a developer with the MacPorts package management system, trying to update ettercap in MacPorts to version 0.8.0 since it has long been neglected by us.

It does not build for me on OS X 10.9 Mavericks. I get:

[ 33%] Building C object src/CMakeFiles/lib_ettercap.dir/ec_send.c.o
cd /opt/local/var/macports/build/_Users_rschmidt_macports_dports_net_ettercap-ng/ettercap/work/build/src && /usr/bin/clang  -Dlib_ettercap_EXPORTS -pipe -Os -isystem/opt/local/include -arch x86_64  -O2 -w -arch x86_64 -fPIC -I/opt/local/include -I/opt/local/var/macports/build/_Users_rschmidt_macports_dports_net_ettercap-ng/ettercap/work/build/include -I/opt/local/var/macports/build/_Users_rschmidt_macports_dports_net_ettercap-ng/ettercap/work/ettercap-0.8.0/include    -o CMakeFiles/lib_ettercap.dir/ec_send.c.o   -c /opt/local/var/macports/build/_Users_rschmidt_macports_dports_net_ettercap-ng/ettercap/work/ettercap-0.8.0/src/ec_send.c
In file included from /opt/local/var/macports/build/_Users_rschmidt_macports_dports_net_ettercap-ng/ettercap/work/ettercap-0.8.0/src/ec_send.c:25:
/usr/include/net/bpf.h:107:8: error: redefinition of 'bpf_program'
struct bpf_program {
       ^
/opt/local/include/pcap/bpf.h:107:8: note: previous definition is here
struct bpf_program {
       ^
In file included from /opt/local/var/macports/build/_Users_rschmidt_macports_dports_net_ettercap-ng/ettercap/work/ettercap-0.8.0/src/ec_send.c:25:
/usr/include/net/bpf.h:1166:8: error: redefinition of 'bpf_insn'
struct bpf_insn {
       ^
/opt/local/include/pcap/bpf.h:1308:8: note: previous definition is here
struct bpf_insn {
       ^
2 errors generated.

/opt/local/include/pcap/bpf.h is from libpcap 1.5.2; I understand libpcap to be a dependency of ettercap.

@LocutusOfBorg
Copy link
Contributor

Can you please try the latest git?

This has been fixed some weeks ago, after 0.8.0 release

@ryandesign
Copy link
Author

Thanks! Yes the latest git does build.

@LocutusOfBorg
Copy link
Contributor

wonderful to hear!

@LocutusOfBorg
Copy link
Contributor

I can give you the patch for making it work!

https://github.com/Ettercap/ettercap/pull/382/files
the first change in include/ec.h should be enough for making it build I think...

Anyway would be nice to have a closer collaboration with you before a release, we don't have now many mac users and testers, and having a feedback prior to release would be wonderful

@ryandesign
Copy link
Author

Thanks. I saw that, but it's a lot of changes. I just put together a smaller diff with which 0.8.0 compiles ok. Of course I'm not familiar with ettercap so I'm not sure how to test if it's working.

@LocutusOfBorg
Copy link
Contributor

#ifdef OS_DARWIN
#define PCAP_DONT_INCLUDE_PCAP_BPF_H 1
#include <net/bpf.h>
#endif"

adding this to include/ec.h can be enough to make it build, right @eaescob ?

Maybe you will face another build failure, not sure

@ryandesign
Copy link
Author

My patches right now are:

--- include/ec.h.orig   2013-09-11 15:18:45.000000000 -0500
+++ include/ec.h    2013-12-03 10:58:14.000000000 -0600
@@ -16,6 +16,11 @@
    #include <windows.h>
 #endif

+#ifdef OS_DARWIN
+   #define PCAP_DONT_INCLUDE_PCAP_BPF_H 1
+   #include <net/bpf.h>
+#endif
+
 #if !defined (__USE_GNU)   /* for memmem(), strsignal(), etc etc... */
    #define __USE_GNU
 #endif
--- src/ec_send.c.orig  2013-09-11 15:18:45.000000000 -0500
+++ src/ec_send.c   2013-12-03 10:58:14.000000000 -0600
@@ -22,7 +22,6 @@
 #include <ec.h>

 #if defined(OS_DARWIN) || defined(OS_BSD)
-   #include <net/bpf.h>
    #include <sys/ioctl.h>
 #endif

And all of 33ac95f.

@LocutusOfBorg
Copy link
Contributor

I like, I was remembering something related to safe free undefined!

thanks!

@LocutusOfBorg
Copy link
Contributor

BTW can you help in this our issue?
#398

@ryandesign
Copy link
Author

Right now my goal is to get ettercap in MacPorts updated to a current working version, since our ettercap maintainer appears to have vanished. I can test it on my menagerie of Macs with various OS versions and file tickets if there are problems and try out patches. But I maintain hundreds of packages for MacPorts, which keeps me busy, so I don't plan to become too terribly involved with ettercap specifically. But thank you very much for being so responsive to my tickets; it's very helpful.

@LocutusOfBorg
Copy link
Contributor

I don't want to ask you anything :)
Just we can ask once every release to try to build it :)

And I don't know if it is trivial or not, but is that difficult to make an xcode project with ettercap inside?

@ryandesign
Copy link
Author

Sure, I can try out the latest code before a release, if you remind me.

I have used Xcode off and on since before it was called Xcode, but I use it so infrequently, and it changes so much between major versions (currently version 5), that I am very unfamiliar with it. I'm more comfortable dealing with command line build systems. Is there some reason why there should be an ettercap Xcode project?

@LocutusOfBorg
Copy link
Contributor

No, I don't know
http://about.travis-ci.org/blog/introducing-mac-ios-rubymotion-testing/

I don't understand anything about macos

@ryandesign
Copy link
Author

Ah, I'm aware of Travis CI, but don't know anything about setting up a project on it.

OS X is pretty easy. :) It's a nice GUI on top of a POSIX-compliant UNIX core based in part on BSD UNIX, with a different kernel (Mach). Other differences from other UNIX systems are that Apple has moved from gcc to clang and from libstdc++ to libc++, so test with those on your systems if you can to get a head start on issues you might see on a Mac.

@LocutusOfBorg
Copy link
Contributor

Ok everything you might need to know about travis is this file
this file tells travis how to build ettercap
https://github.com/Ettercap/ettercap/blob/master/.travis.yml

as you might see is just more or less a command line interface with dependencies installed.

Is it difficult to do the same list of commands on mac?

@ryandesign
Copy link
Author

We should probably move this discussion to #398, right?

@LocutusOfBorg
Copy link
Contributor

would be awesome if you have time!

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

2 participants