[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 & 
> > 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 
> > 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:

$ pwd
$ 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
multiple definition of `rtstat'
first defined here
multiple definition of `rt_tables'
first defined here
./../../../objects/x86.R1/kits/net/libnetapi/NetAddress.o: In function 
`BNetAddress::GetAddr(char *, unsigned short *) const':
0x582): undefined reference to `__swap_int16(unsigned short)'
./../../../objects/x86.R1/kits/net/libnetapi/NetAddress.o: In function 
`BNetAddress::SetTo(char const *, unsigned short)':
0x7f9): undefined reference to `__swap_int16(unsigned short)'
0x80a): undefined reference to `__swap_int32(unsigned long)'
./../../../objects/x86.R1/kits/net/libnetapi/NetAddress.o: In function 
`BNetAddress::SetTo(sockaddr_in const &)':
0x848): undefined reference to `__swap_int16(unsigned short)'
0x859): undefined reference to `__swap_int32(unsigned long)'
./../../../objects/x86.R1/kits/net/libnetapi/NetAddress.o: In function 
`BNetAddress::SetTo(in_addr, int)':
0x893): undefined reference to `__swap_int16(unsigned short)'
0x8a1): undefined reference to `__swap_int32(unsigned long)'
./../../../objects/x86.R1/kits/net/libnetapi/NetAddress.o: In function 
`BNetAddress::SetTo(unsigned long, int)':
0x8db): undefined reference to `__swap_int16(unsigned short)'
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)...

Okay, now the explanation : our own network POSIX headers are plain 
"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