Register forum user name Search FAQ

Gammon Forum

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 ➜ SMAUG coding ➜ adding mccp

adding mccp

It is now over 60 days since the last post. This thread is closed.     Refresh page


Posted by Typhon   USA  (112 posts)  Bio
Date Fri 16 Apr 2004 02:48 PM (UTC)
Message
im trying to add mccp support to my mud and it seems that with alot of effort ive gotten no where. if i comment out #define MCCP in mud.h the mud compiles fine and runs no problems. however, when i try to compile it with mccp i get..
Quote:

make pr
hacking...comm.c...
comm.o(.text+0x2622): In function `write_to_descriptor':
/home/lod/src/comm.c:1687: undefined reference to `deflate'
comm.o(.text+0x7867): In function `compressStart':
/home/lod/src/comm.c:4319: undefined reference to `deflateInit_'
comm.o(.text+0x79bd): In function `compressEnd':
/home/lod/src/comm.c:4351: undefined reference to `deflate'
comm.o(.text+0x79f5):/home/lod/src/comm.c:4357: undefined reference to `deflateEnd'
collect2: ld returned 1 exit status
make: *** [pr] Error 1

i get the same problem if i compile it on a linux box or in cygwin.
tanks
typ.
Top

Posted by Greven   Canada  (835 posts)  Bio
Date Reply #1 on Fri 16 Apr 2004 06:42 PM (UTC)
Message
Sounds like your either missing
#include <zlib.h>
at the top of the file. If you have that, you may be missing the zlib package for cygwin, in which case you would need to go get it.

Nobody ever expects the spanish inquisition!

darkwarriors.net:4848
http://darkwarriors.net
Top

Posted by Typhon   USA  (112 posts)  Bio
Date Reply #2 on Sat 17 Apr 2004 01:27 AM (UTC)
Message
lol yea ive included zlid.h but both my copy of cygwin and the server both have the zlib package. still cant seem to figure it out :\
Top

Posted by Nick Gammon   Australia  (23,165 posts)  Bio   Forum Administrator
Date Reply #3 on Sat 17 Apr 2004 03:45 AM (UTC)
Message
These are link errors, right? You need to link against the zlib library. Make sure you have -lz as one of your options on the link line in the Makefile.

- Nick Gammon

www.gammon.com.au, www.mushclient.com
Top

Posted by Typhon   USA  (112 posts)  Bio
Date Reply #4 on Sat 17 Apr 2004 04:29 AM (UTC)
Message
thats there too :(
Top

Posted by Nick Gammon   Australia  (23,165 posts)  Bio   Forum Administrator
Date Reply #5 on Sat 17 Apr 2004 05:00 AM (UTC)
Message
Where did you get the MCCP code from?

- Nick Gammon

www.gammon.com.au, www.mushclient.com
Top

Posted by Typhon   USA  (112 posts)  Bio
Date Reply #6 on Sat 17 Apr 2004 05:06 AM (UTC)
Message
http://www.dotd.com/source/
i downloaded both mccp.patch and mccp2.patch i worked from tehre. my mud is highly modded so i couldnt patch it :\
had to do it all manually.
Top

Posted by Nick Gammon   Australia  (23,165 posts)  Bio   Forum Administrator
Date Reply #7 on Sat 17 Apr 2004 05:27 AM (UTC)
Message
I downloaded the mccp2 patch and applied it to smaug 1.4a.

I got the same messages you got, but changed the makefile to add the library, as I suggested earlier, and it linked OK:


L_FLAGS = $(OPT_FLAG) $(PROF) $(SOLARIS_LINK) $(NEED_CRYPT) -lz


However when testing I got these messages:


Sat Apr 17 14:24:17 2004 :: [*****] BUG: Starting compression for descriptor 10
Sat Apr 17 14:24:17 2004 :: [*****] BUG: Stopping compression for descriptor 10


So, it would seem it is not working perfectly, however you should be able to get it to compile. ;)


- Nick Gammon

www.gammon.com.au, www.mushclient.com
Top

Posted by Nick Gammon   Australia  (23,165 posts)  Bio   Forum Administrator
Date Reply #8 on Sat 17 Apr 2004 05:50 AM (UTC)

Amended on Sat 17 Apr 2004 05:52 AM (UTC) by Nick Gammon

Message
I worked out why it was turning compression off.

It seems the server is sending IAC WILL COMPRESS *and* IAC WILL COMPRESS2 (MCCP version 1, and MCCP version 2).

MUSHclient replies IAC DO COMPRESS2 and IAC DONT COMPRESS (indicating it supports MCCP version 2) however the IAC DONT COMPRESS turns off the compression.

I'm not sure where the bug is here exactly, but commenting out the code to detect turning off MCCP version 1 seemed to work. eg.


#ifdef MCCP
        if ( d->inbuf[i] == (signed char)IAC )
            iac=1;
        else if ( iac==1 && (d->inbuf[i] == (signed char)DO || d->inbuf[i] == (signed char)DONT) )
            iac=2;
        else if ( iac==2 )
        {
            iac = 0;
            /*if ( d->inbuf[i] == (signed char)TELOPT_COMPRESS )
            {
                if ( d->inbuf[i-1] == (signed char)DO )
                    compressStart(d, TELOPT_COMPRESS);
                else if ( d->inbuf[i-1] == (signed char)DONT )
                    compressEnd(d);
            }
            else */ if ( d->inbuf[i] == (signed char)TELOPT_COMPRESS2 )
            {
                if ( d->inbuf[i-1] == (signed char)DO )
                    compressStart(d, TELOPT_COMPRESS2);
                else if ( d->inbuf[i-1] == (signed char)DONT )
                    compressEnd(d);
            }
        }
        else
#endif


This could probably be handled better. For instance, you would remember which sort of compression you were doing so that rather than just calling compressEnd you would say something like:

if (d->compress_type == 1)
compressEnd (d);


- Nick Gammon

www.gammon.com.au, www.mushclient.com
Top

Posted by Typhon   USA  (112 posts)  Bio
Date Reply #9 on Sat 17 Apr 2004 06:17 AM (UTC)
Message
L_FLAGS = $(PROF) $(L) -lm -lz
:\ i still cant figure out why its not linking... the flag is there and zlib.h is on the server :\
Top

Posted by Typhon   USA  (112 posts)  Bio
Date Reply #10 on Sat 17 Apr 2004 06:45 AM (UTC)
Message
well
commenting out that part of the code worked
thanks nick :)
Top

Posted by Nick Gammon   Australia  (23,165 posts)  Bio   Forum Administrator
Date Reply #11 on Sat 17 Apr 2004 07:59 AM (UTC)
Message
Quote:

i still cant figure out why its not linking... the flag is there and zlib.h is on the server


zlib.h is needed for *compiling*. However for *linking* you need libz.a which is the library. When you use -lz it adds "lib" to the front and ".a" to the back, and then looks for it in the library directory, whatever that is.

- Nick Gammon

www.gammon.com.au, www.mushclient.com
Top

Posted by Typhon   USA  (112 posts)  Bio
Date Reply #12 on Sat 17 Apr 2004 08:04 AM (UTC)
Message
lol for whatevre reason the mud doesnt like that code that you commented out. thanks again :)
Top

Posted by Nick Gammon   Australia  (23,165 posts)  Bio   Forum Administrator
Date Reply #13 on Sat 17 Apr 2004 08:24 AM (UTC)
Message
Is the matter resolved or not? Did you ever get it to compile (and link)? In what way does it not like the commented-out code? Is there an error?

- Nick Gammon

www.gammon.com.au, www.mushclient.com
Top

Posted by Typhon   USA  (112 posts)  Bio
Date Reply #14 on Sat 17 Apr 2004 08:25 AM (UTC)
Message
yes it compiles now :)
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.


36,592 views.

It is now over 60 days since the last post. This thread is closed.     Refresh page

Go to topic:           Search the forum


[Go to top] top

Information and images on this site are licensed under the Creative Commons Attribution 3.0 Australia License unless stated otherwise.