MANY problems compiling under Cygwin :(

Posted by GR on Tue 19 Feb 2002 03:44 PM — 7 posts, 26,783 views.

#0
First off, I did try the method listed in the other Cygwin Pennmush forum, but no luck :( - I receive this (huge) list of errors (for bsd.c):

bsd.c:15: warning: `FD_SETSIZE' redefined
/usr/include/sys/types.h:173: warning: this is the location of the previous definition
In file included from bsd.c:16:
/usr/include/w32api/winsock.h:78: warning: #warning "fd_set and associated macros have been defined in sys/types. This can cause runtime problems with W32 sockets"
In file included from /usr/include/sys/resource.h:14,
from /usr/include/sys/wait.h:15,
from bsd.c:48:
/usr/include/sys/time.h:47: warning: `timerclear' redefined
/usr/include/w32api/winsock.h:103: warning: this is the location of the previous definition
/usr/include/sys/time.h:51: warning: `timercmp' redefined
/usr/include/w32api/winsock.h:102: warning: this is the location of the previous definition
In file included from /usr/include/cygwin/socket.h:23,
from /usr/include/sys/socket.h:15,
from ../hdrs/ident.h:23,
from bsd.c:100:
/usr/include/asm/socket.h:21: warning: `_IO' redefined
/usr/include/w32api/winsock.h:112: warning: this is the location of the previous definition
/usr/include/asm/socket.h:22: warning: `_IOR' redefined
/usr/include/w32api/winsock.h:113: warning: this is the location of the previous definition
/usr/include/asm/socket.h:23: warning: `_IOW' redefined
/usr/include/w32api/winsock.h:114: warning: this is the location of the previous definition
/usr/include/asm/socket.h:27: warning: `FIONBIO' redefined
/usr/include/w32api/winsock.h:115: warning: this is the location of the previous definition
/usr/include/asm/socket.h:47: warning: `SO_DEBUG' redefined
/usr/include/w32api/winsock.h:237: warning: this is the location of the previous definition
/usr/include/asm/socket.h:48: warning: `SO_ACCEPTCONN' redefined
/usr/include/w32api/winsock.h:238: warning: this is the location of the previous definition
/usr/include/asm/socket.h:49: warning: `SO_REUSEADDR' redefined
/usr/include/w32api/winsock.h:239: warning: this is the location of the previous definition
/usr/include/asm/socket.h:50: warning: `SO_KEEPALIVE' redefined
/usr/include/w32api/winsock.h:240: warning: this is the location of the previous definition
/usr/include/asm/socket.h:51: warning: `SO_DONTROUTE' redefined
/usr/include/w32api/winsock.h:241: warning: this is the location of the previous definition
/usr/include/asm/socket.h:52: warning: `SO_BROADCAST' redefined
/usr/include/w32api/winsock.h:242: warning: this is the location of the previous definition
/usr/include/asm/socket.h:53: warning: `SO_USELOOPBACK' redefined
/usr/include/w32api/winsock.h:243: warning: this is the location of the previous definition
/usr/include/asm/socket.h:54: warning: `SO_LINGER' redefined
/usr/include/w32api/winsock.h:244: warning: this is the location of the previous definition
/usr/include/asm/socket.h:55: warning: `SO_OOBINLINE' redefined
/usr/include/w32api/winsock.h:245: warning: this is the location of the previous definition
In file included from /usr/include/sys/socket.h:15,
from ../hdrs/ident.h:23,
from bsd.c:100:
/usr/include/cygwin/socket.h:80: warning: `AF_MAX' redefined
/usr/include/w32api/winsock.h:309: warning: this is the location of the previous definition
/usr/include/cygwin/socket.h:112: warning: `MSG_OOB' redefined
/usr/include/w32api/winsock.h:349: warning: this is the location of the previous definition
/usr/include/cygwin/socket.h:113: warning: `MSG_PEEK' redefined
/usr/include/w32api/winsock.h:350: warning: this is the location of the previous definition
/usr/include/cygwin/socket.h:114: warning: `MSG_DONTROUTE' redefined
/usr/include/w32api/winsock.h:351: warning: this is the location of the previous definition
In file included from /usr/include/sys/resource.h:14,
from /usr/include/sys/wait.h:15,
from bsd.c:48:
/usr/include/sys/time.h:73: warning: `struct timezone' declared inside parameter list
/usr/include/sys/time.h:73: warning: its scope is only this definition or declaration, which is probably not what you want.
/usr/include/sys/time.h:74: warning: `struct timezone' declared inside parameter list
In file included from bsd.c:55:
/usr/include/sys/select.h:29: conflicting types for `select'
/usr/include/w32api/winsock.h:468: previous declaration of `select'
#1
In file included from bsd.c:99:
../hdrs/mysocket.h:63: parse error before `socklen_t'
../hdrs/mysocket.h:66: parse error before `socklen_t'
../hdrs/mysocket.h:69: parse error before `socklen_t'
../hdrs/mysocket.h:147: parse error before `socklen_t'
In file included from /usr/include/sys/socket.h:15,
from ../hdrs/ident.h:23,
from bsd.c:100:
/usr/include/cygwin/socket.h:18: redefinition of `struct sockaddr'
In file included from /usr/include/sys/socket.h:15,
from ../hdrs/ident.h:23,
from bsd.c:100:
/usr/include/cygwin/socket.h:28: redefinition of `struct linger'
In file included from ../hdrs/ident.h:23,
from bsd.c:100:
/usr/include/sys/socket.h:29: conflicting types for `accept'
/usr/include/w32api/winsock.h:423: previous declaration of `accept'
/usr/include/sys/socket.h:30: conflicting types for `bind'
/usr/include/w32api/winsock.h:424: previous declaration of `bind'
/usr/include/sys/socket.h:31: conflicting types for `connect'
/usr/include/w32api/winsock.h:426: previous declaration of `connect'
/usr/include/sys/socket.h:32: conflicting types for `getpeername'
/usr/include/w32api/winsock.h:428: previous declaration of `getpeername'
/usr/include/sys/socket.h:33: conflicting types for `getsockname'
/usr/include/w32api/winsock.h:429: previous declaration of `getsockname'
/usr/include/sys/socket.h:34: conflicting types for `listen'
/usr/include/w32api/winsock.h:433: previous declaration of `listen'
/usr/include/sys/socket.h:35: conflicting types for `recv'
/usr/include/w32api/winsock.h:434: previous declaration of `recv'
/usr/include/sys/socket.h:37: conflicting types for `recvfrom'
/usr/include/w32api/winsock.h:435: previous declaration of `recvfrom'
/usr/include/sys/socket.h:38: conflicting types for `send'
/usr/include/w32api/winsock.h:436: previous declaration of `send'
/usr/include/sys/socket.h:39: conflicting types for `sendto'
/usr/include/w32api/winsock.h:437: previous declaration of `sendto'
/usr/include/sys/socket.h:40: conflicting types for `setsockopt'
/usr/include/w32api/winsock.h:438: previous declaration of `setsockopt'
/usr/include/sys/socket.h:41: conflicting types for `getsockopt'
/usr/include/w32api/winsock.h:430: previous declaration of `getsockopt'
/usr/include/sys/socket.h:42: conflicting types for `shutdown'
/usr/include/w32api/winsock.h:439: previous declaration of `shutdown'
/usr/include/sys/socket.h:43: conflicting types for `socket'
/usr/include/w32api/winsock.h:440: previous declaration of `socket'
/usr/include/sys/socket.h:46: conflicting types for `getservbyname'
/usr/include/w32api/winsock.h:444: previous declaration of `getservbyname'
bsd.c: In function `shovechars':
bsd.c:2134: warning: comparison between pointer and integer
bsd.c: In function `process_input':
bsd.c:3479: `errno' undeclared (first use in this function)
bsd.c:3479: (Each undeclared identifier is reported only once
bsd.c:3479: for each function it appears in.)

Gaah! Multiple declarations!!! Gaah! Parse errors! What should I do???
#2
Basically, I'm asking: Do I get rid of socket.h, or winsock.h? And what do I do about the strange parse errors?

By the way, here's an output with no winsock:

bsd.c:15: warning: `FD_SETSIZE' redefined
/usr/include/sys/types.h:173: warning: this is the location of the previous definition
In file included from bsd.c:99:
../hdrs/mysocket.h:50: field `addr' has incomplete type
../hdrs/mysocket.h:63: parse error before `socklen_t'
../hdrs/mysocket.h:66: parse error before `socklen_t'
../hdrs/mysocket.h:69: parse error before `socklen_t'
../hdrs/mysocket.h:147: parse error before `socklen_t'
bsd.c:323: parse error before `wsadata'
bsd.c:323: warning: data definition has no type or storage class
bsd.c: In function `win_gettimeofday':
bsd.c:1842: `FILETIME' undeclared (first use in this function)
bsd.c:1842: (Each undeclared identifier is reported only once
bsd.c:1842: for each function it appears in.)
bsd.c:1842: parse error before `win_time'
bsd.c:1844: `win_time' undeclared (first use in this function)
bsd.c: In function `shovechars':
bsd.c:2068: `SOCKET_ERROR' undeclared (first use in this function)
bsd.c:2068: `WSAEINTR' undeclared (first use in this function)
bsd.c:2134: `INVALID_SOCKET' undeclared (first use in this function)
bsd.c: In function `process_output':
bsd.c:3235: `SOCKET_ERROR' undeclared (first use in this function)
bsd.c:3235: `WSAEWOULDBLOCK' undeclared (first use in this function)
bsd.c: In function `process_input':
bsd.c:3479: `errno' undeclared (first use in this function)
bsd.c:3491: `WSAEWOULDBLOCK' undeclared (first use in this function)
bsd.c:3491: `WSAEINTR' undeclared (first use in this function)
bsd.c: In function `how_many_fds':
bsd.c:5314: request for member `iMaxSockets' in something not a structure or union
bsd.c:5315: request for member `iMaxSockets' in something not a structure or union

#3
And here's my output without socket.h:

bsd.c:15: warning: `FD_SETSIZE' redefined
/usr/include/sys/types.h:173: warning: this is the location of the previous definition
In file included from bsd.c:16:
/usr/include/w32api/winsock.h:78: warning: #warning "fd_set and associated macros have been defined in sys/types. This can cause runtime problems with W32 sockets"
In file included from /usr/include/sys/resource.h:14,
from /usr/include/sys/wait.h:15,
from bsd.c:48:
/usr/include/sys/time.h:47: warning: `timerclear' redefined
/usr/include/w32api/winsock.h:103: warning: this is the location of the previous definition
/usr/include/sys/time.h:51: warning: `timercmp' redefined
/usr/include/w32api/winsock.h:102: warning: this is the location of the previous definition
In file included from /usr/include/sys/resource.h:14,
from /usr/include/sys/wait.h:15,
from bsd.c:48:
/usr/include/sys/time.h:73: warning: `struct timezone' declared inside parameter list
/usr/include/sys/time.h:73: warning: its scope is only this definition or declaration, which is probably not what you want.
/usr/include/sys/time.h:74: warning: `struct timezone' declared inside parameter list
In file included from bsd.c:55:
/usr/include/sys/select.h:29: conflicting types for `select'
/usr/include/w32api/winsock.h:468: previous declaration of `select'
In file included from bsd.c:99:
../hdrs/mysocket.h:63: parse error before `socklen_t'
../hdrs/mysocket.h:66: parse error before `socklen_t'
../hdrs/mysocket.h:69: parse error before `socklen_t'
../hdrs/mysocket.h:147: parse error before `socklen_t'
In file included from bsd.c:100:
../hdrs/ident.h:53: parse error before `socklen_t'
bsd.c: In function `shovechars':
bsd.c:2134: warning: comparison between pointer and integer
bsd.c: In function `new_connection':
bsd.c:2175: `socklen_t' undeclared (first use in this function)
bsd.c:2175: (Each undeclared identifier is reported only once
bsd.c:2175: for each function it appears in.)
bsd.c:2175: parse error before `addr_len'
bsd.c:2182: `addr_len' undeclared (first use in this function)
bsd.c: In function `process_input':
bsd.c:3479: `errno' undeclared (first use in this function)
Australia Forum Administrator #4
You haven't said what version you are compiling, but I got it to compile and run after some minor tweaking. :)

This example uses 1.7.4 p15 which seems to be the latest stable version right now.

First step, unzip the file, configure, update the config.h file ...


tar xvzf pennmush-1.7.4p15.tar.gz
cd pennmush
./Configure -d
make update


Now, edit config.h and comment out two lines:


/* #define HAS_SETLOCALE / **/
/* #define HAS_IPV6 / **/


Now, in the "src" directory, edit mysocket.c and comment out two lines:


// #include <resolv.h>
// extern int h_errno;


Should work now - try a "make".


make
make install

Amended on Tue 19 Feb 2002 09:40 PM by Nick Gammon
#5
Ahh! I see what I did wrong - I did apply the changes to the files, like you said, the first go-around. However, I chose to use the options "win32-gcc" < I guess that with Cygwin, it's sort of disputable whether I'm running Win32-GCC . . . anyway, it worked with ./Config -d (default configuration), so, it must have been that - I guess. Maybe looking for the Win32 version of gcc???
Australia Forum Administrator #6
Yes, when using Cygwin, I tend to *not* tell it that it is a WIN32 compile. I know it is on Windows, but the Cygwin environment is really a "Unix" environment.

That is why I suggest that people using Cygwin just use the Unix source, not source modified for Windows.