Weird error messages from cygwin.

Posted by Samael on Fri 04 May 2007 03:03 AM — 13 posts, 56,041 views.

#0
Hello, For some reason I get this really weird error messages when I try and compile under cygwin. I have windows XP service pack 2 with Dawn 1.60q I think is the latest one. and I get this weird error message every time:

Samael@samael-l5if2k3z ~/dawn/src
$ make
g++ -c -Wall -g -O  connect.cpp -o obj/connect.o
connect.cpp: In member function `void connection_data::close_socket()':
connect.cpp:215: error: expected `)' before '{' token
make: *** [connect.o] Error 1


Here is the section of code it dealing with:

/**************************************************************************/
// close the actual socket attached to a connection structure
void connection_data::close_socket()
{
	logf("Closing socket %d", connected_socket);
#ifdef __CYGWIN__
	// a hack to make cygwin shutdown sockets after a hotreboot
	// cygwin still appears to be leaking endpoints according to
	// processexplorer from sysinternals, but this atleast gets
	// the socket to disconnect.
	if(shutdown(connected_socket, 2)!=0
	{
		logf("error %d calling shutdown on socket %d.", errno, connected_socket);
	}
#endif
	if (closesocket(connected_socket )!=0)){
		socket_error(FORMATF("connection_data::close_socket(): error calling closesocket() on socket %d",connected_socket));
	}
	connected_socket=0;
}


I already tried adding another ( but it just gives another error message:


Samael@samael-l5if2k3z ~/dawn/src
$ make
g++ -c -Wall -g -O  connect.cpp -o obj/connect.o
connect.cpp: In member function `void connection_data::close_socket()':
connect.cpp:219: error: expected primary-expression before ')' token
connect.cpp:219: error: expected `;' before ')' token
make: *** [connect.o] Error 1


I don't know whats wrong but I'd really appreciate the help if anyone knows the answer.
Amended on Fri 04 May 2007 03:10 AM by Samael
USA #1
	if(shutdown(connected_socket, 2)!=0

Should be
	if(shutdown(connected_socket, 2)!=0)


Is this really stock DoT? I don't see how this got released in a public build.
Australia Forum Administrator #2
Maybe he never compiled it under Cygwin.
USA #3
I don't see how a missing parenthesis would compile anywhere. :P
Australia Forum Administrator #4
It has:


#ifdef __CYGWIN__

blah blah

#endif


If the #if condition is not met, then the code inside is not considered for compilation.
USA #5
Whoops, didn't even see that. :P

Hm, this sounds familiar...
http://www.gammon.com.au/forum/bbshowpost.php?id=5174
Amended on Fri 04 May 2007 04:58 AM by Zeno
#6
The DOT website is now back online at dawnoftime.org. I am working on bringing it back up to full capacity.
#7
Sorry it took me this long to respond but I've been busy lately. But Zeno was right the once I added the missing parenthesis connect.cpp compiled correctly. Then it reached dawnstat.cpp and I hit a couple more errors. This is a brand new download of Dawn of Time. The compiler looks like this:


g++ -c -Wall -g -O  dawnstat.cpp -o obj/dawnstat.o
dawnstat.cpp: In function `void dawnstat_initiate_connection()':
dawnstat.cpp:334: error: aggregate `addrinfo hints' has incomplete type and cann
ot be defined
dawnstat.cpp:335: error: invalid application of `sizeof' to incomplete type `add
rinfo'
dawnstat.cpp:336: error: `AI_NUMERICHOST' undeclared (first use this function)
dawnstat.cpp:336: error: (Each undeclared identifier is reported only once for e
ach function it appears in.)
dawnstat.cpp:338: error: `AF_INET6' undeclared (first use this function)
dawnstat.cpp:344: error: `freeaddrinfo' undeclared (first use this function)
dawnstat.cpp:348: error: `getaddrinfo' undeclared (first use this function)
dawnstat.cpp:369: error: `gai_strerror' undeclared (first use this function)
dawnstat.cpp:409: error: invalid use of undefined type `struct addrinfo'
dawnstat.cpp:63: error: forward declaration of `struct addrinfo'
dawnstat.cpp:409: error: invalid use of undefined type `struct addrinfo'
dawnstat.cpp:63: error: forward declaration of `struct addrinfo'
dawnstat.cpp:409: error: invalid use of undefined type `struct addrinfo'
dawnstat.cpp:63: error: forward declaration of `struct addrinfo'
dawnstat.cpp:439: error: invalid use of undefined type `struct addrinfo'
dawnstat.cpp:63: error: forward declaration of `struct addrinfo'
dawnstat.cpp:439: error: invalid use of undefined type `struct addrinfo'
dawnstat.cpp:63: error: forward declaration of `struct addrinfo'
dawnstat.cpp: In function `void dawnstat_process_connect()':
dawnstat.cpp:537: error: invalid use of undefined type `struct addrinfo'
dawnstat.cpp:63: error: forward declaration of `struct addrinfo'
dawnstat.cpp:537: error: invalid use of undefined type `struct addrinfo'
dawnstat.cpp:63: error: forward declaration of `struct addrinfo'
make: *** [dawnstat.o] Error 1


I kinda got lost because I assume something was missing but I wasn't sure where.

The area it refers is this:

#ifdef IPV6_SUPPORT_ENABLED
	struct addrinfo hints;
	memset(&hints, 0, sizeof(struct addrinfo));
	hints.ai_flags=AI_NUMERICHOST; // we have an ip address
	if(addr->ipv6){
		hints.ai_family   = AF_INET6;
	}else{
		hints.ai_family   = AF_INET;
	}
	hints.ai_socktype = SOCK_STREAM;
	if(res){
		freeaddrinfo(res);
		res=NULL;
	}
	int r = getaddrinfo(addr->address, // ip address in text form
						"80", &hints, &res);
	// check that it was converted successfully
	if (r) {
		#ifdef WIN32
			if(r==WSAHOST_NOT_FOUND){
				dawnstat_logf("getaddrinfo error %d - couldn't convert '%s' to a valid ip address.",
					r, addr->address);
			}else if(r==WSAEAFNOSUPPORT && addr->ipv6){
				dawnstat_logf("\n"
					"getaddrinfo error %d - couldn't convert '%s' to a valid ip address\n"
					" - getaddrinfo reported this system has no support for the AF_INET6 address family.\n"
					"   This error message is normal if this system doesn't support ipv6, as it\n"
					"   was an ipv6 address getaddrinfo() was asked to convert.",
					r, addr->address);
			}else{
				dawnstat_logf("dawnstat_initiate_connection(): getaddrinfo(%s) error %d",
					addr->address, r);
			}
		#else
			{
				dawnstat_logf("dawnstat_initiate_connection(): getaddrinfo(%s) error %d - '%s'",
					addr->address, r, gai_strerror(r));


Thanks for the help, if you need more info I can provide, just ask.
USA #8
In addition to the first fix I believe you have to disable the IPV6 support to get DOT to compile in cygwin.

in wincfg.h or similar comment out #define WIN32_IPV6 or some such..
#9
The thing is, it's already commented out in that file.


/* 
 * IPV6 support - to enable uncomment the following define.
 * note: this will automatically turn on WIN32_USE_WINSOCK2 in include.h
 *       and requires the IPv6 headers within the development environment.
 */
//#define WIN32_IPV6

#endif //WINCFG_H


Thanks for the help, but that won't work. And if I go to command line and do this:

C:\Documents and Settings\Samael>ipv6 uninstall
IPv6 is not installed.
Succeeded.


Any help is appreciated.
Amended on Mon 28 May 2007 12:16 AM by Samael
USA #10
Your lucky day, I found a cache of the dawn of time cygwin getting started guide, someone might wanna repost and sticky this.

19:36 03/02/2004 - Kal
--- Notes for compiling and getting started with Dawn 1.69r on Cygwin ---

1. Download the src from http://www.dawnoftime.org/download/dawn1.69r-src.tgz
2. Download the support files from http://www.dawnoftime.org/download/dawn1.69r-support.tgz
3. use tar to uncompress both files (tar -xzvf dawn1.69r-*.tgz)
4. change into the src/configure directory (cd dawn1.69/src/configure)
5. run the configure script (./configure)
6. change into the src directory (cd ..)
7. edit config.h, removing the line at the bottom which reads "#define IPV6_SUPPORT_ENABLED"
8. edit connect.cpp, go around line 218.
9. change the text which reads
"if(shutdown(connected_socket, 2)!=0{" for:
"if(shutdown(connected_socket, 2)!=0){" (insert the extra ')' directly before the '{').
10. use make to compile the code
11. change into the parent directory (cd ..)
12. start dawn in create directories mode (./dawn --createdirs)
13. start dawn normally (./dawn)

note: The manual editing of config.h and connect.cpp will not be required in Dawn1.69s.
#11
Thank you so much Nexela, your a lifesaver!!!

Would someone tell Ixliam that the register function for the DoT forums isn't working correctly.

I also got this strange error message. Didn't seem to affect the compile just wonder what it was.


g++ -c -Wall -g -O  map.cpp -o obj/map.o
map.cpp: In function `void do_map(char_data*, char*)':
map.cpp:766: warning: right-hand operand of comma has no effect
map.cpp:768: warning: right-hand operand of comma has no effect


I'm pretty sure it isn't serious though. so yeah. Thanks for the help. You guys rock.

Oh there seems to be on small bug somewhere. After I created my first character it game me the 'Hit Return to Continue' message.

Quote:

If this is a new mud which you have just started up and have just created a
player which you want to convert into an administrative character (commonly
called an immortal) read 'help NEWMUD-GETTING-IMP' for further details.
[Hit Return to continue]


After the first one I got a blank space so I thought it was finifhed. I clicked on the NEWMUD-GETTING-IMP link, and the mud crashed. Apparently you have to click/hit enter twice but that's not much of a big deal. Anyway, Peace.
Amended on Tue 29 May 2007 03:13 AM by Samael
USA #12
remove just the ,range part from both lines 766 and 768 to fix the warnings