Failing to compile Putty for Windows on Ubuntu

1

1

I am trying to compile putty for windows on ubuntu 14.04. got the source from here:

http://the.earth.li/~sgtatham/putty/latest/putty-0.63.tar.gz

This is what I did until I got the error:

[17:45:20][~/putty-0.63]$ perl mkfiles.pl 

[17:46:42][~/putty-0.63]$ cd windows/

[17:46:44][~/putty-0.63/windows]$ make VER="-DSNAPSHOT=$(date '+%Y-%m-%d') -DSVN_REV='$(svnversion)' -DMODIFIED" TOOLPATH=i586-mingw32msvc- -f Makefile.cyg putty.exe
.
.
.

i586-mingw32msvc-windres   --define WIN32=1 --define _WIN32=1 --define WINVER=0x0400 --define SNAPSHOT=2015-02-18 --define SVN_REV='Unversioned directory' --define MODIFIED ../windows/putty.rc -o putty.res.o

i586-mingw32msvc-gcc   -mno-cygwin -Wall -O2 -D_WINDOWS -DDEBUG -DWIN32S_COMPAT -D_NO_OLDNAMES -DNO_MULTIMON -DNO_HTMLHELP -DNO_SECUREZEROMEMORY -I.././ -I../charset/ -I../windows/ -I../unix/ -I../macosx/ -DSECURITY_WIN32 -D_WIN32_IE=0x0500 -DWINVER=0x0500 -D_WIN32_WINDOWS=0x0410 -D_WIN32_WINNT=0x0500 -DSNAPSHOT=2015-02-18 -DSVN_REV='Unversioned directory' -DMODIFIED -c ../version.c

../version.c:63: warning: division by zero

../version.c:63: error: enumerator value for גvorpal_swordג is not an integer constant
make: *** [version.o] Error 1

Anything I can do about it?

Yair Eshel Cahansky

Posted 2015-02-18T15:49:49.253

Reputation: 13

You need to fix the compiler error. – Ramhound – 2015-02-18T15:53:54.907

You know, I think I got this part figured. What do I need to fix? This is a code I downloaded and complied - changed nothing about it – Yair Eshel Cahansky – 2015-02-18T16:16:22.620

The problem exists within Version.c – Ramhound – 2015-02-18T16:17:42.510

isnt this question better suited for stackoverflow? – jiggunjer – 2015-02-18T16:41:00.257

Answers

1

The values of the SNAPSHOT and the SVN_REV are used to compose a value of the sshver like:

sshver = "PuTTY-Snapshot-SNAPSHOT:rSVN_REV"

With

SNAPSHOT=2015-02-18
SVN_REV=Unversioned directory

this makes

sshver = "PuTTY-Snapshot-2015-02-18:rUnversioned directory"

What violates an assertion at the last line of the version.c that the sshver must be at most 40 characters long.

/*
 * SSH local version string MUST be under 40 characters. Here's a
 * compile time assertion to verify this.
 */
enum { vorpal_sword = 1 / (sizeof(sshver) <= 40) };

They obviously do not test their build for the "Unversioned directory" scenario.

Not sure, where the "Unversioned directory" comes from though (it's not in source code).

Solutions:

Martin Prikryl

Posted 2015-02-18T15:49:49.253

Reputation: 13 764