Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!

Bug 32535

Summary: /usr/include/sys/sysmacros.h causing compile failures
Product: Gentoo Linux Reporter: James Cloos <cloos>
Component: [OLD] Core systemAssignee: Please assign to toolchain <gcc-porting>
Status: VERIFIED FIXED    
Severity: normal    
Priority: High    
Version: 1.4   
Hardware: All   
OS: Linux   
Whiteboard:
Package list:
Runtime testing required: ---
Bug Depends on:    
Bug Blocks: 31307    

Description James Cloos 2003-11-02 05:05:08 UTC
ngrep wasn't merging; turned out its test for HAVE_DUMB_UDPHDR was giving a false positive.  Manually compiling the test .c from configure gives this:

:; gcc -O2 -c test.c 
In file included from /usr/include/sys/types.h:219,
                 from /usr/include/netinet/udp.h:52,
                 from test.c:10:
/usr/include/sys/sysmacros.h: In function `main':
/usr/include/sys/sysmacros.h:43: error: nested function `gnu_dev_major' declared `extern'
/usr/include/sys/sysmacros.h:49: error: nested function `gnu_dev_minor' declared `extern'
/usr/include/sys/sysmacros.h:55: error: nested function `gnu_dev_makedev' declared `extern'



So, it looks like gcc-3.3.2-r2 doesn't like nested extern functions, and glibc-2.3.2-r8 contains some in /usr/include/sys/sysmacros.h.
Comment 1 Martin Schlemmer (RETIRED) gentoo-dev 2003-11-02 11:12:42 UTC
ngrep works here with those.  Please attach your test.c, and output of 'make
info'.
Comment 2 Martin Schlemmer (RETIRED) gentoo-dev 2003-11-02 11:15:10 UTC
Err, scratch that.
Comment 3 Martin Schlemmer (RETIRED) gentoo-dev 2003-11-02 11:20:52 UTC
Did gcc-3.3.1-r* work fine with this ?
Comment 4 Martin Schlemmer (RETIRED) gentoo-dev 2003-11-02 14:20:39 UTC
The test is wrong, and should look as follows:

--
#line 1765 "configure"
#include "confdefs.h"
                                                                        
                                                    
#ifndef __FAVOR_BSD
#define __FAVOR_BSD
#endif
                                                                        
                                                    
#ifndef _BSD_SOURCE
#define _BSD_SOURCE 1
#endif
                                                                        
                                                    
#include <netinet/udp.h>
                                                                        
                                                    
int main() {
struct udphdr foo;
unsigned short bar = foo.uh_sport;
                                                                        
                                                    
; return 0; }
--

(note the #include, etc OUTSIDE main() ).

Fixed in CVS.
Comment 5 James Cloos 2003-11-02 14:44:41 UTC
Good catch; i must get blind shortly before crashing for the night ... (day?)

ngrep's configure.in says:

        AC_TRY_COMPILE(,
#ifndef __FAVOR_BSD
#define __FAVOR_BSD
#endif

#ifndef _BSD_SOURCE
#define _BSD_SOURCE 1
#endif

#include <netinet/udp.h>

struct udphdr foo;
unsigned short bar = foo.uh_sport;
,
        echo nope,
        echo yep dumb; AC_DEFINE(HAVE_DUMB_UDPHDR))

nb the comma on the line w/ AC_TRY_COMPILE.  That is the bug.
remove that comma and the configure works.

diff is:
==============================================================
--- a/configure.in        2003-11-02 17:41:32.780242175 -0500
+++ b/configure.in        2003-11-02 17:41:45.266929980 -0500
@@ -179,7 +179,7 @@
        AC_DEFINE(LINUX)
 
        AC_MSG_CHECKING(for a dumb udphdr declaration)
-       AC_TRY_COMPILE(,
+       AC_TRY_COMPILE(
 #ifndef __FAVOR_BSD
 #define __FAVOR_BSD
 #endif


===========================================================


but the autoconf must be re-run...
Comment 6 Martin Schlemmer (RETIRED) gentoo-dev 2003-11-02 14:55:24 UTC
Mind passing it on to the ngrep guys ?
Comment 8 Joshua Kinard gentoo-dev 2003-11-04 02:25:49 UTC
Closing