USNavalResearchLaboratory / mgen

Multi-Generator (MGEN) traffic generation tool
https://www.nrl.navy.mil/itd/ncs/products/mgen
Other
83 stars 26 forks source link

Trouble building using instructions in Read Me #7

Closed senderic closed 4 years ago

senderic commented 4 years ago

I am following the instructions in the read me to build mgen and coming up with the following error:

[root makefiles]# make -f Makefile.linux 
g++ -c -g -DPROTO_DEBUG -DHAVE_GPS -DUNIX -Wall -Wcast-align -fPIC -DLINUX -DHAVE_SCHED -DHAVE_GETLOGIN -DHAVE_LOCKF -DHAVE_DIRFD -DHAVE_ASSERT  -D_FILE_OFFSET_BITS=64 -DUNIX -DUSE_SELECT -DUSE_TIMERFD -DHAVE_PSELECT -DHAVE_IPV6 -DHAVE_PCAP -I/usr/X11R6/include  -I../makefiles -I../include -I../protolib/include -o ../src/common/mgenApp.o ../src/common/mgenApp.cpp
In file included from ../include/mgenEvent.h:5:0,
                 from ../include/mgenFlow.h:4,
                 from ../include/mgen.h:7,
                 from ../src/common/mgenApp.cpp:2:
../include/mgenPattern.h:7:50: fatal error: pcap.h: No such file or directory
 #include <pcap.h>      // for CLONE tcpdump files
                                                  ^
compilation terminated.
make: *** [../src/common/mgenApp.o] Error 1

It seems like an expect pcap.h file is not there. I tried manually searching for it and came up dry, except for ezx-pcap.h in unrelated directories:

[root mgen-master]# find / -name "*pcap.h*"
/usr/src/kernels/3.10.0-1062.18.1.el7.x86_64/include/linux/mfd/ezx-pcap.h
/usr/src/kernels/3.10.0-1062.18.1.el7.x86_64.debug/include/linux/mfd/ezx-pcap.h

Now, I suspect since git is just taking the master branch that the instructions may want us pointing to a release version or some previous version. I tried a variety of them such as 5.02, 5.02c and protolib 3.0b1, etc. No combination worked (though the errors were a bit different each time).

My set up is Centos 7 and I'm experimenting doing this with Docker. That said, I tried the executable in the release .tgz file however that had no effect.

I attached my docker files and the command I use to build: docker build --rm -t local/c7-systemd . -f Dockerfile-centos-systemd docker build -f Dockerfile-centos . -t rmbn-test-centos (Remove the .txt extension from the files, I needed to add to upload)

Dockerfile-centos-systemd.txt Dockerfile-centos.txt

It'd be great if we can review the make process? And maybe, if possible, instead of manually making this, it could be added to the mgen release assets?

weston-nrl commented 4 years ago

The PCAP development library should be available in your standard Linux OS packages. yum install libpcap-devel, apt-get install libpcap-dev, etc. Then re-run the make line and that error should disappear.

senderic commented 4 years ago

Excellent! The make process completes, although when I try to run mgen, bash can't find the command. Also when I search the machine for mgen, nothing comes up..

weston-nrl commented 4 years ago

The executable has been built, but not installed into your system/anywhere in your PATH. The 'mgen' executable is in the 'makefiles' directory where you ran the make command. You have various options: 1) You can run it from that directory as ./mgen, 2) You can run it from anywhere as /path/to/mgen (whatever that path is to the mgen executable in your makefiles directory 3) You can copy or symlink the mgen executable to somewhere that's in your PATH (/usr/local/bin usually works) 4) You can add the MGEN 'makefiles' directory to your PATH (method differs depending on OS, shell, etc.)

senderic commented 4 years ago

Thank you!