Linux Netfilter discussions
 help / color / mirror / Atom feed
* Compiling problem with libipq
@ 2002-12-01 19:22 Worik
  0 siblings, 0 replies; 3+ messages in thread
From: Worik @ 2002-12-01 19:22 UTC (permalink / raw)
  To: netfilter

Friends.

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....


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?  

Worik


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Compiling problem with libipq
@ 2002-12-03  0:58 Worik
  2002-12-03  3:30 ` James Morris
  0 siblings, 1 reply; 3+ messages in thread
From: Worik @ 2002-12-03  0:58 UTC (permalink / raw)
  To: netfilter

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


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Compiling problem with libipq
  2002-12-03  0:58 Compiling problem with libipq Worik
@ 2002-12-03  3:30 ` James Morris
  0 siblings, 0 replies; 3+ messages in thread
From: James Morris @ 2002-12-03  3:30 UTC (permalink / raw)
  To: Worik; +Cc: netfilter

On 3 Dec 2002, Worik wrote:

> gcc -g -O0   -DIPT_LIB_DIR=/usr/lib    -lipq  ip_q.o -o ip_q

Try putting -lipq at the end of the end of this line.


-- 
James Morris
<jmorris@intercode.com.au>




^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2002-12-03  3:30 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2002-12-03  0:58 Compiling problem with libipq Worik
2002-12-03  3:30 ` James Morris
  -- strict thread matches above, loose matches on Subject: below --
2002-12-01 19:22 Worik

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox