linux 下编译 ipset-dns

如果你编译出现如下错误:

cc -O2 -pipe -fomit-frame-pointer -march=native -lmnl    ipset-dns.c   -o ipset-dns
ipset-dns.c: In function 'main':
ipset-dns.c:443:28: warning: ignoring return value of 'system', declared with attribute warn_unused_result [-Wunused-result]
/tmp/cccha479.o: In function `main':
ipset-dns.c:(.text.startup+0x78c): undefined reference to `mnl_nlmsg_put_header'
ipset-dns.c:(.text.startup+0x7a8): undefined reference to `mnl_nlmsg_put_extra_header'
ipset-dns.c:(.text.startup+0x7c7): undefined reference to `mnl_attr_put_u8'
ipset-dns.c:(.text.startup+0x7e7): undefined reference to `mnl_attr_put'
ipset-dns.c:(.text.startup+0x7f4): undefined reference to `mnl_attr_nest_start'
ipset-dns.c:(.text.startup+0x804): undefined reference to `mnl_attr_nest_start'
ipset-dns.c:(.text.startup+0x834): undefined reference to `mnl_attr_put'
ipset-dns.c:(.text.startup+0x844): undefined reference to `mnl_attr_nest_end'
ipset-dns.c:(.text.startup+0x84f): undefined reference to `mnl_attr_nest_end'
ipset-dns.c:(.text.startup+0x859): undefined reference to `mnl_socket_open'
ipset-dns.c:(.text.startup+0x86d): undefined reference to `mnl_socket_bind'
ipset-dns.c:(.text.startup+0x87f): undefined reference to `mnl_socket_sendto'
ipset-dns.c:(.text.startup+0x88c): undefined reference to `mnl_socket_close'
ipset-dns.c:(.text.startup+0x8ad): undefined reference to `mnl_socket_close'
collect2: error: ld returned 1 exit status
make: *** [ipset-dns] Error 1

 

只需在Makefile 第一行加入:

LDLIBS= -l mnl

linux 下编译 ipset-dns》有3个想法

发表评论

您的电子邮箱地址不会被公开。 必填项已用*标注

此站点使用Akismet来减少垃圾评论。了解我们如何处理您的评论数据