[openbeosnetteam] Re: Netkit stuff

  • From: "Philippe Houdoin" <philippe.houdoin@xxxxxxx>
  • To: ThePhantom@xxxxxxx, openbeosnetteam@xxxxxxxxxxxxx
  • Date: Fri, 1 Nov 2002 01:53:03 +0100 (added by postmaster@wanadoo.fr)

Hi again Scott,

> > However, then the link stage failed due to duplicate rtstat & 
rt_table
> > symbols in NetAddress.o and NetBuffer.o. That's where my mean 
skills decide
> > to leave my brain, and all what I could do about this last error 
was:
> > Hum?!?
> 
> "Hum" is right, I don't understand either.  That's a bizarre error.  
I'll take 
> a peek at the code tonight when I get home to see if I can make any 
sense out 
> of it.  In the meantime I've cc'ed Michael to see if he has any 
insights into 
> this library compilation error.
> 

Okay, my skills come back after some coffees and teas, and I find out 
errors origin.
What I get:

---8<-----------------
$ pwd
/boot/home/projects/openbeos
$ cd current/src/kits/net/libnetapi/
$ jam
..found 113 target(s)...
..updating 3 target(s)...
C++ ../../../../objects/x86.R1/kits/net/libnetapi/NetAddress.o
C++ ../../../../objects/x86.R1/kits/net/libnetapi/NetBuffer.o
Link ../../../../distro/x86.R1/beos/system/lib/libnetapi.so
./../../../objects/x86.R1/kits/net/libnetapi/NetBuffer.o(.bss+0x0): 
multiple definition of `rtstat'
./../../../objects/x86.R1/kits/net/libnetapi/NetAddress.o(.bss+0x0): 
first defined here
./../../../objects/x86.R1/kits/net/libnetapi/NetBuffer.o(.bss+0x20): 
multiple definition of `rt_tables'
./../../../objects/x86.R1/kits/net/libnetapi/NetAddress.o(.bss+0x20): 
first defined here
./../../../objects/x86.R1/kits/net/libnetapi/NetAddress.o: In function 
`BNetAddress::GetAddr(char *, unsigned short *) const':
./../../../objects/x86.R1/kits/net/libnetapi/NetAddress.o(.text+
0x582): undefined reference to `__swap_int16(unsigned short)'
./../../../objects/x86.R1/kits/net/libnetapi/NetAddress.o: In function 
`BNetAddress::SetTo(char const *, unsigned short)':
./../../../objects/x86.R1/kits/net/libnetapi/NetAddress.o(.text+
0x7f9): undefined reference to `__swap_int16(unsigned short)'
./../../../objects/x86.R1/kits/net/libnetapi/NetAddress.o(.text+
0x80a): undefined reference to `__swap_int32(unsigned long)'
./../../../objects/x86.R1/kits/net/libnetapi/NetAddress.o: In function 
`BNetAddress::SetTo(sockaddr_in const &)':
./../../../objects/x86.R1/kits/net/libnetapi/NetAddress.o(.text+
0x848): undefined reference to `__swap_int16(unsigned short)'
./../../../objects/x86.R1/kits/net/libnetapi/NetAddress.o(.text+
0x859): undefined reference to `__swap_int32(unsigned long)'
./../../../objects/x86.R1/kits/net/libnetapi/NetAddress.o: In function 
`BNetAddress::SetTo(in_addr, int)':
./../../../objects/x86.R1/kits/net/libnetapi/NetAddress.o(.text+
0x893): undefined reference to `__swap_int16(unsigned short)'
./../../../objects/x86.R1/kits/net/libnetapi/NetAddress.o(.text+
0x8a1): undefined reference to `__swap_int32(unsigned long)'
./../../../objects/x86.R1/kits/net/libnetapi/NetAddress.o: In function 
`BNetAddress::SetTo(unsigned long, int)':
./../../../objects/x86.R1/kits/net/libnetapi/NetAddress.o(.text+
0x8db): undefined reference to `__swap_int16(unsigned short)'
./../../../objects/x86.R1/kits/net/libnetapi/NetAddress.o(.text+
0x8e9): undefined reference to `__swap_int32(unsigned long)'
collect2: ld returned 1 exit status

        gcc  -nostart -Xlinker -soname="libnetapi.so"  -o "../../../../
distro/x86.R1/beos/system/lib/libnetapi.so"   "../../../../objects/
x86.R1/kits/net/libnetapi/NetAddress.o" "../../../../objects/x86.R1/
kits/net/libnetapi/NetBuffer.o" "../../../../objects/x86.R1/kits/net/
libnetapi/NetDebug.o"   -lroot -lbe -lnet  ;

..failed Link ../../../../distro/x86.R1/beos/system/lib/libnetapi.so 
..
..failed updating 1 target(s)...
..updated 2 target(s)...
-->8-----------

Okay, now the explanation : our own network POSIX headers are plain 
BUGGY and UGLY! 
"Bugly", to make this short. 
;-)
:-|
:-(
Marcus already give up his Network team effort yesterday after 
understand this, and I'm starting to understand myself why. 
More and more.

The rtstat and rt_tables duplicated symbols error origin: 

NetAddress.cpp -> current/headers/posix/netinet/in.h -> current/headers
/posix/net/if.h -> current/headers/posix/net/route.h
NetBuffer.cpp -> current/headersos/net/socket.h -> current/headers/
posix/netinet/in.h -> ... -> posix/net/route.h
Here, still nothing wrong.

BUT, in net/route.h there is THIS:

struct  rtstat  rtstat;
struct  radix_node_head *rt_tables[AF_MAX+1];

Yep, you read correctly: global variables definition in an public, 
multi-modules included header file!
Grrrr. Once moved to route.c, no more rtstat and rt_tables in 
NetAddress.o and NetBuffer.o.
Unfortunatly, these posix network headers have others *big* issues that 
break build in other (many) places, that's a real Mess (tm).
But it's another story.

So, to resume : you're not faulty, nor your code, nor the linker nor 
jam nor jamrules nor even my quicly hacked libnetapi/Jamfile.

-Philippe "locked in *bugly* posix net headers Halloween nightmare 
forever" Net Team Leader.


--
Fortune Cookie Says:

Do infants have as much fun in infancy as adults do in adultery?


Other related posts:

  • » [openbeosnetteam] Re: Netkit stuff