epcap with PF_RING does not start #14

Closed
josemic opened this Issue Dec 3, 2013 · 40 comments

Projects

None yet

3 participants

@josemic
josemic commented Dec 3, 2013

I try to get PF_RING working yet.

It fails when started with the configuration:

[{interface,"eth1"},{cluster_id,1},{filter,"tcp"}

with error message:

sudo: sorry, you are not allowed to set the following environment variables: PCAP_PF_RING_CLUSTER_ID

Any ideas?

Here I found information on PF_RING:
safemedia.com/builds/UsersGuide.pdf‎
https://redmine.openinfosecfoundation.org/projects/suricata/wiki/Suricatayaml

  • chapter: Flow and Stream handling
  • chapter: Packet Acquisition

@ates
Collaborator
ates commented Dec 3, 2013

Change "Defaults env_reset" to “Defaults !env_reset” in /etc/sudoers

@josemic
josemic commented Dec 3, 2013

Ok. That works.

Now I have opened 2 PF_RING connections one with cluster_id 1 and one with cluster_id 2.
When I now start one TCP flow (=TCP connection), then instead of providing the data out on the first or the second cluster_id, both epcap clients on eth1 receive the same identical mirrored data.

I have set the environment variable PF_RING to point to the PF_RING directory before compiling epcap:

export PF_RING="/usr/src/PF_RING_CURRENT_SVN make"

While using different cluster_ids, both epcap receiver receive the identical data. What's wrong?

@ates
Collaborator
ates commented Dec 3, 2013
  1. PFRING instead of PF_RING variable name should be used
  2. PFRING variable should be pointed out to the directory with compiled libpfring.so and libpcap.so not to PF_RING sources
@ates
Collaborator
ates commented Dec 4, 2013

If you experienced some problems with PF_RING and epcap, feel free to contact me via jabber (ates@ipv6.dp.ua)

@josemic
josemic commented Dec 4, 2013

No. Does not work. Still getting twice the identical traffic. I have no Jabber account yet.

  1. Is there anything I can see from that epcap has been successfully be compiled with PF_RING. Any special make output?
  2. I also did:
insmod /usr/src/PF_RING_CURRENT_SVN/kernel/pf_ring.ko enable_tx_capture=1 enable_ip_defrag=0
modprobe e1000e
@ates
Collaborator
ates commented Dec 4, 2013

Show the output from command: ldd priv/epcap

@josemic
josemic commented Dec 5, 2013
ldd priv/epcap
    linux-vdso.so.1 (0x00007fff69ffe000)
    libpcap.so.0.8 => /usr/lib/x86_64-linux-gnu/libpcap.so.0.8 (0x00007f3edb8dc000)
    libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007f3edb530000)
    /lib64/ld-linux-x86-64.so.2 (0x00007f3edbb37000)
@ates
Collaborator
ates commented Dec 5, 2013

As you can see epcap is compiled with system libpcap, but should be
compiled with modified libpcap and as a static.

Where is libpfring.a and libpcap.a are installed on your system ?

05.12.2013 21:07, josemic пишет:

|ldd priv/epcap
linux-vdso.so.1 (0x00007fff69ffe000)
libpcap.so.0.8 => /usr/lib/x86_64-linux-gnu/libpcap.so.0.8 (0x00007f3edb8dc000)
libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007f3edb530000)
/lib64/ld-linux-x86-64.so.2 (0x00007f3edbb37000)
|


Reply to this email directly or view it on GitHub
#14 (comment).

@ates
Collaborator
ates commented Dec 5, 2013

Here is how that works on my system:

$ git clone https://github.com/msantos/epcap.git
Cloning into 'epcap'...
remote: Counting objects: 702, done.
remote: Compressing objects: 100% (362/362), done.
remote: Total 702 (delta 354), reused 645 (delta 306)
Receiving objects: 100% (702/702), 196.07 KiB | 234 KiB/s, done.
Resolving deltas: 100% (354/354), done.

$ cd epcap/
$ ls /usr/local/lib
libpcap.a  libpcap.so  libpcap.so.1  libpcap.so.1.1.1  libpfring.a  libpfring.so

$ PFRING=/usr/local/lib make
==> epcap (check-deps)
Dependency not available: pkt-.* ({git,"https://github.com/msantos/pkt.git",
                                      "master"})
ERROR: 'check-deps' failed while processing /home/ates/work/epcap: rebar_abort
==> epcap (get-deps)
Pulling pkt from {git,"https://github.com/msantos/pkt.git","master"}
Cloning into 'pkt'...
==> pkt (get-deps)
==> pkt (compile)
Compiled src/pkt.erl
Compiled src/pkt_ipproto.erl
Compiled src/pkt_tcp.erl
Compiled src/pkt_ipv6_hopopts.erl
Compiled src/pkt_ether.erl
Compiled src/pkt_llc.erl
Compiled src/pkt_dlt.erl
Compiled src/pkt_ipv6_fragment.erl
Compiled src/pkt_sctp.erl
Compiled src/pkt_ipv6_esp.erl
Compiled src/pkt_ipv6_dstopts.erl
Compiled src/pkt_icmp.erl
Compiled src/pkt_linux_cooked.erl
Compiled src/pkt_igmp.erl
Compiled src/pkt_null.erl
Compiled src/pkt_arp.erl
Compiled src/pkt_gre.erl
Compiled src/pkt_ipv6_ah.erl
Compiled src/pkt_udp.erl
Compiled src/pkt_ipv6.erl
Compiled src/pkt_vrrp.erl
Compiled src/pkt_icmp6.erl
Compiled src/pkt_ipv4.erl
Compiled src/pkt_ipv6_routing.erl
==> epcap (compile)
Compiled src/epcap.erl
Compiling c_src/epcap.c
Compiling c_src/epcap_priv.c
c_src/epcap_priv.o: In function `epcap_priv_drop':
/home/ates/work/epcap/c_src/epcap_priv.c:64: warning: Using 'getgrnam' in statically linked applications requires at runtime the shared libraries from the glibc version used for linking
/home/ates/work/epcap/c_src/epcap_priv.c:59: warning: Using 'getpwnam' in statically linked applications requires at runtime the shared libraries from the glibc version used for linking
/usr/local/lib/libpcap.a(nametoaddr.o): In function `pcap_nametoaddrinfo':
nametoaddr.c:(.text+0x74): warning: Using 'getaddrinfo' in statically linked applications requires at runtime the shared libraries from the glibc version used for linking
/usr/local/lib/libpcap.a(nametoaddr.o): In function `pcap_nametoaddr':
nametoaddr.c:(.text+0x5): warning: Using 'gethostbyname' in statically linked applications requires at runtime the shared libraries from the glibc version used for linking
/usr/local/lib/libpcap.a(nametoaddr.o): In function `pcap_nametonetaddr':
nametoaddr.c:(.text+0xa5): warning: Using 'getnetbyname' in statically linked applications requires at runtime the shared libraries from the glibc version used for linking
/usr/local/lib/libpcap.a(nametoaddr.o): In function `pcap_nametoproto':
nametoaddr.c:(.text+0x2c5): warning: Using 'getprotobyname' in statically linked applications requires at runtime the shared libraries from the glibc version used for linking
/usr/local/lib/libpcap.a(nametoaddr.o): In function `pcap_nametoport':
nametoaddr.c:(.text+0xf9): warning: Using 'getservbyname' in statically linked applications requires at runtime the shared libraries from the glibc version used for linking

$ ldd priv/epcap
    not a dynamic executable
$ strings priv/epcap |grep pfring
pfring_set_channel_id() failed: %d
Wrong RING version: kernel is %i, libpfring was compiled with %i
ring failure (pfring_get_slot_header_len)
pfring_get_mapped_dna_device() failed [rc=%d]
pfring_map_dna_device
[ERROR] with libpfring.a. Please update the DNA library.
.vpfring
[vPFRing] Wrong RING version: kernel is %i, libpfring was compiled with %i
@josemic
josemic commented Dec 6, 2013

On my system it looks like this:

$ git clone https://github.com/msantos/epcap.git
Cloning into 'epcap'...
remote: Counting objects: 702, done.
remote: Compressing objects: 100% (362/362), done.
remote: Total 702 (delta 354), reused 645 (delta 306)
Receiving objects: 100% (702/702), 196.07 KiB | 0 bytes/s, done.
Resolving deltas: 100% (354/354), done.
Checking connectivity... done
$ cd epcap/
$ ls /usr/local/lib
BugpointPasses.so             libLLVMNVPTXDesc.a
libLLVMAArch64AsmParser.a     libLLVMNVPTXInfo.a
libLLVMAArch64AsmPrinter.a    libLLVMObjCARCOpts.a
libLLVMAArch64CodeGen.a       libLLVMObject.a
libLLVMAArch64Desc.a          libLLVMOption.a
libLLVMAArch64Disassembler.a  libLLVMPowerPCAsmParser.a
libLLVMAArch64Info.a          libLLVMPowerPCAsmPrinter.a
libLLVMAArch64Utils.a         libLLVMPowerPCCodeGen.a
libLLVMAnalysis.a             libLLVMPowerPCDesc.a
libLLVMARMAsmParser.a         libLLVMPowerPCInfo.a
libLLVMARMAsmPrinter.a        libLLVMR600AsmPrinter.a
libLLVMARMCodeGen.a           libLLVMR600CodeGen.a
libLLVMARMDesc.a              libLLVMR600Desc.a
libLLVMARMDisassembler.a      libLLVMR600Info.a
libLLVMARMInfo.a              libLLVMRuntimeDyld.a
libLLVMAsmParser.a            libLLVMScalarOpts.a
libLLVMAsmPrinter.a           libLLVMSelectionDAG.a
libLLVMBitReader.a            libLLVMSparcCodeGen.a
libLLVMBitWriter.a            libLLVMSparcDesc.a
libLLVMCodeGen.a              libLLVMSparcInfo.a
libLLVMCore.a                 libLLVMSupport.a
libLLVMCppBackendCodeGen.a    libLLVMSystemZAsmParser.a
libLLVMCppBackendInfo.a       libLLVMSystemZAsmPrinter.a
libLLVMDebugInfo.a            libLLVMSystemZCodeGen.a
libLLVMExecutionEngine.a      libLLVMSystemZDesc.a
libLLVMHexagonAsmPrinter.a    libLLVMSystemZDisassembler.a
libLLVMHexagonCodeGen.a       libLLVMSystemZInfo.a
libLLVMHexagonDesc.a          libLLVMTableGen.a
libLLVMHexagonInfo.a          libLLVMTarget.a
libLLVMInstCombine.a          libLLVMTransformUtils.a
libLLVMInstrumentation.a      libLLVMVectorize.a
libLLVMInterpreter.a          libLLVMX86AsmParser.a
libLLVMipa.a                  libLLVMX86AsmPrinter.a
libLLVMipo.a                  libLLVMX86CodeGen.a
libLLVMIRReader.a             libLLVMX86Desc.a
libLLVMJIT.a                  libLLVMX86Disassembler.a
libLLVMLinker.a               libLLVMX86Info.a
libLLVMMC.a                   libLLVMX86Utils.a
libLLVMMCDisassembler.a       libLLVMXCoreAsmPrinter.a
libLLVMMCJIT.a                libLLVMXCoreCodeGen.a
libLLVMMCParser.a             libLLVMXCoreDesc.a
libLLVMMipsAsmParser.a        libLLVMXCoreDisassembler.a
libLLVMMipsAsmPrinter.a       libLLVMXCoreInfo.a
libLLVMMipsCodeGen.a          libLTO.a
libLLVMMipsDesc.a             libLTO.so
libLLVMMipsDisassembler.a     libpfring.a
libLLVMMipsInfo.a             libpfring.so
libLLVMMSP430AsmPrinter.a     libprofile_rt.a
libLLVMMSP430CodeGen.a        libprofile_rt.so
libLLVMMSP430Desc.a           LLVMHello.so
libLLVMMSP430Info.a           python2.7
libLLVMNVPTXAsmPrinter.a      python3.3
libLLVMNVPTXCodeGen.a         site_ruby
$ PFRING=/usr/local/lib make
==> epcap (check-deps)
Dependency not available: pkt-.* ({git,"https://github.com/msantos/pkt.git",
                                      "master"})
==> epcap (get-deps)
Pulling pkt from {git,"https://github.com/msantos/pkt.git","master"}
Cloning into 'pkt'...
==> Entering directory `/home/michael/Programming/Erlang/msantos/epcap/deps/pkt'
==> pkt (get-deps)
==> Leaving directory `/home/michael/Programming/Erlang/msantos/epcap/deps/pkt'
==> Entering directory `/home/michael/Programming/Erlang/msantos/epcap/deps/pkt'
==> pkt (compile)
Compiled src/pkt_vrrp.erl
Compiled src/pkt_ipv6_dstopts.erl
Compiled src/pkt.erl
Compiled src/pkt_ipv6_fragment.erl
Compiled src/pkt_ipv6_hopopts.erl
Compiled src/pkt_tcp.erl
Compiled src/pkt_icmp.erl
Compiled src/pkt_gre.erl
Compiled src/pkt_ipv6_ah.erl
Compiled src/pkt_dlt.erl
Compiled src/pkt_ipv6_routing.erl
Compiled src/pkt_ether.erl
Compiled src/pkt_icmp6.erl
Compiled src/pkt_sctp.erl
Compiled src/pkt_linux_cooked.erl
Compiled src/pkt_ipv4.erl
Compiled src/pkt_llc.erl
Compiled src/pkt_ipv6_esp.erl
Compiled src/pkt_null.erl
Compiled src/pkt_udp.erl
Compiled src/pkt_ipproto.erl
Compiled src/pkt_igmp.erl
Compiled src/pkt_arp.erl
Compiled src/pkt_ipv6.erl
==> Leaving directory `/home/michael/Programming/Erlang/msantos/epcap/deps/pkt'
==> epcap (compile)
Compiled src/epcap.erl
Compiling c_src/epcap.c
Compiling c_src/epcap_priv.c
c_src/epcap_priv.o: In function `epcap_priv_drop':
/home/michael/Programming/Erlang/msantos/epcap/c_src/epcap_priv.c:64: warning: Using 'getgrnam' in statically linked applications requires at runtime the shared libraries from the glibc version used for linking
/home/michael/Programming/Erlang/msantos/epcap/c_src/epcap_priv.c:59: warning: Using 'getpwnam' in statically linked applications requires at runtime the shared libraries from the glibc version used for linking
/usr/lib/gcc/x86_64-linux-gnu/4.8/../../../x86_64-linux-gnu/libpcap.a(nametoaddr.o): In function `pcap_nametoaddrinfo':
(.text+0x74): warning: Using 'getaddrinfo' in statically linked applications requires at runtime the shared libraries from the glibc version used for linking
/usr/lib/gcc/x86_64-linux-gnu/4.8/../../../x86_64-linux-gnu/libpcap.a(nametoaddr.o): In function `pcap_nametoaddr':
(.text+0x5): warning: Using 'gethostbyname' in statically linked applications requires at runtime the shared libraries from the glibc version used for linking
/usr/lib/gcc/x86_64-linux-gnu/4.8/../../../x86_64-linux-gnu/libpcap.a(nametoaddr.o): In function `pcap_nametonetaddr':
(.text+0xa5): warning: Using 'getnetbyname' in statically linked applications requires at runtime the shared libraries from the glibc version used for linking
/usr/lib/gcc/x86_64-linux-gnu/4.8/../../../x86_64-linux-gnu/libpcap.a(nametoaddr.o): In function `pcap_nametoproto':
(.text+0x2c5): warning: Using 'getprotobyname' in statically linked applications requires at runtime the shared libraries from the glibc version used for linking
/usr/lib/gcc/x86_64-linux-gnu/4.8/../../../x86_64-linux-gnu/libpcap.a(nametoaddr.o): In function `pcap_nametoport':
(.text+0xe9): warning: Using 'getservbyname' in statically linked applications requires at runtime the shared libraries from the glibc version used for linking
$ ldd priv/epcap
    not a dynamic executable
$ strings priv/epcap |grep pfring
$ 

Location of "libpfring.a":
/usr/src/PF_RING_CURRENT_SVN/userland/lib/libpfring.a
/usr/local/lib/libpfring.a

Location of "libpcap.a":
/usr/src/PF_RING_CURRENT_SVN/userland/libpcap-1.1.1-ring/libpcap.a
/usr/lib/x86_64-linux-gnu/libpcap.a

Please note that I am usually not using epcap directly, but as rebar dependency of josemic/eNose (defrag branch):
$ git clone https://github.com/josemic/eNose.git
$ git checkout -b defrag origin/defrag
$ cd eNose
$ make all

@ates
Collaborator
ates commented Dec 6, 2013

Strange, I've tried compile eNose and it's successful compile with pfring support:

$ git clone https://github.com/josemic/eNose.git
$  cd eNose
$  git checkout -b defrag origin/defrag
Branch defrag set up to track remote branch defrag from origin.
Switched to a new branch 'defrag'
$ PFRING=/usr/local/lib make all
....
$ strings deps/epcap/priv/epcap | grep pfring
pfring_set_channel_id() failed: %d
Wrong RING version: kernel is %i, libpfring was compiled with %i
ring failure (pfring_get_slot_header_len)
pfring_get_mapped_dna_device() failed [rc=%d]
pfring_map_dna_device
[ERROR] with libpfring.a. Please update the DNA library.
.vpfring
[vPFRing] Wrong RING version: kernel is %i, libpfring was compiled with %i
@msantos
Owner
msantos commented Dec 6, 2013

Sometimes it helps to check how rebar is calling the compiler:

rebar clean
rebar -vvv compile

Check the EXE_* environment variables to see if they are set to what you expect.

Then run the EXE_CC_TEMPLATE command by hand and check if epcap is being linked properly against the pfring libpcap.

@josemic
josemic commented Dec 6, 2013

The environment variables are not set:

$ echo $EXE_CFLAGS

$ echo $ERL_LDFLAGS

$ echo $EXE_CC_TEMPLATE 

I have changed the epcap makefile to use rebar -vvv compile

Here the output:

$ PFRING=/usr/local/lib make all
...
Compiling c_src/epcap.c
INFO:  sh info:
    cwd: "/home/michael/Programming/Erlang/josemic/eNose/deps/epcap"
    cmd: cc -c  -g -Wall -fPIC  -I/usr/lib/erlang/lib/erl_interface-3.7.14/include -I/usr/lib/erlang/erts-5.10.3/include   -DEPCAP_RLIMIT_NOFILES=1 c_src/epcap.c -o c_src/epcap.o
DEBUG:  opts: [{env,[{"BINDIR","/usr/lib/erlang/erts-5.10.3/bin"},
                     {"CC","cc"},
                     {"COLORTERM","gnome-terminal"},
                     {"CXX","c++"},
                     {"DBUS_SESSION_BUS_ADDRESS",
                      "unix:abstract=/tmp/dbus-kreXwAyrov,guid=7ca2adf5fa66f4be809afb5952a209e6"},
                     {"DESKTOP_SESSION","default"},
                     {"DISPLAY",":0"},
                     {"DRV_CC_TEMPLATE",
                      "cc -c $CFLAGS -g -Wall -fPIC  -I/usr/lib/erlang/lib/erl_interface-3.7.14/include -I/usr/lib/erlang/erts-5.10.3/include   $PORT_IN_FILES -o $PORT_OUT_FILE"},
                     {"DRV_CFLAGS",
                      "-g -Wall -fPIC  -I/usr/lib/erlang/lib/erl_interface-3.7.14/include -I/usr/lib/erlang/erts-5.10.3/include  "},
                     {"DRV_CXX_TEMPLATE",
                      "c++ -c $CXXFLAGS -g -Wall -fPIC  -I/usr/lib/erlang/lib/erl_interface-3.7.14/include -I/usr/lib/erlang/erts-5.10.3/include   $PORT_IN_FILES -o $PORT_OUT_FILE"},
                     {"DRV_LDFLAGS",
                      "-shared  -L/usr/lib/erlang/lib/erl_interface-3.7.14/lib -lerl_interface -lei"},
                     {"DRV_LINK_TEMPLATE",
                      "cc $PORT_IN_FILES $LDFLAGS -shared  -L/usr/lib/erlang/lib/erl_interface-3.7.14/lib -lerl_interface -lei -o $PORT_OUT_FILE"},
                     {"EMU","beam"},
                     {"ERLANG_ARCH","64"},
                     {"ERLANG_TARGET","R16B02-x86_64-pc-linux-gnu-64"},
                     {"ERL_CFLAGS",
                      " -I/usr/lib/erlang/lib/erl_interface-3.7.14/include -I/usr/lib/erlang/erts-5.10.3/include  "},
                     {"ERL_EI_LIBDIR",
                      "/usr/lib/erlang/lib/erl_interface-3.7.14/lib"},
                     {"ERL_LDFLAGS",
                      " -L/usr/lib/erlang/lib/erl_interface-3.7.14/lib -lerl_interface -lei"},
                     {"EXE_CC_TEMPLATE",
                      "cc -c $CFLAGS -g -Wall -fPIC  -I/usr/lib/erlang/lib/erl_interface-3.7.14/include -I/usr/lib/erlang/erts-5.10.3/include   -DEPCAP_RLIMIT_NOFILES=1 $PORT_IN_FILES -o $PORT_OUT_FILE"},
                     {"EXE_CFLAGS",
                      "-g -Wall -fPIC  -I/usr/lib/erlang/lib/erl_interface-3.7.14/include -I/usr/lib/erlang/erts-5.10.3/include   -DEPCAP_RLIMIT_NOFILES=1"},
                     {"EXE_CXX_TEMPLATE",
                      "c++ -c $CXXFLAGS -g -Wall -fPIC  -I/usr/lib/erlang/lib/erl_interface-3.7.14/include -I/usr/lib/erlang/erts-5.10.3/include   -DEPCAP_RLIMIT_NOFILES=1 $PORT_IN_FILES -o $PORT_OUT_FILE"},
                     {"EXE_LDFLAGS",
                      "-lpcap  -L/usr/lib/erlang/lib/erl_interface-3.7.14/lib -lerl_interface -lei -static -L /usr/local/lib -lpfring -lpthread"},
                     {"EXE_LINK_TEMPLATE",
                      "cc $PORT_IN_FILES $LDFLAGS -lpcap  -L/usr/lib/erlang/lib/erl_interface-3.7.14/lib -lerl_interface -lei -static -L /usr/local/lib -lpfring -lpthread -o $PORT_OUT_FILE"},
                     {"GDMSESSION","default"},
                     {"GDM_LANG","en_US.utf8"},
                     {"GJS_DEBUG_OUTPUT","stderr"},
                     {"GJS_DEBUG_TOPICS","JS ERROR;JS LOG"},
                     {"GNOME_DESKTOP_SESSION_ID","this-is-deprecated"},
                     {"GNOME_KEYRING_CONTROL","/run/user/1000/keyring-rMyWh9"},
                     {"GNOME_KEYRING_PID","3347"},
                     {"GPG_AGENT_INFO",
                      "/run/user/1000/keyring-rMyWh9/gpg:0:1"},
                     {"HOME","/home/michael"},
                     {"LANG","en_US.utf8"},
                     {"LOGNAME","michael"},
                     {"LS_COLORS",
                      "rs=0:di=01;34:ln=01;36:mh=00:pi=40;33:so=01;35:do=01;35:bd=40;33;01:cd=40;33;01:or=40;31;01:su=37;41:sg=30;43:ca=30;41:tw=30;42:ow=34;42:st=37;44:ex=01;32:*.tar=01;31:*.tgz=01;31:*.arj=01;31:*.taz=01;31:*.lzh=01;31:*.lzma=01;31:*.tlz=01;31:*.txz=01;31:*.zip=01;31:*.z=01;31:*.Z=01;31:*.dz=01;31:*.gz=01;31:*.lz=01;31:*.xz=01;31:*.bz2=01;31:*.bz=01;31:*.tbz=01;31:*.tbz2=01;31:*.tz=01;31:*.deb=01;31:*.rpm=01;31:*.jar=01;31:*.war=01;31:*.ear=01;31:*.sar=01;31:*.rar=01;31:*.ace=01;31:*.zoo=01;31:*.cpio=01;31:*.7z=01;31:*.rz=01;31:*.jpg=01;35:*.jpeg=01;35:*.gif=01;35:*.bmp=01;35:*.pbm=01;35:*.pgm=01;35:*.ppm=01;35:*.tga=01;35:*.xbm=01;35:*.xpm=01;35:*.tif=01;35:*.tiff=01;35:*.png=01;35:*.svg=01;35:*.svgz=01;35:*.mng=01;35:*.pcx=01;35:*.mov=01;35:*.mpg=01;35:*.mpeg=01;35:*.m2v=01;35:*.mkv=01;35:*.webm=01;35:*.ogm=01;35:*.mp4=01;35:*.m4v=01;35:*.mp4v=01;35:*.vob=01;35:*.qt=01;35:*.nuv=01;35:*.wmv=01;35:*.asf=01;35:*.rm=01;35:*.rmvb=01;35:*.flc=01;35:*.avi=01;35:*.fli=01;35:*.flv=01;35:*.gl=01;35:*.dl=01;35:*.xcf=01;35:*.xwd=01;35:*.yuv=01;35:*.cgm=01;35:*.emf=01;35:*.axv=01;35:*.anx=01;35:*.ogv=01;35:*.ogx=01;35:*.aac=00;36:*.au=00;36:*.flac=00;36:*.mid=00;36:*.midi=00;36:*.mka=00;36:*.mp3=00;36:*.mpc=00;36:*.ogg=00;36:*.ra=00;36:*.wav=00;36:*.axa=00;36:*.oga=00;36:*.spx=00;36:*.xspf=00;36:"},
                     {"MAKEFLAGS",[]},
                     {"MAKELEVEL","1"},
                     {"MFLAGS",[]},
                     {"OLDPWD",
                      "/home/michael/Programming/Erlang/josemic/eNose/deps"},
                     {"PATH",
                      "/usr/lib/erlang/erts-5.10.3/bin:/usr/lib/erlang/bin:/usr/local/bin:/usr/bin:/bin:/usr/local/games:/usr/games"},
                     {"PFRING","/usr/local/lib"},
                     {"PROGNAME","erl"},
                     {"PWD","/home/michael/Programming/Erlang/josemic/eNose"},
                     {"ROOTDIR","/usr/lib/erlang"},
                     {"SESSION_MANAGER",
                      "local/donald-desktop:@/tmp/.ICE-unix/3363,unix/donald-desktop:/tmp/.ICE-unix/3363"},
                     {"SHELL","/bin/bash"},
                     {"SHLVL","1"},
                     {"SSH_AGENT_PID","3411"},
                     {"SSH_AUTH_SOCK","/run/user/1000/keyring-rMyWh9/ssh"},
                     {"TERM","xterm"},
                     {"USER","michael"},
                     {"USERNAME","michael"},
                     {"VTE_VERSION","3408"},
                     {"WINDOWID","29360134"},
                     {"WINDOWPATH","7"},
                     {"XAUTHORITY",
                      "/var/run/gdm3/auth-for-michael-ZPr5wJ/database"},
                     {"XDG_DATA_DIRS",
                      "/usr/share/gnome:/usr/local/share/:/usr/share/"},
                     {"XDG_MENU_PREFIX","gnome-"},
                     {"XDG_RUNTIME_DIR","/run/user/1000"},
                     {"XDG_SEAT","seat0"},
                     {"XDG_SESSION_COOKIE",
                      "372a03e31c9ec67f6e24f905525f109f-1386351076.894463-1357783957"},
                     {"XDG_SESSION_ID","2"},
                     {"XDG_VTNR","7"},
                     {"_","/usr/bin/make"}]}]
Compiling c_src/epcap_priv.c
INFO:  sh info:
    cwd: "/home/michael/Programming/Erlang/josemic/eNose/deps/epcap"
    cmd: cc -c  -g -Wall -fPIC  -I/usr/lib/erlang/lib/erl_interface-3.7.14/include -I/usr/lib/erlang/erts-5.10.3/include   -DEPCAP_RLIMIT_NOFILES=1 c_src/epcap_priv.c -o c_src/epcap_priv.o
DEBUG:  opts: [{env,[{"BINDIR","/usr/lib/erlang/erts-5.10.3/bin"},
                     {"CC","cc"},
                     {"COLORTERM","gnome-terminal"},
                     {"CXX","c++"},
                     {"DBUS_SESSION_BUS_ADDRESS",
                      "unix:abstract=/tmp/dbus-kreXwAyrov,guid=7ca2adf5fa66f4be809afb5952a209e6"},
                     {"DESKTOP_SESSION","default"},
                     {"DISPLAY",":0"},
                     {"DRV_CC_TEMPLATE",
                      "cc -c $CFLAGS -g -Wall -fPIC  -I/usr/lib/erlang/lib/erl_interface-3.7.14/include -I/usr/lib/erlang/erts-5.10.3/include   $PORT_IN_FILES -o $PORT_OUT_FILE"},
                     {"DRV_CFLAGS",
                      "-g -Wall -fPIC  -I/usr/lib/erlang/lib/erl_interface-3.7.14/include -I/usr/lib/erlang/erts-5.10.3/include  "},
                     {"DRV_CXX_TEMPLATE",
                      "c++ -c $CXXFLAGS -g -Wall -fPIC  -I/usr/lib/erlang/lib/erl_interface-3.7.14/include -I/usr/lib/erlang/erts-5.10.3/include   $PORT_IN_FILES -o $PORT_OUT_FILE"},
                     {"DRV_LDFLAGS",
                      "-shared  -L/usr/lib/erlang/lib/erl_interface-3.7.14/lib -lerl_interface -lei"},
                     {"DRV_LINK_TEMPLATE",
                      "cc $PORT_IN_FILES $LDFLAGS -shared  -L/usr/lib/erlang/lib/erl_interface-3.7.14/lib -lerl_interface -lei -o $PORT_OUT_FILE"},
                     {"EMU","beam"},
                     {"ERLANG_ARCH","64"},
                     {"ERLANG_TARGET","R16B02-x86_64-pc-linux-gnu-64"},
                     {"ERL_CFLAGS",
                      " -I/usr/lib/erlang/lib/erl_interface-3.7.14/include -I/usr/lib/erlang/erts-5.10.3/include  "},
                     {"ERL_EI_LIBDIR",
                      "/usr/lib/erlang/lib/erl_interface-3.7.14/lib"},
                     {"ERL_LDFLAGS",
                      " -L/usr/lib/erlang/lib/erl_interface-3.7.14/lib -lerl_interface -lei"},
                     {"EXE_CC_TEMPLATE",
                      "cc -c $CFLAGS -g -Wall -fPIC  -I/usr/lib/erlang/lib/erl_interface-3.7.14/include -I/usr/lib/erlang/erts-5.10.3/include   -DEPCAP_RLIMIT_NOFILES=1 $PORT_IN_FILES -o $PORT_OUT_FILE"},
                     {"EXE_CFLAGS",
                      "-g -Wall -fPIC  -I/usr/lib/erlang/lib/erl_interface-3.7.14/include -I/usr/lib/erlang/erts-5.10.3/include   -DEPCAP_RLIMIT_NOFILES=1"},
                     {"EXE_CXX_TEMPLATE",
                      "c++ -c $CXXFLAGS -g -Wall -fPIC  -I/usr/lib/erlang/lib/erl_interface-3.7.14/include -I/usr/lib/erlang/erts-5.10.3/include   -DEPCAP_RLIMIT_NOFILES=1 $PORT_IN_FILES -o $PORT_OUT_FILE"},
                     {"EXE_LDFLAGS",
                      "-lpcap  -L/usr/lib/erlang/lib/erl_interface-3.7.14/lib -lerl_interface -lei -static -L /usr/local/lib -lpfring -lpthread"},
                     {"EXE_LINK_TEMPLATE",
                      "cc $PORT_IN_FILES $LDFLAGS -lpcap  -L/usr/lib/erlang/lib/erl_interface-3.7.14/lib -lerl_interface -lei -static -L /usr/local/lib -lpfring -lpthread -o $PORT_OUT_FILE"},
                     {"GDMSESSION","default"},
                     {"GDM_LANG","en_US.utf8"},
                     {"GJS_DEBUG_OUTPUT","stderr"},
                     {"GJS_DEBUG_TOPICS","JS ERROR;JS LOG"},
                     {"GNOME_DESKTOP_SESSION_ID","this-is-deprecated"},
                     {"GNOME_KEYRING_CONTROL","/run/user/1000/keyring-rMyWh9"},
                     {"GNOME_KEYRING_PID","3347"},
                     {"GPG_AGENT_INFO",
                      "/run/user/1000/keyring-rMyWh9/gpg:0:1"},
                     {"HOME","/home/michael"},
                     {"LANG","en_US.utf8"},
                     {"LOGNAME","michael"},
                     {"LS_COLORS",
                      "rs=0:di=01;34:ln=01;36:mh=00:pi=40;33:so=01;35:do=01;35:bd=40;33;01:cd=40;33;01:or=40;31;01:su=37;41:sg=30;43:ca=30;41:tw=30;42:ow=34;42:st=37;44:ex=01;32:*.tar=01;31:*.tgz=01;31:*.arj=01;31:*.taz=01;31:*.lzh=01;31:*.lzma=01;31:*.tlz=01;31:*.txz=01;31:*.zip=01;31:*.z=01;31:*.Z=01;31:*.dz=01;31:*.gz=01;31:*.lz=01;31:*.xz=01;31:*.bz2=01;31:*.bz=01;31:*.tbz=01;31:*.tbz2=01;31:*.tz=01;31:*.deb=01;31:*.rpm=01;31:*.jar=01;31:*.war=01;31:*.ear=01;31:*.sar=01;31:*.rar=01;31:*.ace=01;31:*.zoo=01;31:*.cpio=01;31:*.7z=01;31:*.rz=01;31:*.jpg=01;35:*.jpeg=01;35:*.gif=01;35:*.bmp=01;35:*.pbm=01;35:*.pgm=01;35:*.ppm=01;35:*.tga=01;35:*.xbm=01;35:*.xpm=01;35:*.tif=01;35:*.tiff=01;35:*.png=01;35:*.svg=01;35:*.svgz=01;35:*.mng=01;35:*.pcx=01;35:*.mov=01;35:*.mpg=01;35:*.mpeg=01;35:*.m2v=01;35:*.mkv=01;35:*.webm=01;35:*.ogm=01;35:*.mp4=01;35:*.m4v=01;35:*.mp4v=01;35:*.vob=01;35:*.qt=01;35:*.nuv=01;35:*.wmv=01;35:*.asf=01;35:*.rm=01;35:*.rmvb=01;35:*.flc=01;35:*.avi=01;35:*.fli=01;35:*.flv=01;35:*.gl=01;35:*.dl=01;35:*.xcf=01;35:*.xwd=01;35:*.yuv=01;35:*.cgm=01;35:*.emf=01;35:*.axv=01;35:*.anx=01;35:*.ogv=01;35:*.ogx=01;35:*.aac=00;36:*.au=00;36:*.flac=00;36:*.mid=00;36:*.midi=00;36:*.mka=00;36:*.mp3=00;36:*.mpc=00;36:*.ogg=00;36:*.ra=00;36:*.wav=00;36:*.axa=00;36:*.oga=00;36:*.spx=00;36:*.xspf=00;36:"},
                     {"MAKEFLAGS",[]},
                     {"MAKELEVEL","1"},
                     {"MFLAGS",[]},
                     {"OLDPWD",
                      "/home/michael/Programming/Erlang/josemic/eNose/deps"},
                     {"PATH",
                      "/usr/lib/erlang/erts-5.10.3/bin:/usr/lib/erlang/bin:/usr/local/bin:/usr/bin:/bin:/usr/local/games:/usr/games"},
                     {"PFRING","/usr/local/lib"},
                     {"PROGNAME","erl"},
                     {"PWD","/home/michael/Programming/Erlang/josemic/eNose"},
                     {"ROOTDIR","/usr/lib/erlang"},
                     {"SESSION_MANAGER",
                      "local/donald-desktop:@/tmp/.ICE-unix/3363,unix/donald-desktop:/tmp/.ICE-unix/3363"},
                     {"SHELL","/bin/bash"},
                     {"SHLVL","1"},
                     {"SSH_AGENT_PID","3411"},
                     {"SSH_AUTH_SOCK","/run/user/1000/keyring-rMyWh9/ssh"},
                     {"TERM","xterm"},
                     {"USER","michael"},
                     {"USERNAME","michael"},
                     {"VTE_VERSION","3408"},
                     {"WINDOWID","29360134"},
                     {"WINDOWPATH","7"},
                     {"XAUTHORITY",
                      "/var/run/gdm3/auth-for-michael-ZPr5wJ/database"},
                     {"XDG_DATA_DIRS",
                      "/usr/share/gnome:/usr/local/share/:/usr/share/"},
                     {"XDG_MENU_PREFIX","gnome-"},
                     {"XDG_RUNTIME_DIR","/run/user/1000"},
                     {"XDG_SEAT","seat0"},
                     {"XDG_SESSION_COOKIE",
                      "372a03e31c9ec67f6e24f905525f109f-1386351076.894463-1357783957"},
                     {"XDG_SESSION_ID","2"},
                     {"XDG_VTNR","7"},
                     {"_","/usr/bin/make"}]}]
INFO:  Using specs [{spec,exe,"priv/epcap",
                          ["c_src/epcap.c","c_src/epcap_priv.c"],
                          ["c_src/epcap.o","c_src/epcap_priv.o"],
                          []}]
DEBUG: Last mod is 0 on priv/epcap
INFO:  sh info:
    cwd: "/home/michael/Programming/Erlang/josemic/eNose/deps/epcap"
    cmd: cc c_src/epcap.o c_src/epcap_priv.o  -lpcap  -L/usr/lib/erlang/lib/erl_interface-3.7.14/lib -lerl_interface -lei -static -L /usr/local/lib -lpfring -lpthread -o priv/epcap
DEBUG:  opts: [{env,[{"BINDIR","/usr/lib/erlang/erts-5.10.3/bin"},
                     {"CC","cc"},
                     {"COLORTERM","gnome-terminal"},
                     {"CXX","c++"},
                     {"DBUS_SESSION_BUS_ADDRESS",
                      "unix:abstract=/tmp/dbus-kreXwAyrov,guid=7ca2adf5fa66f4be809afb5952a209e6"},
                     {"DESKTOP_SESSION","default"},
                     {"DISPLAY",":0"},
                     {"DRV_CC_TEMPLATE",
                      "cc -c $CFLAGS -g -Wall -fPIC  -I/usr/lib/erlang/lib/erl_interface-3.7.14/include -I/usr/lib/erlang/erts-5.10.3/include   $PORT_IN_FILES -o $PORT_OUT_FILE"},
                     {"DRV_CFLAGS",
                      "-g -Wall -fPIC  -I/usr/lib/erlang/lib/erl_interface-3.7.14/include -I/usr/lib/erlang/erts-5.10.3/include  "},
                     {"DRV_CXX_TEMPLATE",
                      "c++ -c $CXXFLAGS -g -Wall -fPIC  -I/usr/lib/erlang/lib/erl_interface-3.7.14/include -I/usr/lib/erlang/erts-5.10.3/include   $PORT_IN_FILES -o $PORT_OUT_FILE"},
                     {"DRV_LDFLAGS",
                      "-shared  -L/usr/lib/erlang/lib/erl_interface-3.7.14/lib -lerl_interface -lei"},
                     {"DRV_LINK_TEMPLATE",
                      "cc $PORT_IN_FILES $LDFLAGS -shared  -L/usr/lib/erlang/lib/erl_interface-3.7.14/lib -lerl_interface -lei -o $PORT_OUT_FILE"},
                     {"EMU","beam"},
                     {"ERLANG_ARCH","64"},
                     {"ERLANG_TARGET","R16B02-x86_64-pc-linux-gnu-64"},
                     {"ERL_CFLAGS",
                      " -I/usr/lib/erlang/lib/erl_interface-3.7.14/include -I/usr/lib/erlang/erts-5.10.3/include  "},
                     {"ERL_EI_LIBDIR",
                      "/usr/lib/erlang/lib/erl_interface-3.7.14/lib"},
                     {"ERL_LDFLAGS",
                      " -L/usr/lib/erlang/lib/erl_interface-3.7.14/lib -lerl_interface -lei"},
                     {"EXE_CC_TEMPLATE",
                      "cc -c $CFLAGS -g -Wall -fPIC  -I/usr/lib/erlang/lib/erl_interface-3.7.14/include -I/usr/lib/erlang/erts-5.10.3/include   -DEPCAP_RLIMIT_NOFILES=1 $PORT_IN_FILES -o $PORT_OUT_FILE"},
                     {"EXE_CFLAGS",
                      "-g -Wall -fPIC  -I/usr/lib/erlang/lib/erl_interface-3.7.14/include -I/usr/lib/erlang/erts-5.10.3/include   -DEPCAP_RLIMIT_NOFILES=1"},
                     {"EXE_CXX_TEMPLATE",
                      "c++ -c $CXXFLAGS -g -Wall -fPIC  -I/usr/lib/erlang/lib/erl_interface-3.7.14/include -I/usr/lib/erlang/erts-5.10.3/include   -DEPCAP_RLIMIT_NOFILES=1 $PORT_IN_FILES -o $PORT_OUT_FILE"},
                     {"EXE_LDFLAGS",
                      "-lpcap  -L/usr/lib/erlang/lib/erl_interface-3.7.14/lib -lerl_interface -lei -static -L /usr/local/lib -lpfring -lpthread"},
                     {"EXE_LINK_TEMPLATE",
                      "cc $PORT_IN_FILES $LDFLAGS -lpcap  -L/usr/lib/erlang/lib/erl_interface-3.7.14/lib -lerl_interface -lei -static -L /usr/local/lib -lpfring -lpthread -o $PORT_OUT_FILE"},
                     {"GDMSESSION","default"},
                     {"GDM_LANG","en_US.utf8"},
                     {"GJS_DEBUG_OUTPUT","stderr"},
                     {"GJS_DEBUG_TOPICS","JS ERROR;JS LOG"},
                     {"GNOME_DESKTOP_SESSION_ID","this-is-deprecated"},
                     {"GNOME_KEYRING_CONTROL","/run/user/1000/keyring-rMyWh9"},
                     {"GNOME_KEYRING_PID","3347"},
                     {"GPG_AGENT_INFO",
                      "/run/user/1000/keyring-rMyWh9/gpg:0:1"},
                     {"HOME","/home/michael"},
                     {"LANG","en_US.utf8"},
                     {"LOGNAME","michael"},
                     {"LS_COLORS",
                      "rs=0:di=01;34:ln=01;36:mh=00:pi=40;33:so=01;35:do=01;35:bd=40;33;01:cd=40;33;01:or=40;31;01:su=37;41:sg=30;43:ca=30;41:tw=30;42:ow=34;42:st=37;44:ex=01;32:*.tar=01;31:*.tgz=01;31:*.arj=01;31:*.taz=01;31:*.lzh=01;31:*.lzma=01;31:*.tlz=01;31:*.txz=01;31:*.zip=01;31:*.z=01;31:*.Z=01;31:*.dz=01;31:*.gz=01;31:*.lz=01;31:*.xz=01;31:*.bz2=01;31:*.bz=01;31:*.tbz=01;31:*.tbz2=01;31:*.tz=01;31:*.deb=01;31:*.rpm=01;31:*.jar=01;31:*.war=01;31:*.ear=01;31:*.sar=01;31:*.rar=01;31:*.ace=01;31:*.zoo=01;31:*.cpio=01;31:*.7z=01;31:*.rz=01;31:*.jpg=01;35:*.jpeg=01;35:*.gif=01;35:*.bmp=01;35:*.pbm=01;35:*.pgm=01;35:*.ppm=01;35:*.tga=01;35:*.xbm=01;35:*.xpm=01;35:*.tif=01;35:*.tiff=01;35:*.png=01;35:*.svg=01;35:*.svgz=01;35:*.mng=01;35:*.pcx=01;35:*.mov=01;35:*.mpg=01;35:*.mpeg=01;35:*.m2v=01;35:*.mkv=01;35:*.webm=01;35:*.ogm=01;35:*.mp4=01;35:*.m4v=01;35:*.mp4v=01;35:*.vob=01;35:*.qt=01;35:*.nuv=01;35:*.wmv=01;35:*.asf=01;35:*.rm=01;35:*.rmvb=01;35:*.flc=01;35:*.avi=01;35:*.fli=01;35:*.flv=01;35:*.gl=01;35:*.dl=01;35:*.xcf=01;35:*.xwd=01;35:*.yuv=01;35:*.cgm=01;35:*.emf=01;35:*.axv=01;35:*.anx=01;35:*.ogv=01;35:*.ogx=01;35:*.aac=00;36:*.au=00;36:*.flac=00;36:*.mid=00;36:*.midi=00;36:*.mka=00;36:*.mp3=00;36:*.mpc=00;36:*.ogg=00;36:*.ra=00;36:*.wav=00;36:*.axa=00;36:*.oga=00;36:*.spx=00;36:*.xspf=00;36:"},
                     {"MAKEFLAGS",[]},
                     {"MAKELEVEL","1"},
                     {"MFLAGS",[]},
                     {"OLDPWD",
                      "/home/michael/Programming/Erlang/josemic/eNose/deps"},
                     {"PATH",
                      "/usr/lib/erlang/erts-5.10.3/bin:/usr/lib/erlang/bin:/usr/local/bin:/usr/bin:/bin:/usr/local/games:/usr/games"},
                     {"PFRING","/usr/local/lib"},
                     {"PROGNAME","erl"},
                     {"PWD","/home/michael/Programming/Erlang/josemic/eNose"},
                     {"ROOTDIR","/usr/lib/erlang"},
                     {"SESSION_MANAGER",
                      "local/donald-desktop:@/tmp/.ICE-unix/3363,unix/donald-desktop:/tmp/.ICE-unix/3363"},
                     {"SHELL","/bin/bash"},
                     {"SHLVL","1"},
                     {"SSH_AGENT_PID","3411"},
                     {"SSH_AUTH_SOCK","/run/user/1000/keyring-rMyWh9/ssh"},
                     {"TERM","xterm"},
                     {"USER","michael"},
                     {"USERNAME","michael"},
                     {"VTE_VERSION","3408"},
                     {"WINDOWID","29360134"},
                     {"WINDOWPATH","7"},
                     {"XAUTHORITY",
                      "/var/run/gdm3/auth-for-michael-ZPr5wJ/database"},
                     {"XDG_DATA_DIRS",
                      "/usr/share/gnome:/usr/local/share/:/usr/share/"},
                     {"XDG_MENU_PREFIX","gnome-"},
                     {"XDG_RUNTIME_DIR","/run/user/1000"},
                     {"XDG_SEAT","seat0"},
                     {"XDG_SESSION_COOKIE",
                      "372a03e31c9ec67f6e24f905525f109f-1386351076.894463-1357783957"},
                     {"XDG_SESSION_ID","2"},
                     {"XDG_VTNR","7"},
                     {"_","/usr/bin/make"}]}]
c_src/epcap_priv.o: In function `epcap_priv_drop':
/home/michael/Programming/Erlang/josemic/eNose/deps/epcap/c_src/epcap_priv.c:64: warning: Using 'getgrnam' in statically linked applications requires at runtime the shared libraries from the glibc version used for linking
/home/michael/Programming/Erlang/josemic/eNose/deps/epcap/c_src/epcap_priv.c:59: warning: Using 'getpwnam' in statically linked applications requires at runtime the shared libraries from the glibc version used for linking
/usr/lib/gcc/x86_64-linux-gnu/4.8/../../../x86_64-linux-gnu/libpcap.a(nametoaddr.o): In function `pcap_nametoaddrinfo':
(.text+0x74): warning: Using 'getaddrinfo' in statically linked applications requires at runtime the shared libraries from the glibc version used for linking
/usr/lib/gcc/x86_64-linux-gnu/4.8/../../../x86_64-linux-gnu/libpcap.a(nametoaddr.o): In function `pcap_nametoaddr':
(.text+0x5): warning: Using 'gethostbyname' in statically linked applications requires at runtime the shared libraries from the glibc version used for linking
/usr/lib/gcc/x86_64-linux-gnu/4.8/../../../x86_64-linux-gnu/libpcap.a(nametoaddr.o): In function `pcap_nametonetaddr':
(.text+0xa5): warning: Using 'getnetbyname' in statically linked applications requires at runtime the shared libraries from the glibc version used for linking
/usr/lib/gcc/x86_64-linux-gnu/4.8/../../../x86_64-linux-gnu/libpcap.a(nametoaddr.o): In function `pcap_nametoproto':
(.text+0x2c5): warning: Using 'getprotobyname' in statically linked applications requires at runtime the shared libraries from the glibc version used for linking
/usr/lib/gcc/x86_64-linux-gnu/4.8/../../../x86_64-linux-gnu/libpcap.a(nametoaddr.o): In function `pcap_nametoport':
(.text+0xe9): warning: Using 'getservbyname' in statically linked applications requires at runtime the shared libraries from the glibc version used for linking
INFO:  No app_vars_file defined.
DEBUG: Postdirs: []
...

epcap dependencies:

$strings deps/epcap/priv/epcap | grep pfring

$

Linker:

$ldd deps/epcap/priv/epcap
    not a dynamic executable
@ates
Collaborator
ates commented Dec 7, 2013

Looks like rebar shows only exported variables, but I found this string in debug output:

"cc $PORT_IN_FILES $LDFLAGS -lpcap  -L/usr/lib/erlang/lib/erl_interface-3.7.14/lib -lerl_interface -lei -static -L /usr/local/lib -lpfring -lpthread -o $PORT_OUT_FILE"}``

So PFRING variable is used. Something wrong with pfring installation, I will try to test this using PF_RING from svn.

@ates
Collaborator
ates commented Dec 7, 2013

Looks like not only exported variables:

{"PFRING","/usr/local/lib"}

Try to use stable PF_RING (5.6.1)

@josemic
josemic commented Dec 7, 2013

Before I had used PF_RING-4 as described by suricata:
https://redmine.openinfosecfoundation.org/projects/suricata/wiki/Installation_with_PF_RING

Now I downloaded stable PF_RING (5.6.1). It does not compile:

$ make
make -C /lib/modules/3.11-2-amd64/build SUBDIRS=/home/michael/PF_RING-5.6.1/PF_RING-5.6.1/kernel EXTRA_CFLAGS='-I/home/michael/PF_RING-5.6.1/PF_RING-5.6.1/kernel -DSVN_REV="\"Unversioned directory\""' modules
make[1]: Entering directory `/usr/src/linux-headers-3.11-2-amd64'
  CC [M]  /home/michael/PF_RING-5.6.1/PF_RING-5.6.1/kernel/pf_ring.o
/home/michael/PF_RING-5.6.1/PF_RING-5.6.1/kernel/pf_ring.c: In function ‘ring_proc_add’:
/home/michael/PF_RING-5.6.1/PF_RING-5.6.1/kernel/pf_ring.c:956:5: error: implicit declaration of function ‘create_proc_read_entry’ [-Werror=implicit-function-declaration]
     create_proc_read_entry(pfr->sock_proc_name, 0 /* read-only */,
     ^
/home/michael/PF_RING-5.6.1/PF_RING-5.6.1/kernel/pf_ring.c: In function ‘ring_proc_init’:
/home/michael/PF_RING-5.6.1/PF_RING-5.6.1/kernel/pf_ring.c:1582:15: warning: assignment makes pointer from integer without a cast [enabled by default]
     ring_proc = create_proc_read_entry(PROC_INFO, 0 /* read-only */,
               ^
/home/michael/PF_RING-5.6.1/PF_RING-5.6.1/kernel/pf_ring.c:1585:28: warning: assignment makes pointer from integer without a cast [enabled by default]
     ring_proc_plugins_info =
                            ^
/home/michael/PF_RING-5.6.1/PF_RING-5.6.1/kernel/pf_ring.c: In function ‘skb_ring_handler’:
/home/michael/PF_RING-5.6.1/PF_RING-5.6.1/kernel/pf_ring.c:4539:78: error: ‘struct net_device’ has no member named ‘master’
       || ((skb->dev->flags & IFF_SLAVE) && (pfr->ring_netdev->dev == skb->dev->master)))
                                                                              ^
/home/michael/PF_RING-5.6.1/PF_RING-5.6.1/kernel/pf_ring.c:4599:42: error: ‘struct net_device’ has no member named ‘master’
     && (pfr->ring_netdev->dev == skb->dev->master)))
                                          ^
/home/michael/PF_RING-5.6.1/PF_RING-5.6.1/kernel/pf_ring.c: In function ‘setSocketStats’:
/home/michael/PF_RING-5.6.1/PF_RING-5.6.1/kernel/pf_ring.c:7477:15: warning: assignment makes pointer from integer without a cast [enabled by default]
     if((entry = create_proc_read_entry(s->sock_proc_stats_name,
               ^
/home/michael/PF_RING-5.6.1/PF_RING-5.6.1/kernel/pf_ring.c: In function ‘ring_notifier’:
/home/michael/PF_RING-5.6.1/PF_RING-5.6.1/kernel/pf_ring.c:9435:27: error: dereferencing pointer to incomplete type
        dev_ptr->proc_entry->name, dev->name);
                           ^
/home/michael/PF_RING-5.6.1/PF_RING-5.6.1/kernel/pf_ring.c:9444:43: error: dereferencing pointer to incomplete type
      remove_proc_entry(dev_ptr->proc_entry->name, ring_proc_dev_dir);
                                           ^
/home/michael/PF_RING-5.6.1/PF_RING-5.6.1/kernel/pf_ring.c:9468:33: error: dereferencing pointer to incomplete type
      strncpy(dev_ptr->proc_entry->name, dev->name, dev_ptr->proc_entry->namelen);
                                 ^
/home/michael/PF_RING-5.6.1/PF_RING-5.6.1/kernel/pf_ring.c:9468:71: error: dereferencing pointer to incomplete type
      strncpy(dev_ptr->proc_entry->name, dev->name, dev_ptr->proc_entry->namelen);
                                                                       ^
/home/michael/PF_RING-5.6.1/PF_RING-5.6.1/kernel/pf_ring.c:9469:25: error: dereferencing pointer to incomplete type
      dev_ptr->proc_entry->name[dev_ptr->proc_entry->namelen /* size is namelen+1 */] = '\0';
                         ^
/home/michael/PF_RING-5.6.1/PF_RING-5.6.1/kernel/pf_ring.c:9469:51: error: dereferencing pointer to incomplete type
      dev_ptr->proc_entry->name[dev_ptr->proc_entry->namelen /* size is namelen+1 */] = '\0';
                                                   ^
cc1: some warnings being treated as errors
make[4]: *** [/home/michael/PF_RING-5.6.1/PF_RING-5.6.1/kernel/pf_ring.o] Error 1
make[3]: *** [_module_/home/michael/PF_RING-5.6.1/PF_RING-5.6.1/kernel] Error 2
make[2]: *** [sub-make] Error 2
make[1]: *** [all] Error 2
make[1]: Leaving directory `/usr/src/linux-headers-3.11-2-amd64'
make: *** [all] Error 2

As this did not work I installed PF_RING as described by ntop.org:
http://www.ntop.org/get-started/download/

svn co https://svn.ntop.org/svn/ntop/trunk/PF_RING/
cd PF_RING/kernel
make
sudo insmod ./pf_ring.ko
cd ../userland
make

This compiles, however also here PF_RING does not work:

$ldd deps/epcap/priv/epcap
    not a dynamic executable
$ strings deps/epcap/priv/epcap |grep pfring
$
@ates
Collaborator
ates commented Dec 8, 2013

Tried to use PF_RING from svn, it's works on my system. Let's try to edit rebar.config.script and remove -static flag, after check the output from ldd priv/epcap.

@josemic
josemic commented Dec 8, 2013

I removed the -static flag inside epcap rebar.config.script. Here is the output:

PFRING=/home/michael/PF_RING/userland/lib make all
....
ldd deps/epcap/priv/epcap 
    linux-vdso.so.1 (0x00007fff4bbfe000)
    libpcap.so.0.8 => /usr/lib/x86_64-linux-gnu/libpcap.so.0.8 (0x00007f3a744a4000)
    libpfring.so => /usr/local/lib/libpfring.so (0x00007f3a7427e000)
    libpthread.so.0 => /lib/x86_64-linux-gnu/libpthread.so.0 (0x00007f3a74061000)
    libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007f3a73cb5000)
    /lib64/ld-linux-x86-64.so.2 (0x00007f3a746ff000)
@josemic
josemic commented Dec 8, 2013

By the way:
I am using the following epcap parameters:

{interface, "eth1"}, {cluster_id, Cluster_ID}

Where Cluster_ID is 1 for the first instance, 2 for the second instance , etc. 

Actually I would like to use "dna1" or "dna0" instead of "eth1" , however "dnaX" do not work with my PC for whatever reason. Here already the pf_ring example pf_count fails.

@ates
Collaborator
ates commented Dec 8, 2013

Something wrong with linker. It's use system installed pcap not from pfring. Just for test try to remove libpcap package

-------- Original message --------
From: josemic notifications@github.com
Date:
To: msantos/epcap epcap@noreply.github.com
Cc: Artem Teslenko ates@ipv6.dp.ua
Subject: Re: [epcap] epcap with PF_RING does not start (#14)

PFRING=/home/michael/PF_RING/userland/lib make all
....
ldd deps/epcap/priv/epcap
linux-vdso.so.1 (0x00007fff4bbfe000)
libpcap.so.0.8 => /usr/lib/x86_64-linux-gnu/libpcap.so.0.8 (0x00007f3a744a4000)
libpfring.so => /usr/local/lib/libpfring.so (0x00007f3a7427e000)
libpthread.so.0 => /lib/x86_64-linux-gnu/libpthread.so.0 (0x00007f3a74061000)
libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007f3a73cb5000)
/lib64/ld-linux-x86-64.so.2 (0x00007f3a746ff000)

Reply to this email directly or view it on GitHub.

@josemic
josemic commented Dec 8, 2013

I can not remove libpcap packages, as this would remove gnome package too. There is a dependency. However I could remove libpcap-dev and libpcap debugging symbols packages.

After doing this I get the result:

PFRING=/home/michael/PF_RING/userland/lib make all
...
Compiling c_src/epcap.c
INFO:  sh info:
    cwd: "/home/michael/Programming/Erlang/josemic/eNose/deps/epcap"
    cmd: cc -c  -g -Wall -fPIC  -I/usr/lib/erlang/lib/erl_interface-3.7.14/include -I/usr/lib/erlang/erts-5.10.3/include   -DEPCAP_RLIMIT_NOFILES=1 c_src/epcap.c -o c_src/epcap.o
DEBUG:  opts: [{env,[{"BINDIR","/usr/lib/erlang/erts-5.10.3/bin"},
                     {"CC","cc"},
                     {"COLORTERM","gnome-terminal"},
                     {"CXX","c++"},
                     {"DBUS_SESSION_BUS_ADDRESS",
                      "unix:abstract=/tmp/dbus-83T4dadVhz,guid=a97aad7274609734c6fdba9c52a4c258"},
                     {"DESKTOP_SESSION","default"},
                     {"DISPLAY",":0"},
                     {"DRV_CC_TEMPLATE",
                      "cc -c $CFLAGS -g -Wall -fPIC  -I/usr/lib/erlang/lib/erl_interface-3.7.14/include -I/usr/lib/erlang/erts-5.10.3/include   $PORT_IN_FILES -o $PORT_OUT_FILE"},
                     {"DRV_CFLAGS",
                      "-g -Wall -fPIC  -I/usr/lib/erlang/lib/erl_interface-3.7.14/include -I/usr/lib/erlang/erts-5.10.3/include  "},
                     {"DRV_CXX_TEMPLATE",
                      "c++ -c $CXXFLAGS -g -Wall -fPIC  -I/usr/lib/erlang/lib/erl_interface-3.7.14/include -I/usr/lib/erlang/erts-5.10.3/include   $PORT_IN_FILES -o $PORT_OUT_FILE"},
                     {"DRV_LDFLAGS",
                      "-shared  -L/usr/lib/erlang/lib/erl_interface-3.7.14/lib -lerl_interface -lei"},
                     {"DRV_LINK_TEMPLATE",
                      "cc $PORT_IN_FILES $LDFLAGS -shared  -L/usr/lib/erlang/lib/erl_interface-3.7.14/lib -lerl_interface -lei -o $PORT_OUT_FILE"},
                     {"EMU","beam"},
                     {"ERLANG_ARCH","64"},
                     {"ERLANG_TARGET","R16B02-x86_64-pc-linux-gnu-64"},
                     {"ERL_CFLAGS",
                      " -I/usr/lib/erlang/lib/erl_interface-3.7.14/include -I/usr/lib/erlang/erts-5.10.3/include  "},
                     {"ERL_EI_LIBDIR",
                      "/usr/lib/erlang/lib/erl_interface-3.7.14/lib"},
                     {"ERL_LDFLAGS",
                      " -L/usr/lib/erlang/lib/erl_interface-3.7.14/lib -lerl_interface -lei"},
                     {"EXE_CC_TEMPLATE",
                      "cc -c $CFLAGS -g -Wall -fPIC  -I/usr/lib/erlang/lib/erl_interface-3.7.14/include -I/usr/lib/erlang/erts-5.10.3/include   -DEPCAP_RLIMIT_NOFILES=1 $PORT_IN_FILES -o $PORT_OUT_FILE"},
                     {"EXE_CFLAGS",
                      "-g -Wall -fPIC  -I/usr/lib/erlang/lib/erl_interface-3.7.14/include -I/usr/lib/erlang/erts-5.10.3/include   -DEPCAP_RLIMIT_NOFILES=1"},
                     {"EXE_CXX_TEMPLATE",
                      "c++ -c $CXXFLAGS -g -Wall -fPIC  -I/usr/lib/erlang/lib/erl_interface-3.7.14/include -I/usr/lib/erlang/erts-5.10.3/include   -DEPCAP_RLIMIT_NOFILES=1 $PORT_IN_FILES -o $PORT_OUT_FILE"},
                     {"EXE_LDFLAGS",
                      "-lpcap  -L/usr/lib/erlang/lib/erl_interface-3.7.14/lib -lerl_interface -lei -L /home/michael/PF_RING/userland/lib -lpfring -lpthread"},
                     {"EXE_LINK_TEMPLATE",
                      "cc $PORT_IN_FILES $LDFLAGS -lpcap  -L/usr/lib/erlang/lib/erl_interface-3.7.14/lib -lerl_interface -lei -L /home/michael/PF_RING/userland/lib -lpfring -lpthread -o $PORT_OUT_FILE"},
                     {"GDMSESSION","default"},
                     {"GDM_LANG","en_US.utf8"},
                     {"GJS_DEBUG_OUTPUT","stderr"},
                     {"GJS_DEBUG_TOPICS","JS ERROR;JS LOG"},
                     {"GNOME_DESKTOP_SESSION_ID","this-is-deprecated"},
                     {"GNOME_KEYRING_CONTROL","/run/user/1000/keyring-hiAaPd"},
                     {"GNOME_KEYRING_PID","3227"},
                     {"GPG_AGENT_INFO",
                      "/run/user/1000/keyring-hiAaPd/gpg:0:1"},
                     {"HOME","/home/michael"},
                     {"LANG","en_US.utf8"},
                     {"LOGNAME","michael"},
                     {"LS_COLORS",
                      "rs=0:di=01;34:ln=01;36:mh=00:pi=40;33:so=01;35:do=01;35:bd=40;33;01:cd=40;33;01:or=40;31;01:su=37;41:sg=30;43:ca=30;41:tw=30;42:ow=34;42:st=37;44:ex=01;32:*.tar=01;31:*.tgz=01;31:*.arj=01;31:*.taz=01;31:*.lzh=01;31:*.lzma=01;31:*.tlz=01;31:*.txz=01;31:*.zip=01;31:*.z=01;31:*.Z=01;31:*.dz=01;31:*.gz=01;31:*.lz=01;31:*.xz=01;31:*.bz2=01;31:*.bz=01;31:*.tbz=01;31:*.tbz2=01;31:*.tz=01;31:*.deb=01;31:*.rpm=01;31:*.jar=01;31:*.war=01;31:*.ear=01;31:*.sar=01;31:*.rar=01;31:*.ace=01;31:*.zoo=01;31:*.cpio=01;31:*.7z=01;31:*.rz=01;31:*.jpg=01;35:*.jpeg=01;35:*.gif=01;35:*.bmp=01;35:*.pbm=01;35:*.pgm=01;35:*.ppm=01;35:*.tga=01;35:*.xbm=01;35:*.xpm=01;35:*.tif=01;35:*.tiff=01;35:*.png=01;35:*.svg=01;35:*.svgz=01;35:*.mng=01;35:*.pcx=01;35:*.mov=01;35:*.mpg=01;35:*.mpeg=01;35:*.m2v=01;35:*.mkv=01;35:*.webm=01;35:*.ogm=01;35:*.mp4=01;35:*.m4v=01;35:*.mp4v=01;35:*.vob=01;35:*.qt=01;35:*.nuv=01;35:*.wmv=01;35:*.asf=01;35:*.rm=01;35:*.rmvb=01;35:*.flc=01;35:*.avi=01;35:*.fli=01;35:*.flv=01;35:*.gl=01;35:*.dl=01;35:*.xcf=01;35:*.xwd=01;35:*.yuv=01;35:*.cgm=01;35:*.emf=01;35:*.axv=01;35:*.anx=01;35:*.ogv=01;35:*.ogx=01;35:*.aac=00;36:*.au=00;36:*.flac=00;36:*.mid=00;36:*.midi=00;36:*.mka=00;36:*.mp3=00;36:*.mpc=00;36:*.ogg=00;36:*.ra=00;36:*.wav=00;36:*.axa=00;36:*.oga=00;36:*.spx=00;36:*.xspf=00;36:"},
                     {"MAKEFLAGS",[]},
                     {"MAKELEVEL","1"},
                     {"MFLAGS",[]},
                     {"OLDPWD","/home/michael"},
                     {"PATH",
                      "/usr/lib/erlang/erts-5.10.3/bin:/usr/lib/erlang/bin:/usr/local/bin:/usr/bin:/bin:/usr/local/games:/usr/games"},
                     {"PFRING","/home/michael/PF_RING/userland/lib"},
                     {"PROGNAME","erl"},
                     {"PWD","/home/michael/Programming/Erlang/josemic/eNose"},
                     {"ROOTDIR","/usr/lib/erlang"},
                     {"SESSION_MANAGER",
                      "local/donald-desktop:@/tmp/.ICE-unix/3245,unix/donald-desktop:/tmp/.ICE-unix/3245"},
                     {"SHELL","/bin/bash"},
                     {"SHLVL","1"},
                     {"SSH_AGENT_PID","3291"},
                     {"SSH_AUTH_SOCK","/run/user/1000/keyring-hiAaPd/ssh"},
                     {"TERM","xterm"},
                     {"USER","michael"},
                     {"USERNAME","michael"},
                     {"VTE_VERSION","3408"},
                     {"WINDOWID","27262982"},
                     {"WINDOWPATH","7"},
                     {"XAUTHORITY",
                      "/var/run/gdm3/auth-for-michael-ybP22q/database"},
                     {"XDG_DATA_DIRS",
                      "/usr/share/gnome:/usr/local/share/:/usr/share/"},
                     {"XDG_MENU_PREFIX","gnome-"},
                     {"XDG_RUNTIME_DIR","/run/user/1000"},
                     {"XDG_SEAT","seat0"},
                     {"XDG_SESSION_COOKIE",
                      "372a03e31c9ec67f6e24f905525f109f-1386529366.958285-1643572243"},
                     {"XDG_SESSION_ID","2"},
                     {"XDG_VTNR","7"},
                     {"_","/usr/bin/make"}]}]
In file included from c_src/epcap.c:34:0:
c_src/epcap.h:41:18: fatal error: pcap.h: No such file or directory
 #include <pcap.h>
                  ^
compilation terminated.
ERROR: cc -c  -g -Wall -fPIC  -I/usr/lib/erlang/lib/erl_interface-3.7.14/include -I/usr/lib/erlang/erts-5.10.3/include   -DEPCAP_RLIMIT_NOFILES=1 c_src/epcap.c -o c_src/epcap.o failed with error: 1 and output:
In file included from c_src/epcap.c:34:0:
c_src/epcap.h:41:18: fatal error: pcap.h: No such file or directory
 #include <pcap.h>
                  ^
compilation terminated.

make: *** [compile] Error 1
@ates
Collaborator
ates commented Dec 9, 2013

One of the reason why linker can't see pcap from PF_RING it's because symbols from modified libpcap is not in ld cache. Run the following command and check if /usr/local/lib/libpcap* in the cache:

$ ldconfig -p|grep pcap
    libpcap.so.1 (libc6,x86-64) => /usr/local/lib/libpcap.so.1 - This should be !!!
    libpcap.so.1 (libc6,x86-64) => /usr/lib/libpcap.so.1
    libpcap.so.0.8 (libc6,x86-64) => /usr/lib/x86_64-linux-gnu/libpcap.so.0.8
    libpcap.so (libc6,x86-64) => /usr/local/lib/libpcap.so
    libpcap.so (libc6,x86-64) => /usr/lib/x86_64-linux-gnu/libpcap.so
    libpcap.so (libc6,x86-64) => /usr/lib/libpcap.so

If there is no /usr/local/lib/libpcap.so.1, run ldconfig -a, after that install libpcap-dev package and try to compile epcap again.

@josemic
josemic commented Dec 9, 2013

I am using debian-testing. Libpcap-dev is a transitional package (According to its description: "Empty package to facilitate upgrades, can be safely removed.") It has a dependency to libpcap0.8-dev.

ldconfig -p|grep pcap
    libpcap.so.0.8 (libc6,x86-64) => /usr/lib/x86_64-linux-gnu/libpcap.so.0.8
    libpcap.so (libc6,x86-64) => /usr/lib/x86_64-linux-gnu/libpcap.so

Looks like /usr/local/lib/libpcap.so.1 has been removed in debian testing..
The ldconfig option "-a" is not available on my machine. Do you really mean " ldconfig -a"?

@ates
Collaborator
ates commented Dec 9, 2013

Try ldconfig without -a option

09.12.2013 20:39, josemic пишет:

I am using debian-testing. Libpcap-dev is a transitional package
(According to its description: "Empty package to facilitate upgrades,
can be safely removed.") It has a dependency to libpcap0.8-dev.

|ldconfig -p|grep pcap
libpcap.so.0.8 (libc6,x86-64) => /usr/lib/x86_64-linux-gnu/libpcap.so.0.8
libpcap.so (libc6,x86-64) => /usr/lib/x86_64-linux-gnu/libpcap.so
|

Looks like /usr/local/lib/libpcap.so.1 has been removed in debian
testing..
The ldconfig option "-a" is not available on my machine. Do you really
mean " ldconfig -a"?


Reply to this email directly or view it on GitHub
#14 (comment).

@josemic
josemic commented Dec 9, 2013

There is no change:

#ldconfig
#
# ldconfig -p|grep pcap
    libpcap.so.0.8 (libc6,x86-64) => /usr/lib/x86_64-linux-gnu/libpcap.so.0.8
    libpcap.so (libc6,x86-64) => /usr/lib/x86_64-linux-gnu/libpcap.so

@ates
Collaborator
ates commented Dec 9, 2013

Try to create /etc/ld.so.conf.d/local.conf with the following line:

/usr/local/lib

And run ldconfig again, after that check the output from ldconfig -p |
grep libpcap

09.12.2013 22:47, josemic пишет:

There is no change:

|#ldconfig

ldconfig -p|grep pcap

 libpcap.so.0.8 (libc6,x86-64) => /usr/lib/x86_64-linux-gnu/libpcap.so.0.8
 libpcap.so (libc6,x86-64) => /usr/lib/x86_64-linux-gnu/libpcap.so

|
|


Reply to this email directly or view it on GitHub
#14 (comment).

@josemic
josemic commented Dec 9, 2013

/usr/local/lib is not a command. What do you mean?

@ates
Collaborator
ates commented Dec 9, 2013

Run this: echo "/usr/local/lib" >> /etc/ld.so.conf.d/local.conf && ldconfig, and check output using ldconfig -p

@josemic
josemic commented Dec 9, 2013

Same as before:

# echo "/usr/local/lib" >> /etc/ld.so.conf.d/local.conf && ldconfig
# ldconfig -p | grep libpcap    
        libpcap.so.0.8 (libc6,x86-64) => /usr/lib/x86_64-linux-gnu/libpcap.so.0.8
        libpcap.so (libc6,x86-64) => /usr/lib/x86_64-linux-gnu/libpcap.so
@ates
Collaborator
ates commented Dec 9, 2013

Strange.  I will install debian testing tomorrow and check.

-------- Original message --------
From: josemic notifications@github.com
Date:
To: msantos/epcap epcap@noreply.github.com
Cc: Artem Teslenko ates@ipv6.dp.ua
Subject: Re: [epcap] epcap with PF_RING does not start (#14)

Same as before:

echo "/usr/local/lib" >> /etc/ld.so.conf.d/local.conf && ldconfig

ldconfig -p | grep libpcap

    libpcap.so.0.8 (libc6,x86-64) => /usr/lib/x86_64-linux-gnu/libpcap.so.0.8
    libpcap.so (libc6,x86-64) => /usr/lib/x86_64-linux-gnu/libpcap.so


Reply to this email directly or view it on GitHub.

@ates
Collaborator
ates commented Dec 12, 2013

Sorry, I not have enough time to do that for now. I've had positive experience with compilation on CentOS 6.4 and Ubuntu 12.04. Try to install these distros in virtual machine and compile.

@msantos
Owner
msantos commented Dec 14, 2013
ERROR: cc -c  -g -Wall -fPIC  -I/usr/lib/erlang/lib/erl_interface-3.7.14/include -I/usr/lib/erlang/erts-5.10.3/include   -DEPCAP_RLIMIT_NOFILES=1 c_src/epcap.c -o c_src/epcap.o failed with error: 1 and output:

Looks like you need to include /usr/local/include. Try running by hand:

cc -c  -g -Wall -fPIC  -I/usr/local/include -I/usr/lib/erlang/lib/erl_interface-3.7.14/include -I/usr/lib/erlang/erts-5.10.3/include   -DEPCAP_RLIMIT_NOFILES=1 c_src/epcap.c -o c_src/epcap.o 

I think rebar.conf.script needs to set up EXE_CFLAGS as well when PFRING is set.

@josemic
josemic commented Dec 14, 2013

I have installed CentOS6.5 on my machine. There was one compilitation issue. Which was remotely debugged and solved by ates:

b02718e

The installation of CentOS corrupted my debian installation. I had to reinstall debian-testing. This time even the /PF_RING/userland/examples installation failed:

make[1]: Entering directory `/home/michael/PF_RING/PF_RING/userland/libpcap-1.1.1-ring'
VER=`cat ./VERSION`; \
    MAJOR_VER=`sed 's/\([0-9][0-9]*\)\..*/\1/' ./VERSION`; \
    gcc -shared -Wl,-soname,libpcap.so.$MAJOR_VER  \
        -o libpcap.so.$VER pcap-linux.o pcap-usb-linux.o pcap-can-linux.o fad-getad.o pcap.o inet.o gencode.o optimize.o nametoaddr.o etherent.o savefile.o sf-pcap.o sf-pcap-ng.o pcap-common.o bpf_image.o bpf_dump.o  scanner.o grammar.o bpf_filter.o version.o   ../lib/libpfring.a -lpthread
make[1]: Leaving directory `/home/michael/PF_RING/PF_RING/userland/libpcap-1.1.1-ring'
cd examples; make
make[1]: Entering directory `/home/michael/PF_RING/PF_RING/userland/examples'
gcc  -O2 -DHAVE_PF_RING -Wall -I../../kernel -I../../kernel/plugins -I../lib -I../libpcap-1.1.1-ring  -D HAVE_ZERO -D ENABLE_BPF -O2  pfcount.o ../libpcap-1.1.1-ring/libpcap.a   ../lib/libpfring.a  -lpthread  ../libpcap-1.1.1-ring/libpcap.a     -lrt -o pfcount
../libpcap-1.1.1-ring/libpcap.a(grammar.o): In function `pcap_parse':
grammar.c:(.text+0x401): undefined reference to `pcap_lex'
collect2: error: ld returned 1 exit status
make[1]: *** [pfcount] Fehler 1
make[1]: Leaving directory `/home/michael/PF_RING/PF_RING/userland/examples'
make: *** [ring_examples] Fehler 2

And here the epcap Error:

michael@donald:~/Programming/Erlang/josemic/eNose$ PFRING=/home/michael/PF_RING/PF_RING/userland/ make all
DEBUG: Rebar location: "/home/michael/Programming/Erlang/josemic/eNose/rebar"
DEBUG: Consult config file "/home/michael/Programming/Erlang/josemic/eNose/rebar.config"
DEBUG: is_rel_dir(/home/michael/Programming/Erlang/josemic/eNose) -> false
DEBUG: is_app_available, looking for App epcap with Path "/home/michael/Programming/Erlang/josemic/eNose/deps/epcap"
DEBUG: vcs_vsn: Unknown VCS atom in vsn field: "0.7.1"
INFO:  Looking for epcap-.* ; found epcap-0.7.1 at /home/michael/Programming/Erlang/josemic/eNose/deps/epcap
DEBUG: is_app_available, looking for App aho_corasick with Path "/home/michael/Programming/Erlang/josemic/eNose/deps/aho_corasick"
DEBUG: vcs_vsn: Unknown VCS atom in vsn field: "0.0.1"
INFO:  Looking for aho_corasick-.* ; found aho_corasick-0.0.1 at /home/michael/Programming/Erlang/josemic/eNose/deps/aho_corasick
DEBUG: Available deps: [{dep,"/home/michael/Programming/Erlang/josemic/eNose/deps/epcap",
                             epcap,".*",
                             {git,"https://github.com/msantos/epcap.git",
                                  "master"}},
                        {dep,"/home/michael/Programming/Erlang/josemic/eNose/deps/aho_corasick",
                             aho_corasick,".*",
                             {git,"https://github.com/josemic/aho_corasick.git",
                                  "master"}}]
DEBUG: Missing deps  : []
DEBUG: is_app_available, looking for App epcap with Path "/home/michael/Programming/Erlang/josemic/eNose/deps/epcap"
INFO:  Looking for epcap-.* ; found epcap-0.7.1 at /home/michael/Programming/Erlang/josemic/eNose/deps/epcap
DEBUG: Adding /home/michael/Programming/Erlang/josemic/eNose/deps/epcap/ebin to code path
DEBUG: is_app_available, looking for App aho_corasick with Path "/home/michael/Programming/Erlang/josemic/eNose/deps/aho_corasick"
INFO:  Looking for aho_corasick-.* ; found aho_corasick-0.0.1 at /home/michael/Programming/Erlang/josemic/eNose/deps/aho_corasick
DEBUG: Adding /home/michael/Programming/Erlang/josemic/eNose/deps/aho_corasick/ebin to code path
DEBUG: Associate sub_dir /home/michael/Programming/Erlang/josemic/eNose/deps/epcap with /home/michael/Programming/Erlang/josemic/eNose
DEBUG: Associate sub_dir /home/michael/Programming/Erlang/josemic/eNose/deps/aho_corasick with /home/michael/Programming/Erlang/josemic/eNose
DEBUG: Associate sub_dir /home/michael/Programming/Erlang/josemic/eNose/epcap_port_app with /home/michael/Programming/Erlang/josemic/eNose
DEBUG: Associate sub_dir /home/michael/Programming/Erlang/josemic/eNose/rule with /home/michael/Programming/Erlang/josemic/eNose
DEBUG: Associate sub_dir /home/michael/Programming/Erlang/josemic/eNose/content_app with /home/michael/Programming/Erlang/josemic/eNose
DEBUG: Associate sub_dir /home/michael/Programming/Erlang/josemic/eNose/defrag_app with /home/michael/Programming/Erlang/josemic/eNose
DEBUG: Associate sub_dir /home/michael/Programming/Erlang/josemic/eNose/examples with /home/michael/Programming/Erlang/josemic/eNose
DEBUG: Predirs: ["/home/michael/Programming/Erlang/josemic/eNose/deps/epcap",
                 "/home/michael/Programming/Erlang/josemic/eNose/deps/aho_corasick",
                 "/home/michael/Programming/Erlang/josemic/eNose/epcap_port_app",
                 "/home/michael/Programming/Erlang/josemic/eNose/rule",
                 "/home/michael/Programming/Erlang/josemic/eNose/content_app",
                 "/home/michael/Programming/Erlang/josemic/eNose/defrag_app",
                 "/home/michael/Programming/Erlang/josemic/eNose/examples"]
==> Entering directory `/home/michael/Programming/Erlang/josemic/eNose/deps/epcap'
DEBUG: Evaluating config script "/home/michael/Programming/Erlang/josemic/eNose/deps/epcap/rebar.config.script"
DEBUG: Consult config file "/home/michael/Programming/Erlang/josemic/eNose/deps/epcap/rebar.config"
DEBUG: is_app_available, looking for App pkt with Path "/home/michael/Programming/Erlang/josemic/eNose/deps/pkt"
DEBUG: vcs_vsn: Unknown VCS atom in vsn field: "0.4.0"
INFO:  Looking for pkt-.* ; found pkt-0.4.0 at /home/michael/Programming/Erlang/josemic/eNose/deps/pkt
DEBUG: Available deps: [{dep,"/home/michael/Programming/Erlang/josemic/eNose/deps/pkt",
                             pkt,".*",
                             {git,"https://github.com/msantos/pkt.git",
                                  "master"}}]
DEBUG: Missing deps  : []
DEBUG: is_app_available, looking for App pkt with Path "/home/michael/Programming/Erlang/josemic/eNose/deps/pkt"
INFO:  Looking for pkt-.* ; found pkt-0.4.0 at /home/michael/Programming/Erlang/josemic/eNose/deps/pkt
DEBUG: Adding /home/michael/Programming/Erlang/josemic/eNose/deps/pkt/ebin to code path
DEBUG: Associate sub_dir /home/michael/Programming/Erlang/josemic/eNose/deps/pkt with /home/michael/Programming/Erlang/josemic/eNose/deps/epcap
DEBUG: Predirs: ["/home/michael/Programming/Erlang/josemic/eNose/deps/pkt"]
==> Entering directory `/home/michael/Programming/Erlang/josemic/eNose/deps/pkt'
DEBUG: Consult config file "/home/michael/Programming/Erlang/josemic/eNose/deps/pkt/rebar.config"
DEBUG: Available deps: []
DEBUG: Missing deps  : []
DEBUG: Predirs: []
==> pkt (compile)
DEBUG: Matched required ERTS version: 5.10.3 -> .*
DEBUG: Matched required OTP release: R16B02 -> .*
DEBUG: erl_opts [debug_info]
DEBUG: Starting 3 compile worker(s)
INFO:  Skipped src/pkt_ipv6_ah.erl
INFO:  Skipped src/pkt_udp.erl
INFO:  Skipped src/pkt_gre.erl
INFO:  Skipped src/pkt_tcp.erl
INFO:  Skipped src/pkt_ether.erl
INFO:  Skipped src/pkt_ipproto.erl
INFO:  Skipped src/pkt_ipv6_dstopts.erl
INFO:  Skipped src/pkt_ipv4.erl
INFO:  Skipped src/pkt_icmp6.erl
INFO:  Skipped src/pkt_vrrp.erl
INFO:  Skipped src/pkt_dlt.erl
INFO:  Skipped src/pkt_ipv6_routing.erl
INFO:  Skipped src/pkt.erl
INFO:  Skipped src/pkt_ipv6_hopopts.erl
INFO:  Skipped src/pkt_arp.erl
INFO:  Skipped src/pkt_ipv6_fragment.erl
INFO:  Skipped src/pkt_llc.erl
INFO:  Skipped src/pkt_sctp.erl
INFO:  Skipped src/pkt_ipv6.erl
INFO:  Skipped src/pkt_icmp.erl
INFO:  Skipped src/pkt_igmp.erl
INFO:  Skipped src/pkt_linux_cooked.erl
INFO:  Skipped src/pkt_ipv6_esp.erl
DEBUG: Worker exited cleanly
DEBUG: Worker exited cleanly
INFO:  Skipped src/pkt_null.erl
DEBUG: Worker exited cleanly
INFO:  No app_vars_file defined.
DEBUG: Postdirs: []
==> Leaving directory `/home/michael/Programming/Erlang/josemic/eNose/deps/pkt'
==> epcap (compile)
DEBUG: Matched required ERTS version: 5.10.3 -> .*
DEBUG: Matched required OTP release: R16B02 -> .*
DEBUG: is_app_available, looking for App pkt with Path "/home/michael/Programming/Erlang/josemic/eNose/deps/pkt"
INFO:  Looking for pkt-.* ; found pkt-0.4.0 at /home/michael/Programming/Erlang/josemic/eNose/deps/pkt
DEBUG: erl_opts [debug_info]
DEBUG: Starting 3 compile worker(s)
DEBUG: Worker exited cleanly
DEBUG: Worker exited cleanly
INFO:  Skipped src/epcap.erl
DEBUG: Worker exited cleanly
INFO:  Skipping c_src/epcap.c
INFO:  Skipping c_src/epcap_priv.c
INFO:  Using specs [{spec,exe,"priv/epcap",
                          ["c_src/epcap.c","c_src/epcap_priv.c"],
                          ["c_src/epcap.o","c_src/epcap_priv.o"],
                          []}]
INFO:  sh info:
    cwd: "/home/michael/Programming/Erlang/josemic/eNose/deps/epcap"
    cmd: cc c_src/epcap.o c_src/epcap_priv.o  -lpcap  -L/usr/lib/erlang/lib/erl_interface-3.7.14/lib -lerl_interface -lei -L /home/michael/PF_RING/PF_RING/userland/ -lpfring -lpthread -o priv/epcap
DEBUG:  opts: [{env,[{"BINDIR","/usr/lib/erlang/erts-5.10.3/bin"},
                     {"CC","cc"},
                     {"COLORTERM","gnome-terminal"},
                     {"CXX","c++"},
                     {"DBUS_SESSION_BUS_ADDRESS",
                      "unix:abstract=/tmp/dbus-4F6qTmtKrF,guid=566eadc1fb2f8e2d8593248b52acb296"},
                     {"DESKTOP_SESSION","default"},
                     {"DISPLAY",":0"},
                     {"DRV_CC_TEMPLATE",
                      "cc -c $CFLAGS -g -Wall -fPIC  -I/usr/lib/erlang/lib/erl_interface-3.7.14/include -I/usr/lib/erlang/erts-5.10.3/include   $PORT_IN_FILES -o $PORT_OUT_FILE"},
                     {"DRV_CFLAGS",
                      "-g -Wall -fPIC  -I/usr/lib/erlang/lib/erl_interface-3.7.14/include -I/usr/lib/erlang/erts-5.10.3/include  "},
                     {"DRV_CXX_TEMPLATE",
                      "c++ -c $CXXFLAGS -g -Wall -fPIC  -I/usr/lib/erlang/lib/erl_interface-3.7.14/include -I/usr/lib/erlang/erts-5.10.3/include   $PORT_IN_FILES -o $PORT_OUT_FILE"},
                     {"DRV_LDFLAGS",
                      "-shared  -L/usr/lib/erlang/lib/erl_interface-3.7.14/lib -lerl_interface -lei"},
                     {"DRV_LINK_TEMPLATE",
                      "cc $PORT_IN_FILES $LDFLAGS -shared  -L/usr/lib/erlang/lib/erl_interface-3.7.14/lib -lerl_interface -lei -o $PORT_OUT_FILE"},
                     {"EMU","beam"},
                     {"ERLANG_ARCH","64"},
                     {"ERLANG_TARGET","R16B02-x86_64-pc-linux-gnu-64"},
                     {"ERL_CFLAGS",
                      " -I/usr/lib/erlang/lib/erl_interface-3.7.14/include -I/usr/lib/erlang/erts-5.10.3/include  "},
                     {"ERL_EI_LIBDIR",
                      "/usr/lib/erlang/lib/erl_interface-3.7.14/lib"},
                     {"ERL_LDFLAGS",
                      " -L/usr/lib/erlang/lib/erl_interface-3.7.14/lib -lerl_interface -lei"},
                     {"EXE_CC_TEMPLATE",
                      "cc -c $CFLAGS -g -Wall -fPIC  -I/usr/lib/erlang/lib/erl_interface-3.7.14/include -I/usr/lib/erlang/erts-5.10.3/include   -DEPCAP_RLIMIT_NOFILES=1 $PORT_IN_FILES -o $PORT_OUT_FILE"},
                     {"EXE_CFLAGS",
                      "-g -Wall -fPIC  -I/usr/lib/erlang/lib/erl_interface-3.7.14/include -I/usr/lib/erlang/erts-5.10.3/include   -DEPCAP_RLIMIT_NOFILES=1"},
                     {"EXE_CXX_TEMPLATE",
                      "c++ -c $CXXFLAGS -g -Wall -fPIC  -I/usr/lib/erlang/lib/erl_interface-3.7.14/include -I/usr/lib/erlang/erts-5.10.3/include   -DEPCAP_RLIMIT_NOFILES=1 $PORT_IN_FILES -o $PORT_OUT_FILE"},
                     {"EXE_LDFLAGS",
                      "-lpcap  -L/usr/lib/erlang/lib/erl_interface-3.7.14/lib -lerl_interface -lei -L /home/michael/PF_RING/PF_RING/userland/ -lpfring -lpthread"},
                     {"EXE_LINK_TEMPLATE",
                      "cc $PORT_IN_FILES $LDFLAGS -lpcap  -L/usr/lib/erlang/lib/erl_interface-3.7.14/lib -lerl_interface -lei -L /home/michael/PF_RING/PF_RING/userland/ -lpfring -lpthread -o $PORT_OUT_FILE"},
                     {"GDMSESSION","default"},
                     {"GDM_LANG","de_DE.UTF-8"},
                     {"GJS_DEBUG_OUTPUT","stderr"},
                     {"GJS_DEBUG_TOPICS","JS ERROR;JS LOG"},
                     {"GNOME_DESKTOP_SESSION_ID","this-is-deprecated"},
                     {"GNOME_KEYRING_CONTROL","/run/user/1000/keyring-aYAFbZ"},
                     {"GNOME_KEYRING_PID","3755"},
                     {"GPG_AGENT_INFO",
                      "/run/user/1000/keyring-aYAFbZ/gpg:0:1"},
                     {"HOME","/home/michael"},
                     {"LANG","de_DE.UTF-8"},
                     {"LOGNAME","michael"},
                     {"LS_COLORS",
                      "rs=0:di=01;34:ln=01;36:mh=00:pi=40;33:so=01;35:do=01;35:bd=40;33;01:cd=40;33;01:or=40;31;01:su=37;41:sg=30;43:ca=30;41:tw=30;42:ow=34;42:st=37;44:ex=01;32:*.tar=01;31:*.tgz=01;31:*.arj=01;31:*.taz=01;31:*.lzh=01;31:*.lzma=01;31:*.tlz=01;31:*.txz=01;31:*.zip=01;31:*.z=01;31:*.Z=01;31:*.dz=01;31:*.gz=01;31:*.lz=01;31:*.xz=01;31:*.bz2=01;31:*.bz=01;31:*.tbz=01;31:*.tbz2=01;31:*.tz=01;31:*.deb=01;31:*.rpm=01;31:*.jar=01;31:*.war=01;31:*.ear=01;31:*.sar=01;31:*.rar=01;31:*.ace=01;31:*.zoo=01;31:*.cpio=01;31:*.7z=01;31:*.rz=01;31:*.jpg=01;35:*.jpeg=01;35:*.gif=01;35:*.bmp=01;35:*.pbm=01;35:*.pgm=01;35:*.ppm=01;35:*.tga=01;35:*.xbm=01;35:*.xpm=01;35:*.tif=01;35:*.tiff=01;35:*.png=01;35:*.svg=01;35:*.svgz=01;35:*.mng=01;35:*.pcx=01;35:*.mov=01;35:*.mpg=01;35:*.mpeg=01;35:*.m2v=01;35:*.mkv=01;35:*.webm=01;35:*.ogm=01;35:*.mp4=01;35:*.m4v=01;35:*.mp4v=01;35:*.vob=01;35:*.qt=01;35:*.nuv=01;35:*.wmv=01;35:*.asf=01;35:*.rm=01;35:*.rmvb=01;35:*.flc=01;35:*.avi=01;35:*.fli=01;35:*.flv=01;35:*.gl=01;35:*.dl=01;35:*.xcf=01;35:*.xwd=01;35:*.yuv=01;35:*.cgm=01;35:*.emf=01;35:*.axv=01;35:*.anx=01;35:*.ogv=01;35:*.ogx=01;35:*.aac=00;36:*.au=00;36:*.flac=00;36:*.mid=00;36:*.midi=00;36:*.mka=00;36:*.mp3=00;36:*.mpc=00;36:*.ogg=00;36:*.ra=00;36:*.wav=00;36:*.axa=00;36:*.oga=00;36:*.spx=00;36:*.xspf=00;36:"},
                     {"MAKEFLAGS",[]},
                     {"MAKELEVEL","1"},
                     {"MFLAGS",[]},
                     {"OLDPWD","/home/michael"},
                     {"PATH",
                      "/usr/lib/erlang/erts-5.10.3/bin:/usr/lib/erlang/bin:/usr/local/bin:/usr/bin:/bin:/usr/local/games:/usr/games"},
                     {"PFRING","/home/michael/PF_RING/PF_RING/userland/"},
                     {"PROGNAME","erl"},
                     {"PWD","/home/michael/Programming/Erlang/josemic/eNose"},
                     {"ROOTDIR","/usr/lib/erlang"},
                     {"SESSION_MANAGER",
                      "local/donald:@/tmp/.ICE-unix/3773,unix/donald:/tmp/.ICE-unix/3773"},
                     {"SHELL","/bin/bash"},
                     {"SHLVL","1"},
                     {"SSH_AGENT_PID","3817"},
                     {"SSH_AUTH_SOCK","/run/user/1000/keyring-aYAFbZ/ssh"},
                     {"TERM","xterm"},
                     {"USER","michael"},
                     {"USERNAME","michael"},
                     {"VTE_VERSION","3409"},
                     {"WINDOWID","33554438"},
                     {"WINDOWPATH","7"},
                     {"XAUTHORITY",
                      "/var/run/gdm3/auth-for-michael-bvsmrV/database"},
                     {"XDG_DATA_DIRS",
                      "/usr/share/gnome:/usr/local/share/:/usr/share/"},
                     {"XDG_MENU_PREFIX","gnome-"},
                     {"XDG_RUNTIME_DIR","/run/user/1000"},
                     {"XDG_SEAT","seat0"},
                     {"XDG_SESSION_COOKIE",
                      "40079b03ebc630f99c82be5752ab5c08-1387049621.723226-1575137638"},
                     {"XDG_SESSION_ID","2"},
                     {"XDG_VTNR","7"},
                     {"_","/usr/bin/make"}]}]
/usr/bin/ld: cannot find -lpfring
collect2: error: ld returned 1 exit status
ERROR: cc c_src/epcap.o c_src/epcap_priv.o  -lpcap  -L/usr/lib/erlang/lib/erl_interface-3.7.14/lib -lerl_interface -lei -L /home/michael/PF_RING/PF_RING/userland/ -lpfring -lpthread -o priv/epcap failed with error: 1 and output:
/usr/bin/ld: cannot find -lpfring
collect2: error: ld returned 1 exit status

make: *** [compile] Fehler 1

root@donald:/home/michael/PF_RING/PF_RING/userland# ldconfig -p|grep pcap
    libpcap.so.0.8 (libc6,x86-64) => /usr/lib/x86_64-linux-gnu/libpcap.so.0.8
    libpcap.so (libc6,x86-64) => /usr/lib/x86_64-linux-gnu/libpcap.so
@msantos
Owner
msantos commented Dec 14, 2013

libpfring.so doesn't exist in /home/michael/PF_RING/PF_RING/userland, probably.

@ates
Collaborator
ates commented Dec 14, 2013

That problem is fixed.

@josemic
josemic commented Dec 14, 2013

@msantos Thanks.

PFRING=/home/michael/PF_RING/PF_RING/userland/lib/ make all

now works.

@ates:
Correct.

@josemic
josemic commented Dec 14, 2013

However:

PFRING=/usr/local/lib/ make all

fails with the following error:

/usr/local/lib//libpcap.so: undefined reference to `pcap_lex'
collect2: error: ld returned 1 exit status
ERROR: cc c_src/epcap.o c_src/epcap_priv.o  -lpcap  -L/usr/lib/erlang/lib/erl_interface-3.7.14/lib -lerl_interface -lei -L /usr/local/lib/ -lpfring -lpthread -o priv/epcap failed with error: 1 and output:
/usr/local/lib//libpcap.so: undefined reference to `pcap_lex'
collect2: error: ld returned 1 exit status
@msantos
Owner
msantos commented Dec 15, 2013

That's a problem with your PF_RING install. You had the same error when compiling the examples.

@msantos
Owner
msantos commented Dec 15, 2013

I'm referring to the error you reported here:

#14 (comment)

/usr/local/lib//libpcap.so: undefined reference to `pcap_lex'
@josemic
josemic commented Dec 15, 2013

I have put the lessons learned from this issue into the Wiki.
https://github.com/msantos/epcap/wiki/PF_RING

@msantos msantos closed this Feb 2, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment