Notice: Any messages purporting to come from this site telling you that your password has expired, or that you need to verify your details, confirm your email, resolve issues, making threats, or asking for money, are
spam. We do not email users with any such messages. If you have lost your password you can obtain a new one by using the
password reset link.
Due to spam on this forum, all posts now need moderator approval.
Entire forum
➜ SMAUG
➜ Compiling the server
➜ Compiling SmaugFUSS 1.9 Error Ubuntu
Compiling SmaugFUSS 1.9 Error Ubuntu
|
It is now over 60 days since the last post. This thread is closed.
Refresh page
Posted by
| Whisperedecho
USA (51 posts) Bio
|
Date
| Sun 11 May 2008 07:36 PM (UTC) |
Message
| I am trying to compile SmaugFUSS 1.9 off of Ubuntu. I have installed g++ and gcc along with the "essential-build" package. I am getting the following errors when trying to compile:
mike@valdor-server:~/smaugfuss/src$ sudo make
make -s smaug
Compiling o/act_comm.o....
cc1plus: warnings being treated as errors
act_comm.c: In function ‘char* drunk_speech(const char*, CHAR_DATA*)’:
act_comm.c:209: warning: deprecated conversion from string constant to ‘char*’
act_comm.c: In function ‘void talk_channel(CHAR_DATA*, char*, int, const char*)’:
act_comm.c:403: warning: deprecated conversion from string constant to ‘char*’
act_comm.c:413: warning: deprecated conversion from string constant to ‘char*’
act_comm.c: In function ‘void do_say(CHAR_DATA*, char*)’:
act_comm.c:870: warning: deprecated conversion from string constant to ‘char*’
act_comm.c:900: warning: deprecated conversion from string constant to ‘char*’
act_comm.c: In function ‘void do_whisper(CHAR_DATA*, char*)’:
act_comm.c:996: warning: deprecated conversion from string constant to ‘char*’
act_comm.c: In function ‘void do_tell(CHAR_DATA*, char*)’:
act_comm.c:1166: warning: deprecated conversion from string constant to ‘char*’
act_comm.c: In function ‘void do_reply(CHAR_DATA*, char*)’:
act_comm.c:1323: warning: deprecated conversion from string constant to ‘char*’
act_comm.c:1329: warning: deprecated conversion from string constant to ‘char*’
act_comm.c: In function ‘void do_retell(CHAR_DATA*, char*)’:
act_comm.c:1422: warning: deprecated conversion from string constant to ‘char*’
act_comm.c: In function ‘void do_repeat(CHAR_DATA*, char*)’:
act_comm.c:1573: warning: deprecated conversion from string constant to ‘char*’
act_comm.c: In function ‘void do_emote(CHAR_DATA*, char*)’:
act_comm.c:1658: warning: deprecated conversion from string constant to ‘char*’
act_comm.c: In function ‘void do_bug(CHAR_DATA*, char*)’:
act_comm.c:1703: warning: deprecated conversion from string constant to ‘char*’
act_comm.c: In function ‘void do_idea(CHAR_DATA*, char*)’:
act_comm.c:1724: warning: deprecated conversion from string constant to ‘char*’
act_comm.c: In function ‘void do_typo(CHAR_DATA*, char*)’:
act_comm.c:1750: warning: deprecated conversion from string constant to ‘char*’
act_comm.c:1754: warning: deprecated conversion from string constant to ‘char*’
act_comm.c: In function ‘void do_quit(CHAR_DATA*, char*)’:
act_comm.c:1816: warning: deprecated conversion from string constant to ‘char*’
act_comm.c:1822: warning: deprecated conversion from string constant to ‘char*’
act_comm.c: In function ‘void do_group(CHAR_DATA*, char*)’:
act_comm.c:2286: warning: deprecated conversion from string constant to ‘char*’
act_comm.c: In function ‘void do_split(CHAR_DATA*, char*)’:
act_comm.c:2555: warning: deprecated conversion from string constant to ‘char*’
act_comm.c: In function ‘void do_gtell(CHAR_DATA*, char*)’:
act_comm.c:2616: warning: deprecated conversion from string constant to ‘char*’
act_comm.c:2618: warning: deprecated conversion from string constant to ‘char*’
act_comm.c:2621: warning: deprecated conversion from string constant to ‘char*’
act_comm.c: At global scope:
act_comm.c:2775: warning: deprecated conversion from string constant to ‘char*’
act_comm.c:2775: warning: deprecated conversion from string
make[1]: *** [o/act_comm.o] Error 1
make: *** [all] Error 2
I cut some errors out because of the 6000 char limit. | Top |
|
Posted by
| Nick Gammon
Australia (23,140 posts) Bio
Forum Administrator |
Date
| Reply #1 on Mon 12 May 2008 12:26 AM (UTC) Amended on Mon 12 May 2008 12:27 AM (UTC) by Nick Gammon
|
Message
| The relevant question really is, "what are the first errors"? The later ones really follow on from missing xxx.h files, usually.
If you do this, you can see all the errors:
make &> make.output
less make.output
I initially found a heap of errors, from not having the include files installed. Using the Synaptic Package Manager to install the "g++" package seemed to fix that.
However then I had less errors, but ones that started with missing zlib.h. I used the package manager to install "zlib1g-dev" package (zlib being the compression library used for MCCP).
I also would not use sudo, you don't need to compile as root, and in fact I think that would be dangerous.
After installing g++ and zlib1g-dev packages, I saw this:
nick@nick-ubuntu:~/smaugfuss/src$ make
make -s smaug
Compiling o/comm.o....
Compiling o/comments.o....
Compiling o/const.o....
Compiling o/db.o....
Compiling o/deity.o....
Compiling o/dns.o....
Compiling o/fight.o....
Compiling o/handler.o....
Compiling o/hashstr.o....
Compiling o/hint.o....
Compiling o/hotboot.o....
Compiling o/imm_host.o....
Compiling o/interp.o....
Compiling o/liquids.o....
Compiling o/magic.o....
Compiling o/makeobjs.o....
Compiling o/mapout.o....
Compiling o/mapper.o....
Compiling o/mccp.o....
Compiling o/misc.o....
Compiling o/mpxset.o....
Compiling o/mud_comm.o....
Compiling o/mud_prog.o....
Compiling o/news.o....
Compiling o/planes.o....
Compiling o/player.o....
Compiling o/polymorph.o....
Compiling o/renumber.o....
Compiling o/reset.o....
Compiling o/save.o....
Compiling o/services.o....
Compiling o/sha256.o....
Compiling o/shops.o....
Compiling o/skills.o....
Compiling o/special.o....
Compiling o/tables.o....
Compiling o/track.o....
Compiling o/update.o....
Compiling o/variables.o....
Compiling o/weather.o....
Generating dependency file ...
Done compiling mud.
make -s dns
Done compiling DNS resolver.
nick@nick-ubuntu:~/smaugfuss/src$
This was with Ubuntu 7.04, but the same should apply to other versions.
|
- Nick Gammon
www.gammon.com.au, www.mushclient.com | Top |
|
Posted by
| Whisperedecho
USA (51 posts) Bio
|
Date
| Reply #2 on Mon 12 May 2008 12:32 AM (UTC) Amended on Mon 12 May 2008 12:35 AM (UTC) by Whisperedecho
|
Message
| Thanks for your suggestions Nick.
I already have the zlib1g-dev package installed along with g++. I am still encountering the same problems. I'd post all the error code but then I run into the 6000 character limit. | Top |
|
Posted by
| Whisperedecho
USA (51 posts) Bio
|
Date
| Reply #3 on Mon 12 May 2008 12:33 AM (UTC) Amended on Mon 12 May 2008 12:34 AM (UTC) by Whisperedecho
|
Message
| First errors look like this:
make -s smaug
Compiling o/act_comm.o....
cc1plus: warnings being treated as errors
act_comm.c: In function ‘char* drunk_speech(const char*, CHAR_DATA*)’:
act_comm.c:209: warning: deprecated conversion from string constant to ‘char*’
act_comm.c: In function ‘void talk_channel(CHAR_DATA*, char*, int, const char*)’:
act_comm.c:403: warning: deprecated conversion from string constant to ‘char*’
act_comm.c:413: warning: deprecated conversion from string constant to ‘char*’
act_comm.c:418: warning: deprecated conversion from string constant to ‘char*’
act_comm.c:423: warning: deprecated conversion from string constant to ‘char*’
act_comm.c:428: warning: deprecated conversion from string constant to ‘char*’
act_comm.c:444: warning: deprecated conversion from string constant to ‘char*’
act_comm.c: In function ‘void do_say(CHAR_DATA*, char*)’:
act_comm.c:870: warning: deprecated conversion from string constant to ‘char*’
act_comm.c:900: warning: deprecated conversion from string constant to ‘char*’
act_comm.c: In function ‘void do_whisper(CHAR_DATA*, char*)’:
act_comm.c:996: warning: deprecated conversion from string constant to ‘char*’
act_comm.c:1002: warning: deprecated conversion from string constant to ‘char*’
act_comm.c:1039: warning: deprecated conversion from string constant to ‘char*’
act_comm.c: In function ‘void do_tell(CHAR_DATA*, char*)’:
act_comm.c:1166: warning: deprecated conversion from string constant to ‘char*’
act_comm.c:1172: warning: deprecated conversion from string constant to ‘char*’
act_comm.c:1232: warning: deprecated conversion from string constant to ‘char*’
act_comm.c: In function ‘void do_reply(CHAR_DATA*, char*)’:
act_comm.c:1323: warning: deprecated conversion from string constant to ‘char*’
act_comm.c:1329: warning: deprecated conversion from string constant to ‘char*’
act_comm.c:1362: warning: deprecated conversion from string constant to ‘char*’
act_comm.c: In function ‘void do_retell(CHAR_DATA*, char*)’: | Top |
|
Posted by
| Nick Gammon
Australia (23,140 posts) Bio
Forum Administrator |
Date
| Reply #4 on Mon 12 May 2008 12:48 AM (UTC) |
Message
| What version of gcc do you have? Type: gcc --version
nick@nick-ubuntu:~$ gcc --version
gcc (GCC) 4.1.2 (Ubuntu 4.1.2-0ubuntu4)
Copyright (C) 2006 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
nick@nick-ubuntu:~$
I have 4.1.2.
Notice you are getting warnings, not errors so far. Did the make complete OK?
They look like valid warnings - as the function is returning "", which is a constant, but the function is declared as returning char * (not const char *).
However I doubt it is a big deal.
This message (from man gcc) seems to be relevant:
-Wwrite-strings
When compiling C, give string constants the type "const
char[length]" so that copying the address of one into a non-"const"
"char *" pointer will get a warning; when compiling C++, warn about
the deprecated conversion from string constants to "char *". These
warnings will help you find at compile time code that can try to
write into a string constant, but only if you have been very care‚Äê
ful about using "const" in declarations and prototypes. Otherwise,
it will just be a nuisance; this is why we did not make -Wall
request these warnings.
However I can't see -Wwrite-strings in the Makefile warnings list. You could try adding: -Wno-write-strings to the list of warnings (about line 21 in Makefile).
|
- Nick Gammon
www.gammon.com.au, www.mushclient.com | Top |
|
Posted by
| Whisperedecho
USA (51 posts) Bio
|
Date
| Reply #5 on Mon 12 May 2008 12:51 AM (UTC) |
Message
| I have 4.2.3
I will try the other suggestion you mentioned.
The make does not complete Ok. It ends with a make error.
make[1]: *** [o/act_comm.o] Error 1
make: *** [all] Error 2
| Top |
|
Posted by
| Nick Gammon
Australia (23,140 posts) Bio
Forum Administrator |
Date
| Reply #6 on Mon 12 May 2008 12:53 AM (UTC) |
Message
| If you have -Werror in the warnings list, it treats all warnings as errors. You could try as a temporary measure to remove that part, so at least it will compile if you only get warnings. |
- Nick Gammon
www.gammon.com.au, www.mushclient.com | Top |
|
Posted by
| Whisperedecho
USA (51 posts) Bio
|
Date
| Reply #7 on Mon 12 May 2008 12:56 AM (UTC) |
Message
| Removed the all errors flag like you said and it seems to have compiled ok. It gave a TON of those errors though for every file. I'll check to see if it runs now. | Top |
|
Posted by
| Nick Gammon
Australia (23,140 posts) Bio
Forum Administrator |
Date
| Reply #9 on Mon 12 May 2008 01:14 AM (UTC) |
Message
| I would try to suppress the warnings, so next time you compile you will see genuine messages without having to wade through all the warnings. See if the other flag ( -Wno-write-strings ) does that for you. If not, maybe see if you can find which warning flag will do it. |
- Nick Gammon
www.gammon.com.au, www.mushclient.com | Top |
|
Posted by
| Whisperedecho
USA (51 posts) Bio
|
Date
| Reply #10 on Mon 12 May 2008 01:15 AM (UTC) |
Message
| Yep, that's what I did. No more warnings! :-D
Thank you VERY much for your help Nick. | Top |
|
Posted by
| Samson
USA (683 posts) Bio
|
Date
| Reply #11 on Mon 12 May 2008 10:59 PM (UTC) |
Message
| As we've mentioned several times before on the FUSS forums, this set of warnings is happening because GCC 4.2+ has enforced more strict usage of const char* and other string constants. Usually when they begin belching warnings about it in one version, they plan to make it a real error in a future release. So in the long run finding a way to fix it is pretty important. I more or less did so with AFKMud but it's a long and ultimately very boring task with not much reward to it in the end. Since AFKMud is C++ I just turned as much as I could into std::string. Not likely the best choice, but it works.
What would be nice is a fast easy way to fix the problem, other than short-circuiting the warning for now since GNU has a tendency to make that impossible later on. | Top |
|
Posted by
| Nick Gammon
Australia (23,140 posts) Bio
Forum Administrator |
Date
| Reply #12 on Tue 13 May 2008 12:32 AM (UTC) |
Message
| Well they acknowledge the warning is a nuisance, and I think fixing it will be a long and tedious task. Basically you need to find functions that return char * and change it to const char *, which will probably break heaps of other things.
I started doing a conversion to see how it would go, but as I expected, as soon as you change one thing, it affects another.
There are quite a few functions (PACKET_FUN is an example of something that is used to define a lot of them) that are defined as taking a char * argument, but are being fed constants.
To do it properly, you need to find every function that is fed a constant, and change its definition to only accept constants, or, cast the constant, which is not a great idea. eg.
Then you find that if this function passes its arguments to another function (these arguments now being variables) but the other function also expects char * and not const char *, then the new function needs to be changed as well.
Then somewhere along the way you find that a function passes both constants and variables, which starts making you tear your hair out.
With luck they won't enforce that as an error for a long time yet, I think it would cause too much angst amongst the general programming community. |
- Nick Gammon
www.gammon.com.au, www.mushclient.com | Top |
|
The dates and times for posts above are shown in Universal Co-ordinated Time (UTC).
To show them in your local time you can join the forum, and then set the 'time correction' field in your profile to the number of hours difference between your location and UTC time.
35,386 views.
It is now over 60 days since the last post. This thread is closed.
Refresh page
top