Page 1 of 1

gcc 4.0 fails to build UnrealIRCd (static/extern &&

Posted: Wed Aug 17, 2005 7:59 pm
by Ju`
I just want to tell everybody my experience:

I tried to build UnrealIRCd on my Debian-Sid box with gcc 4.0.2 20050806 (prerelease),
and I first got this error:
In file included from ../include/common.h:46,
from ../include/struct.h:43,
from auth.c:21:
../include/sys.h:195: error: static declaration of 'in6addr_any' follows non-static declaration
/usr/include/netinet/in.h:206: error: previous declaration of 'in6addr_any' was here
This is an issue brought by gcc 4.0 (see this link: http://nixforums.org/about57374.html).
So I corrected this by cutting:

Code: Select all

# if defined(linux)
static const struct in6_addr in6addr_any = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
	0, 0, 0, 0, 0
};
# endif
from include/sys.h.

And I added:

Code: Select all

# if defined(linux)
/*static*/ const struct in6_addr in6addr_any = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
	0, 0, 0, 0, 0
};
# endif
just after

Code: Select all

#include "h.h"
in src/auth.c.

I had to put in6addr_any in a .c file (src/auth.c here) because it is very bad to generate code in a header file.
Indeed it will create many in6addr_any every time the header file (include/sys.h here) is included (especially without 'static'), so the linker will crash.
Then (make clean && make), I had some others errors about libcurl:
For instance:
url.o: dans la fonction « set_curl_ssl_options »:
/tmp/Unreal3.2/src/url.c:110: référence indéfinie vers « curl_easy_setopt »
I was surprised because I had already installed libcurl3 and libcurl3-dev...
Then I had a glance at the code printed by 'make' and I made out that '-lcurl' was missing in the 'gcc' command line which crashed.
So I edited this line in the Makefile:

Code: Select all

IRCDLIBS=-lcrypt -lnsl  -lz  -lares -ldl -L/tmp/Unreal3.2/extras/regexp/lib -ltre
adding '-lcurl'

Code: Select all

IRCDLIBS=-lcrypt -lnsl  -lz  -lares -ldl -L/tmp/Unreal3.2/extras/regexp/lib -ltre -lcurl 
In the end, 'make clean && make' works fine... I'm happy :p
Sorry if these issues had ever been discussed on this forum, but as the current release of UnrealIRCd does not fix them, I did not hesitate to post :s

Posted: Wed Aug 17, 2005 8:33 pm
by Stealth
GCC 4 has many issues with Unreal at the moment. Some (or most or all) these issues are fixed in the CVS version.

thx!

Posted: Wed Aug 17, 2005 10:52 pm
by Ju`
Thanks :)