Menu

error on install

Help
JayMill
2011-01-23
2018-08-16
  • JayMill

    JayMill - 2011-01-23

    Here is what happens when I run the makefile

    bobo@bobo-laptop:~/Downloads/hexinject$ sudo make
    gcc -o hexinject hexinject.c -lpcap
    In file included from hexinject.c:8:
    hexinject.h:11:18: error: pcap.h: No such file or directory
    hexinject.c:325: error: expected ) before * token
    hexinject.c:350: error: expected ) before * token
    hexinject.c:369: error: expected ) before * token
    hexinject.c:391: error: expected ) before * token
    hexinject.c: In function main’:
    hexinject.c:412: error: pcap_t undeclared (first use in this function)
    hexinject.c:412: error: (Each undeclared identifier is reported only once
    hexinject.c:412: error: for each function it appears in.)
    hexinject.c:412: error: fp undeclared (first use in this function)
    hexinject.c:413: error: storage size of bpf isnt known
    hexinject.c:414: error: PCAP_ERRBUF_SIZE undeclared (first use in this function)
    make: *** [all] Error 1
    bobo@bobo-laptop:~/Downloads/hexinject$ ls
    argparser.h  hexdump.h  hexinject.c  hexinject.h  Makefile  pcap.h
    
     
  • JayMill

    JayMill - 2011-01-23

    I'm dumb

    sudo apt-get install libpcap-dev
    
     
  • JoFTA

    JoFTA - 2018-08-16

    I am having a similar trouble:

    # make
    gcc -Wall -lpcap -o hexinject hexinject.c
    /tmp/ccYufKqX.o: In function `inject_raw':
    hexinject.c:(.text+0x28b4): undefined reference to `pcap_sendpacket'
    /tmp/ccYufKqX.o: In function `sniff_hexstr':
    hexinject.c:(.text+0x2a05): undefined reference to `pcap_next'
    /tmp/ccYufKqX.o: In function `sniff_raw':
    hexinject.c:(.text+0x2ace): undefined reference to `pcap_next'
    /tmp/ccYufKqX.o: In function `inject_hexstr_loop':
    hexinject.c:(.text+0x2df7): undefined reference to `pcap_geterr'
    /tmp/ccYufKqX.o: In function `inject_raw_loop':
    hexinject.c:(.text+0x2edd): undefined reference to `pcap_geterr'
    /tmp/ccYufKqX.o: In function `main':
    hexinject.c:(.text+0x3124): undefined reference to `pcap_findalldevs'
    hexinject.c:(.text+0x3202): undefined reference to `pcap_lookupdev'
    hexinject.c:(.text+0x3266): undefined reference to `pcap_create'
    hexinject.c:(.text+0x32b7): undefined reference to `pcap_set_snaplen'
    hexinject.c:(.text+0x32fc): undefined reference to `pcap_set_promisc'
    hexinject.c:(.text+0x333e): undefined reference to `pcap_set_timeout'
    hexinject.c:(.text+0x3389): undefined reference to `pcap_can_set_rfmon'
    hexinject.c:(.text+0x33cd): undefined reference to `pcap_set_rfmon'
    hexinject.c:(.text+0x3415): undefined reference to `pcap_activate'
    hexinject.c:(.text+0x342c): undefined reference to `pcap_geterr'
    hexinject.c:(.text+0x346d): undefined reference to `pcap_open_offline'
    hexinject.c:(.text+0x34e2): undefined reference to `pcap_compile'
    hexinject.c:(.text+0x34f5): undefined reference to `pcap_geterr'
    hexinject.c:(.text+0x3536): undefined reference to `pcap_setfilter'
    hexinject.c:(.text+0x3549): undefined reference to `pcap_geterr'
    hexinject.c:(.text+0x3651): undefined reference to `pcap_close'
    collect2: error: ld returned 1 exit status
    Makefile:6: recipe for target 'all' failed
    make: *** [all] Error 1
    

    Ubuntu 18.04.1 LTS
    libpcap-dev, tcl, gcc present

    Any clue how to make it compile?

    Thanks!

     

    Last edit: JoFTA 2018-08-16
  • JoFTA

    JoFTA - 2018-08-16

    SOLVED by moving the -lpcap param to the EOL, i.e.:

    gcc -Wall -o hexinject hexinject.c -lpcap
    gcc -Wall -o prettypacket prettypacket.c -lpcap
    gcc -Wall -o hex2raw hex2raw.c -lpcap

    Hope that helps others having the same problem.

     

Log in to post a comment.