From: Worik <worik@noggon.co.nz>
To: netfilter@lists.netfilter.org
Subject: Compiling problem with libipq
Date: 03 Dec 2002 13:58:24 +1300 [thread overview]
Message-ID: <1038877105.16909.21.camel@stolberg> (raw)
Friends.
I hope this is the correct list
This is very frustrating and I am sure there is a simple solution...
The code...
#include <linux/netfilter.h>
#include <libipq/libipq.h>
struct ipq_handle * ph_ipq = 0;
int
main(int argc, char * argv[]){
ph_ipq = ipq_create_handle(0, PF_INET);
return 0;
}
Compiling....
make -k
gcc -g -O0 -DIPT_LIB_DIR=/usr/lib -c ip_q_test.c -o ip_q.o
gcc -g -O0 -DIPT_LIB_DIR=/usr/lib -lipq ip_q.o -o ip_q
ip_q.o: In function `main':
/home/worik/Projects/project12/ip_q_test.c:6: undefined reference to
`ipq_create_handle'
Oh dear! Use the -shared flag (?)
gcc -g -O0 -DIPT_LIB_DIR=/usr/lib -fpic -shared -c ip_q_test.c -o
ip_q.o
gcc -g -O0 -DIPT_LIB_DIR=/usr/lib -fpic -shared -lipq ip_q.o -o
ip_q
Running....
This GDB was configured as "i386-linux"...
(gdb) b main
Breakpoint 1 at 0x773: file ip_q_test.c, line 6.
(gdb) r
Starting program: /home/worik/Projects/project12/ip_q
Breakpoint 1 at 0x80000773: file ip_q_test.c, line 6.
Program received signal SIGSEGV, Segmentation fault.
0x00000001 in ?? ()
(gdb)
What have I done wrong? Clearly there is a problem with libraries,
probably libipq.
So check for it...
nm /usr/lib/libipq.a|grep ipq_create_handle
00000218 T ipq_create_handle
I do not know enough about nm to be sure, but I think this is OK.
I am using debian woody with the packages iptables and iptables-dev
installed. Version 1.2.6a-5
Worik
next reply other threads:[~2002-12-03 0:58 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2002-12-03 0:58 Worik [this message]
2002-12-03 3:30 ` Compiling problem with libipq James Morris
-- strict thread matches above, loose matches on Subject: below --
2002-12-01 19:22 Worik
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1038877105.16909.21.camel@stolberg \
--to=worik@noggon.co.nz \
--cc=netfilter@lists.netfilter.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox