[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: conflicting definitions in /usr/include/



On Tue, Sep 10, 2002 at 03:48:29PM -0400, Noah Meyerhans wrote:
> Under the assumption that iputils-ping will eventually become the
> default in Debian, I've been doing some extra QA to make sure things
> work as advertised on all platforms.  Unfortunately, they don't.  The
> problems are very easy to work around, but it bugs me that it's even
> necessary.
> 
> The iputils source includes a directory, include-glibc, that contains
> modified copies of /usr/include/bits/{sockunion.h,socket.h} and
> /usr/include/netinet/{ip.h,ip_icmp.h,in.h}.  These files are modified
> from the original in that certain definitions have been removed from
> them.  This is necessary because, for example, both
> /usr/include/netinet/in.h and /usr/include/linux/ipv6.h define the
> in6_addr structure, and the iputils tools won't compile since it
> includes both of those files.  Why do they both define that structure?
> There are other conflicting definitions as well, such as sockaddr_in6.

The reason why they both have it is that the linux/* definition are the
kernel ones, the netinet/in.h ones are what glibc copied from the kernel
ones. Userspace programs should *never* include linux/* headers. If you need
an interface not in glibc, you should bug them to make appropriate copies.

Maybe the fix is as simple as deleting any lines saying #include <linux/*>
and remove all those editted header files too.

> The reason this is all causing me problems right now is that for some
> reason on MIPS, SOCK_DGRAM is defined as 1 and SOCK_STREAM is 2, which
> is the opposite of other systems.  This caused the local bits/socket.h
> to set those symbols to the wrong values...

Probably for binary compatability reasons with native binaries on that
platform. Glibc should have the correct values so you should be using them.

-- 
Martijn van Oosterhout   <kleptog@svana.org>   http://svana.org/kleptog/
> There are 10 kinds of people in the world, those that can do binary
> arithmetic and those that can't.



Reply to: