Summary: | netperf-2.4.0 compiling fails if including socket.h glibc 2.4 + gcc 4.1.0 | ||
---|---|---|---|
Product: | Gentoo Linux | Reporter: | Mikko Tiihonen <mikko.tiihonen> |
Component: | [OLD] Core system | Assignee: | Gentoo Netmon project <netmon> |
Status: | RESOLVED FIXED | ||
Severity: | normal | ||
Priority: | High | ||
Version: | 2006.0 | ||
Hardware: | AMD64 | ||
OS: | Linux | ||
Whiteboard: | |||
Package list: | Runtime testing required: | --- | |
Bug Depends on: | |||
Bug Blocks: | 117482 | ||
Attachments: |
failing configure of netperf
Patch to netperf aclocal.m4 |
Description
Mikko Tiihonen
2006-03-15 12:41:08 UTC
please drop the last 90% of flags from your CFLAGS, emerge -e world, and try again. http://gentoo-wiki.com/Safe_Cflags Created attachment 82577 [details]
failing configure of netperf
Unfortunately the problem is not in the CFLAGS. After anlysing it further it seems that the configure script is to blame (or whatever was used to create it).
The failure that aborts the configure is compiling the following code:
#define socklen_t unsigned
#include <sys/types.h>
#include <sys/socket.h>
#include <netinet/in.h>
int main() {
struct sockaddr_in addr;
return (sizeof(addr.sin_port) == sizeof(long)) ? 0 : 1;
}
If the socken_t define is removed the code compiles without error.
Going backwards in the log it seems that the configure script misdetects the socklen_t type to unsigned, because it does not know about the declaration of getpeername in glibc headers.
The configure tries the following variants:
| int getpeername (int, struct sockaddr *, int *);
| int getpeername (int, struct sockaddr *, size_t *);
| int getpeername (int, void *, int *);
| int getpeername (int, void *, size_t *);
| int getpeername (int, void *, unsigned *);
| int getpeername (int, void *, long *);
| int getpeername (int, void *, unsigned long *);
| int getpeername (int, void *, socklen_t *);
Whereas the correct declaration in glibc 2.4 seems to be:
int getpeername(int s, struct sockaddr *name, socklen_t *namelen);
Created attachment 82578 [details, diff]
Patch to netperf aclocal.m4
Analysing further....
With the attached patch + running autoconf the configure will finish correctly:
checking for socklen_t equivalent... socklen_t
checking for in_port_t... yes
...
Whereas when it failed it reported:
checking for socklen_t equivalent... unsigned
checking for in_port_t... no
configure: error: Failed to get size of sin_port in struct sockaddr_in.
Fixed in cvs, thanks for testing and providing required patch |