Bug 52065 - redeclaration of structs in apr.h
Summary: redeclaration of structs in apr.h
Status: NEW
Alias: None
Product: APR
Classification: Unclassified
Component: APR (show other bugs)
Version: HEAD
Hardware: PC Windows XP
: P2 major (vote)
Target Milestone: ---
Assignee: Apache Portable Runtime bugs mailinglist
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-10-20 12:25 UTC by Razvan
Modified: 2011-10-21 01:58 UTC (History)
0 users



Attachments
The error output from make (11.29 KB, text/plain)
2011-10-20 12:25 UTC, Razvan
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Razvan 2011-10-20 12:25:08 UTC
Created attachment 27827 [details]
The error output from make

I get the following error when running make in the Apache httpd-2.2.21 folder (running Cygwin):

/bin/sh /home/[removed]/httpd-2.2.21/srclib/apr/libtool --silent --mode=compile gcc -g -O2   -DHAVE_CONFIG_H -DCYGWIN   -I./include -I/home/Razvan/httpd-2.2.21/srclib/apr/include/arch/unix -I./include/arch/unix -I/home/Razvan/httpd-2.2.21/srclib/apr/include/arch/unix -I/home/Razvan/httpd-2.2.21/srclib/apr/include  -o strings/apr_snprintf.lo -c strings/apr_snprintf.c && touch strings/apr_snprintf.lo
In file included from /usr/include/sys/socket.h:16,
                 from ./include/apr.h:168,
                 from strings/apr_snprintf.c:17:
/usr/include/cygwin/socket.h:29: error: redefinition of `struct sockaddr'
/usr/include/cygwin/socket.h:41: error: redefinition of `struct sockaddr_storage'

It seems running on Cygwin includes both the Windows file, which is located at /usr/include/w32api/winsock.h (or /usr/include/w32/winsock2.h), and the /usr/include/sys/socket.h, causing some redeclarations for the two structs above and also for most of the functions (see error.log attached).

One possible solution would be to change apr.h.in and count also for the case when there is Cygwin. So change this:

167  #if APR_HAVE_SYS_SOCKET_H 
168  #include <sys/socket.h>
169  #endif

in apr.h.in to something like (CYGWIN needs to be defined by ./configure, I guess(?)):

167  #if APR_HAVE_SYS_SOCKET_H && !CYGWIN
168  #include <sys/socket.h>
169  #endif

Also, this redeclaration problem appears in other header files.
Thank you.
Comment 1 William A. Rowe Jr. 2011-10-21 01:58:56 UTC
Just to spare you a bunch of frustration, apr hasn't been particularly well
synchronized with cygwin, given that this would be an abstraction layer upon
layer upon layer on top of ntdll (apr, cyg, win32).  Plenty of opportunity
for flaws.

There has been some effort in integrating apr for mingw/msys and you might
have a more pleasant experience with that.