All of lore.kernel.org
 help / color / mirror / Atom feed
* Link time problems with libipq example code
@ 2002-12-20 22:44 Craig Davison
  2002-12-20 23:01 ` Craig Davison
  2002-12-21  5:29 ` Narendra Prabhu. B
  0 siblings, 2 replies; 5+ messages in thread
From: Craig Davison @ 2002-12-20 22:44 UTC (permalink / raw)
  To: netfilter

Hello,
I've been trying to compile the libipq example code in the libipq man page.

My kernel is 2.4.18, distributed by RedHat as 2.4.18-14. I made a symlink to the kernel source at /usr/src/linux.
I built ipchains 1.2.7a as follows:
make
su
make install-devel

I copied the code from the man page into a file called ipqtst.c and compiled:
gcc -I/usr/local/include -L/usr/local/lib -lipq -o ipqtst ipqtst.c
/tmp/ccGDqSOi.o: In function `die':
/tmp/ccGDqSOi.o(.text+0xf): undefined reference to `ipq_perror'
/tmp/ccGDqSOi.o(.text+0x1d): undefined reference to `ipq_destroy_handle'
/tmp/ccGDqSOi.o: In function `main':
/tmp/ccGDqSOi.o(.text+0x49): undefined reference to `ipq_create_handle'
/tmp/ccGDqSOi.o(.text+0x81): undefined reference to `ipq_set_mode'
/tmp/ccGDqSOi.o(.text+0xb8): undefined reference to `ipq_read'
/tmp/ccGDqSOi.o(.text+0xe4): undefined reference to `ipq_message_type'
/tmp/ccGDqSOi.o(.text+0x116): undefined reference to `ipq_get_msgerr'
/tmp/ccGDqSOi.o(.text+0x141): undefined reference to `ipq_get_packet'
/tmp/ccGDqSOi.o(.text+0x166): undefined reference to `ipq_set_verdict'
collect2: ld returned 1 exit status

I get the same errors when I compile statically:
gcc -static -I/usr/local/include -L/usr/local/lib -lipq -o ipqtst ipqtst.c

Is libipq not the right thing to link against? Am I doing something else wrong (did I build ipchains incorrectly?)

-- 
Craig Davison
Symantec Corporation
+1 (403) 213-3939 ext. 228


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

* Re: Link time problems with libipq example code
  2002-12-20 22:44 Link time problems with libipq example code Craig Davison
@ 2002-12-20 23:01 ` Craig Davison
  2002-12-21  5:29 ` Narendra Prabhu. B
  1 sibling, 0 replies; 5+ messages in thread
From: Craig Davison @ 2002-12-20 23:01 UTC (permalink / raw)
  To: netfilter

Here's the output from nm:
nm /usr/local/lib/libipq.a

libipq.o:
         U bind
         U close
         U __errno_location
         U fprintf
         U fputc
         U fputs
         U free
         U fwrite
         U getpid
00000224 T ipq_create_handle
000004a4 T ipq_ctl
00000334 T ipq_destroy_handle
00000000 D ipq_errmap
00000088 d ipq_errno
000004b0 T ipq_errstr
000003c4 T ipq_get_msgerr
000003d4 T ipq_get_packet
000003b8 T ipq_message_type
00000060 t ipq_netlink_recvfrom
00000034 t ipq_netlink_sendmsg
00000000 t ipq_netlink_sendto
000004c4 T ipq_perror
000003ac T ipq_read
0000035c T ipq_set_mode
000003e0 T ipq_set_verdict
00000208 t ipq_strerror
         U malloc
         U recvfrom
         U select
         U sendmsg
         U sendto
         U socket
         U stderr
         U strerror

On Fri, Dec 20, 2002 at 03:44:05PM -0700, Craig Davison wrote:
> I've been trying to compile the libipq example code in the libipq man page.

-- 
Craig Davison
Symantec Corporation
+1 (403) 213-3939 ext. 228


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

* Re: Link time problems with libipq example code
  2002-12-20 22:44 Link time problems with libipq example code Craig Davison
  2002-12-20 23:01 ` Craig Davison
@ 2002-12-21  5:29 ` Narendra Prabhu. B
  2002-12-23 18:07   ` Craig Davison
  2002-12-23 19:05   ` Ranjeet Shetye
  1 sibling, 2 replies; 5+ messages in thread
From: Narendra Prabhu. B @ 2002-12-21  5:29 UTC (permalink / raw)
  To: Craig Davison; +Cc: netfilter@lists.netfilter.org

Hi,

Yes, even I have come across such problems.... I just complied it using
the following command.

$gcc -I/usr/local/include -L/usr/local/lib -o ipqtst ipqtst.c -lipq

Just notice that I have put "-lipq" in the end... Well, I have not been
able to reason, why it works this way. Its probably the gcc issue.

Hope this helps.

Bye,
Narendra.


On Fri, 20 Dec 2002, Craig Davison wrote:
> Hello,
> I've been trying to compile the libipq example code in the libipq man page.
>
> My kernel is 2.4.18, distributed by RedHat as 2.4.18-14. I made a symlink to the kernel source at /usr/src/linux.
> I built ipchains 1.2.7a as follows:
> make
> su
> make install-devel
>
> I copied the code from the man page into a file called ipqtst.c and compiled:
> gcc -I/usr/local/include -L/usr/local/lib -lipq -o ipqtst ipqtst.c
> /tmp/ccGDqSOi.o: In function `die':
> /tmp/ccGDqSOi.o(.text+0xf): undefined reference to `ipq_perror'
> /tmp/ccGDqSOi.o(.text+0x1d): undefined reference to `ipq_destroy_handle'
> /tmp/ccGDqSOi.o: In function `main':
> /tmp/ccGDqSOi.o(.text+0x49): undefined reference to `ipq_create_handle'
> /tmp/ccGDqSOi.o(.text+0x81): undefined reference to `ipq_set_mode'
> /tmp/ccGDqSOi.o(.text+0xb8): undefined reference to `ipq_read'
> /tmp/ccGDqSOi.o(.text+0xe4): undefined reference to `ipq_message_type'
> /tmp/ccGDqSOi.o(.text+0x116): undefined reference to `ipq_get_msgerr'
> /tmp/ccGDqSOi.o(.text+0x141): undefined reference to `ipq_get_packet'
> /tmp/ccGDqSOi.o(.text+0x166): undefined reference to `ipq_set_verdict'
> collect2: ld returned 1 exit status
>
> I get the same errors when I compile statically:
> gcc -static -I/usr/local/include -L/usr/local/lib -lipq -o ipqtst ipqtst.c
>
> Is libipq not the right thing to link against? Am I doing something else wrong (did I build ipchains incorrectly?)
>
> --
> Craig Davison
> Symantec Corporation
> +1 (403) 213-3939 ext. 228
>
>

In the middle of difficulty..... lies Opportunity. (Albert Einstein)
--------------------------------------------------------------------
Narendra Prabhu. B             Free Software at its product-ive best.
DeepRoot Linux                             http://www.deeproot.co.in
                ---- Server Appliances ----
             ---- Linux Support and Services ----
-------------------------------------------------------------------




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

* Re: Link time problems with libipq example code
  2002-12-21  5:29 ` Narendra Prabhu. B
@ 2002-12-23 18:07   ` Craig Davison
  2002-12-23 19:05   ` Ranjeet Shetye
  1 sibling, 0 replies; 5+ messages in thread
From: Craig Davison @ 2002-12-23 18:07 UTC (permalink / raw)
  To: Narendra Prabhu. B; +Cc: netfilter@lists.netfilter.org

That did it - thanks!

-- 
Craig Davison
Symantec Corporation
+1 (403) 213-3939 ext. 228

On Sat, Dec 21, 2002 at 10:59:43AM +0530, Narendra Prabhu. B wrote:
> Hi,
> 
> Yes, even I have come across such problems.... I just complied it using
> the following command.
> 
> $gcc -I/usr/local/include -L/usr/local/lib -o ipqtst ipqtst.c -lipq
> 
> Just notice that I have put "-lipq" in the end... Well, I have not been
> able to reason, why it works this way. Its probably the gcc issue.



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

* RE: Link time problems with libipq example code
  2002-12-21  5:29 ` Narendra Prabhu. B
  2002-12-23 18:07   ` Craig Davison
@ 2002-12-23 19:05   ` Ranjeet Shetye
  1 sibling, 0 replies; 5+ messages in thread
From: Ranjeet Shetye @ 2002-12-23 19:05 UTC (permalink / raw)
  To: netfilter


Hi Narendra,

The behaviour you are observing is related to the way gcc resolves
sumbols while compiling code.

http://webclub.kcom.ne.jp/ma/colinp/win32/tools/link.html

"
gcc checks libraries in the order they appear, and it will only resolve
references to symbols in libraries earlier on the command line if the
object containing the symbol definition was already included for some
other reason. Thus if foo.o uses a function in libstuff.a the following
command line will fail:

gcc -o foobar.exe -lstuff foo.o bar.o
"

Which is what you guys are running into.

Ranjeet Shetye
Senior Software Engineer
Zultys Technologies
771 Vaqueros Avenue
Sunnyvale  CA  94085
USA
Ranjeet.Shetye@Zultys.com
http://www.zultys.com/

 


> -----Original Message-----
> From: netfilter-admin@lists.netfilter.org 
> [mailto:netfilter-admin@lists.netfilter.org] On Behalf Of 
> Narendra Prabhu. B
> Sent: Friday, December 20, 2002 9:30 PM
> To: Craig Davison
> Cc: netfilter@lists.netfilter.org
> Subject: Re: Link time problems with libipq example code
> 
> 
> Hi,
> 
> Yes, even I have come across such problems.... I just 
> complied it using the following command.
> 
> $gcc -I/usr/local/include -L/usr/local/lib -o ipqtst ipqtst.c -lipq
> 
> Just notice that I have put "-lipq" in the end... Well, I 
> have not been able to reason, why it works this way. Its 
> probably the gcc issue.
> 
> Hope this helps.
> 
> Bye,
> Narendra.
> 
> 
> On Fri, 20 Dec 2002, Craig Davison wrote:
> > Hello,
> > I've been trying to compile the libipq example code in the 
> libipq man 
> > page.
> >
> > My kernel is 2.4.18, distributed by RedHat as 2.4.18-14. I made a 
> > symlink to the kernel source at /usr/src/linux. I built ipchains 
> > 1.2.7a as follows: make su
> > make install-devel
> >
> > I copied the code from the man page into a file called ipqtst.c and 
> > compiled: gcc -I/usr/local/include -L/usr/local/lib -lipq -o ipqtst 
> > ipqtst.c
> > /tmp/ccGDqSOi.o: In function `die':
> > /tmp/ccGDqSOi.o(.text+0xf): undefined reference to `ipq_perror'
> > /tmp/ccGDqSOi.o(.text+0x1d): undefined reference to 
> `ipq_destroy_handle'
> > /tmp/ccGDqSOi.o: In function `main':
> > /tmp/ccGDqSOi.o(.text+0x49): undefined reference to 
> `ipq_create_handle'
> > /tmp/ccGDqSOi.o(.text+0x81): undefined reference to `ipq_set_mode'
> > /tmp/ccGDqSOi.o(.text+0xb8): undefined reference to `ipq_read'
> > /tmp/ccGDqSOi.o(.text+0xe4): undefined reference to 
> `ipq_message_type'
> > /tmp/ccGDqSOi.o(.text+0x116): undefined reference to 
> `ipq_get_msgerr'
> > /tmp/ccGDqSOi.o(.text+0x141): undefined reference to 
> `ipq_get_packet'
> > /tmp/ccGDqSOi.o(.text+0x166): undefined reference to 
> `ipq_set_verdict'
> > collect2: ld returned 1 exit status
> >
> > I get the same errors when I compile statically:
> > gcc -static -I/usr/local/include -L/usr/local/lib -lipq -o ipqtst 
> > ipqtst.c
> >
> > Is libipq not the right thing to link against? Am I doing something 
> > else wrong (did I build ipchains incorrectly?)
> >
> > --
> > Craig Davison
> > Symantec Corporation
> > +1 (403) 213-3939 ext. 228
> >
> >
> 
> In the middle of difficulty..... lies Opportunity. (Albert Einstein)
> --------------------------------------------------------------------
> Narendra Prabhu. B             Free Software at its product-ive best.
> DeepRoot Linux                             http://www.deeproot.co.in
>                 ---- Server Appliances ----
>              ---- Linux Support and Services ----
> -------------------------------------------------------------------
> 
> 
> 



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

end of thread, other threads:[~2002-12-23 19:05 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2002-12-20 22:44 Link time problems with libipq example code Craig Davison
2002-12-20 23:01 ` Craig Davison
2002-12-21  5:29 ` Narendra Prabhu. B
2002-12-23 18:07   ` Craig Davison
2002-12-23 19:05   ` Ranjeet Shetye

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.