Giter Site home page Giter Site logo

libpcap build error about tcpkit HOT 8 CLOSED

git-hulk avatar git-hulk commented on May 26, 2024
libpcap build error

from tcpkit.

Comments (8)

git-hulk avatar git-hulk commented on May 26, 2024

@markuman put -lnl or -lnl-3 to https://github.com/git-hulk/tcpkit/blob/master/src/Makefile#L5 , if failed with missing nl library, try install libnl-dev or libnl3-dev

from tcpkit.

markuman avatar markuman commented on May 26, 2024

thx for the fast reply.

core/libnl 3.4.0-1 [installed] was already installed

but unfortunately

diff --git a/src/Makefile b/src/Makefile
index b652517..5eb2089 100644
--- a/src/Makefile
+++ b/src/Makefile
@@ -2,7 +2,7 @@ CC = gcc
 CFLAGS = -g -Wall
 CINCLUDES = -I../deps/libpcap/ -I../deps/lua/src
 CLIBS = ../deps/libpcap/libpcap.a ../deps/lua/src/liblua.a
-LOAD_LIBS=-lm -ldl -lpthread
+LOAD_LIBS=-lm -lnl-3 -ldl -lpthread
 
 INSTALL=/usr/bin/install
 INSTALLDIR=/usr/local

doesn't solve the problem

gcc -g -Wall -o tcpkit util.o array.o hashtable.o logger.o packet.o redis.o server.o sniffer.o stats.o tcpkit.o vm.o -I../deps/libpcap/ -I../deps/lua/src ../deps/libpcap/libpcap.a ../deps/lua/src/liblua.a -lm -lnl-3 -ldl -lpthread
/usr/bin/ld: ../deps/lua/src/liblua.a(loslib.o): in function `os_tmpname':
/tmp/tcpkit/deps/lua/src/loslib.c:107: warning: the use of `tmpnam' is dangerous, better use `mkstemp'
/usr/bin/ld: ../deps/libpcap/libpcap.a(pcap-linux.o): in function `nl80211_init':
/tmp/tcpkit/deps/libpcap/./pcap-linux.c:681: undefined reference to `genl_connect'
/usr/bin/ld: /tmp/tcpkit/deps/libpcap/./pcap-linux.c:687: undefined reference to `genl_ctrl_alloc_cache'
/usr/bin/ld: /tmp/tcpkit/deps/libpcap/./pcap-linux.c:695: undefined reference to `genl_ctrl_search_by_name'
/usr/bin/ld: ../deps/libpcap/libpcap.a(pcap-linux.o): in function `nl80211_cleanup':
/tmp/tcpkit/deps/libpcap/./pcap-linux.c:714: undefined reference to `genl_family_put'
/usr/bin/ld: ../deps/libpcap/libpcap.a(pcap-linux.o): in function `del_mon_if':
/tmp/tcpkit/deps/libpcap/./pcap-linux.c:853: undefined reference to `genl_family_get_id'
/usr/bin/ld: /tmp/tcpkit/deps/libpcap/./pcap-linux.c:853: undefined reference to `genlmsg_put'
/usr/bin/ld: ../deps/libpcap/libpcap.a(pcap-linux.o): in function `add_mon_if':
/tmp/tcpkit/deps/libpcap/./pcap-linux.c:743: undefined reference to `genl_family_get_id'
/usr/bin/ld: /tmp/tcpkit/deps/libpcap/./pcap-linux.c:743: undefined reference to `genlmsg_put'
collect2: error: ld returned 1 exit status
make[1]: *** [Makefile:24: tcpkit] Error 1
make[1]: Leaving directory '/tmp/tcpkit/src'
make: *** [Makefile:4: all] Error 2

from tcpkit.

markuman avatar markuman commented on May 26, 2024

using community/libnl1 1.1.4-2 [installed]

diff --git a/src/Makefile b/src/Makefile
index b652517..d6915b9 100644
--- a/src/Makefile
+++ b/src/Makefile
@@ -2,7 +2,7 @@ CC = gcc
 CFLAGS = -g -Wall
 CINCLUDES = -I../deps/libpcap/ -I../deps/lua/src
 CLIBS = ../deps/libpcap/libpcap.a ../deps/lua/src/liblua.a
-LOAD_LIBS=-lm -ldl -lpthread
+LOAD_LIBS=-lm -lnl -ldl -lpthread
 
 INSTALL=/usr/bin/install
 INSTALLDIR=/usr/local

failed too, but with a different error message

gcc -g -Wall -o tcpkit util.o array.o hashtable.o logger.o packet.o redis.o server.o sniffer.o stats.o tcpkit.o vm.o -I../deps/libpcap/ -I../deps/lua/src ../deps/libpcap/libpcap.a ../deps/lua/src/liblua.a -lm -lnl -ldl -lpthread
/usr/bin/ld: ../deps/lua/src/liblua.a(loslib.o): in function `os_tmpname':
/tmp/tcpkit/deps/lua/src/loslib.c:107: warning: the use of `tmpnam' is dangerous, better use `mkstemp'
/usr/bin/ld: ../deps/libpcap/libpcap.a(pcap-linux.o): in function `nl80211_init':
/tmp/tcpkit/deps/libpcap/./pcap-linux.c:674: undefined reference to `nl_socket_alloc'
/usr/bin/ld: /tmp/tcpkit/deps/libpcap/./pcap-linux.c:707: undefined reference to `nl_socket_free'
/usr/bin/ld: ../deps/libpcap/libpcap.a(pcap-linux.o): in function `nl80211_cleanup':
/tmp/tcpkit/deps/libpcap/./pcap-linux.c:716: undefined reference to `nl_socket_free'
collect2: error: ld returned 1 exit status
make[1]: *** [Makefile:24: tcpkit] Error 1
make[1]: Leaving directory '/tmp/tcpkit/src'
make: *** [Makefile:4: all] Error 2

from tcpkit.

git-hulk avatar git-hulk commented on May 26, 2024

@markuman which platform you are running? try to find and install libnl-genl-3-dev

from tcpkit.

markuman avatar markuman commented on May 26, 2024

Arch Linux

from tcpkit.

git-hulk avatar git-hulk commented on May 26, 2024

@markuman hi, sorry for the delay so long, I eventually reproduce and fixed it now

from tcpkit.

markuman avatar markuman commented on May 26, 2024

@git-hulk thx

now the build is fine without errors. there are just some deprecated notifications

sniffer.c:91:5: warning: 'pcap_lookupdev' is deprecated: use 'pcap_findalldevs' and use the first device [-Wdeprecated-declarations]

and warnings left

/home/m/git/tcpkit/deps/lua/src/loslib.c:107: warning: the use of `tmpnam' is dangerous, better use `mkstemp'

from tcpkit.

git-hulk avatar git-hulk commented on May 26, 2024

@markuman the warning does not affect, I would fix it later. Thanks for your patience, close this issue now.

from tcpkit.

Related Issues (11)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.