Linux Netfilter discussions
 help / color / mirror / Atom feed
* Linking error using libnetfilter_queue on FC8
@ 2007-11-29 23:44 Damian Hites
  2007-12-01 11:18 ` Eric Leblond
  0 siblings, 1 reply; 3+ messages in thread
From: Damian Hites @ 2007-11-29 23:44 UTC (permalink / raw)
  To: netfilter

Sorry to repost this....but I have only gotten one response and it
wasn't really helpful at all.
I really have no idea what else to try.  It should be said that I
successfully install libnetfilter_queue and it compiles (the version
off the netfilter.org websit).  Even the example works fine, it's just
when I try to use the libraries in my own program.  I don't know if
there are more aspects to the Makefile that I'm missing, but I don't
know what it would be and why it would be needed.

I keep getting this errror.  I installed libnetfilter_queue and
libnetfilter_conntrack using yum.  The shared libraries are in the
right places (/usr/lib/ and /usr/lib64/) and I'm using the -l options
(-lnfnetlink -lnetfilter_queue).  Not sure why it's not working.  Here
is the output:

g++ -g -Wall -c test.cpp -o test.o
g++ test.o -lnfnetlink -lnetfilter_queue -o test
test.o: In function `main':
test.cpp:65: undefined reference to `nfq_open()'
test.cpp:72: undefined reference to `nfq_unbind_pf(nfq_handle*, unsigned short)'
test.cpp:78: undefined reference to `nfq_bind_pf(nfq_handle*, unsigned short)'
test.cpp:84: undefined reference to `nfq_create_queue(nfq_handle*,
unsigned short, int (*)(nfq_q_handle*, nfgenmsg*, nfq_data*, void*),
void*)'
test.cpp:91: undefined reference to `nfq_set_mode(nfq_q_handle*,
unsigned char, unsigned int)'
test.cpp:97: undefined reference to
`nfq_set_queue_maxlen(nfq_q_handle*, unsigned int)'
test.cpp:103: undefined reference to `nfq_nfnlh(nfq_handle*)'
test.cpp:104: undefined reference to `nfnl_fd(nfnl_handle*)'
test.cpp:108: undefined reference to `nfq_handle_packet(nfq_handle*,
char*, int)'
test.cpp:112: undefined reference to `nfq_destroy_queue(nfq_q_handle*)'
test.cpp:115: undefined reference to `nfq_close(nfq_handle*)'
test.o: In function `print_pkt':
test.cpp:18: undefined reference to `nfq_get_msg_packet_hdr(nfq_data*)'
test.cpp:25: undefined reference to `nfq_get_nfmark(nfq_data*)'
test.cpp:29: undefined reference to `nfq_get_indev(nfq_data*)'
test.cpp:33: undefined reference to `nfq_get_outdev(nfq_data*)'
test.cpp:37: undefined reference to `nfq_get_payload(nfq_data*, char**)'
test.o: In function `cb':
test.cpp:52: undefined reference to `nfq_set_verdict(nfq_q_handle*,
unsigned int, unsigned int, unsigned int, unsigned char*)'
collect2: ld returned 1 exit status
make: *** [test] Error 1

Here is my simplistic Makefile:
LDOPTS =
LIBS = -lnfnetlink -lnetfilter_queue
INCDIR =
CXXFLAGS= -g -Wall#$(INCDIR)
sources := $(wildcard *.cpp) $(wildcard *.c)
objs := $(sources)
objs := $(objs:.c=.o)
objs := $(objs:.cpp=.o)
all: test
clean:
   rm -f $(objs) test
test: $(objs)
   $(CXX) $^ $(LDOPTS) $(LIBS) -o $@
.c.o:
   $(CC) $(CXXFLAGS) -c $< -o $@
.cpp.o:
   $(CXX) $(CXXFLAGS) -c $< -o $@

Can anybody point me in the right direction?  Don't know why it
doesn't want to link.

^ permalink raw reply	[flat|nested] 3+ messages in thread
* Linking error using libnetfilter_queue on FC8
@ 2007-11-29  4:16 Damian Hites
  0 siblings, 0 replies; 3+ messages in thread
From: Damian Hites @ 2007-11-29  4:16 UTC (permalink / raw)
  To: netfilter

I keep getting this errror.  I installed libnetfilter_queue and
libnetfilter_conntrack using yum.  The shared libraries are in the
right places (/usr/lib/ and /usr/lib64/) and I'm using the -l options
(-lnfnetlink -lnetfilter_queue).  Not sure why it's not working.  Here
is the output:

g++ -g -Wall -c test.cpp -o test.o
g++  -lnfnetlink -lnetfilter_queue test.o -o test
test.o: In function `main':
test.cpp:65: undefined reference to `nfq_open()'
test.cpp:72: undefined reference to `nfq_unbind_pf(nfq_handle*, unsigned short)'
test.cpp:78: undefined reference to `nfq_bind_pf(nfq_handle*, unsigned short)'
test.cpp:84: undefined reference to `nfq_create_queue(nfq_handle*,
unsigned short, int (*)(nfq_q_handle*, nfgenmsg*, nfq_data*, void*),
void*)'
test.cpp:91: undefined reference to `nfq_set_mode(nfq_q_handle*,
unsigned char, unsigned int)'
test.cpp:97: undefined reference to
`nfq_set_queue_maxlen(nfq_q_handle*, unsigned int)'
test.cpp:103: undefined reference to `nfq_nfnlh(nfq_handle*)'
test.cpp:104: undefined reference to `nfnl_fd(nfnl_handle*)'
test.cpp:108: undefined reference to `nfq_handle_packet(nfq_handle*,
char*, int)'
test.cpp:112: undefined reference to `nfq_destroy_queue(nfq_q_handle*)'
test.cpp:115: undefined reference to `nfq_close(nfq_handle*)'
test.o: In function `print_pkt':
test.cpp:18: undefined reference to `nfq_get_msg_packet_hdr(nfq_data*)'
test.cpp:25: undefined reference to `nfq_get_nfmark(nfq_data*)'
test.cpp:29: undefined reference to `nfq_get_indev(nfq_data*)'
test.cpp:33: undefined reference to `nfq_get_outdev(nfq_data*)'
test.cpp:37: undefined reference to `nfq_get_payload(nfq_data*, char**)'
test.o: In function `cb':
test.cpp:52: undefined reference to `nfq_set_verdict(nfq_q_handle*,
unsigned int, unsigned int, unsigned int, unsigned char*)'
collect2: ld returned 1 exit status
make: *** [test] Error 1


Here is my simplistic Makefile:
LDOPTS =

LIBS = -lnfnetlink -lnetfilter_queue

INCDIR =

CXXFLAGS= -g -Wall#$(INCDIR)

sources := $(wildcard *.cpp) $(wildcard *.c)

objs := $(sources)
objs := $(objs:.c=.o)
objs := $(objs:.cpp=.o)

all: test

clean:
    rm -f $(objs) test

test: $(objs)
    $(CXX) $(LDOPTS) $(LIBS) $^ -o $@

.c.o:
    $(CC) $(CXXFLAGS) -c $< -o $@

.cpp.o:
    $(CXX) $(CXXFLAGS) -c $< -o $@

Can anybody point me in the right direction?  Don't know why it
doesn't want to link.

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

end of thread, other threads:[~2007-12-01 11:18 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-11-29 23:44 Linking error using libnetfilter_queue on FC8 Damian Hites
2007-12-01 11:18 ` Eric Leblond
  -- strict thread matches above, loose matches on Subject: below --
2007-11-29  4:16 Damian Hites

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