Need help building winboard

Discussions about the WinBoard protocol. Here you can also report bugs and request new features.

Moderators: hgm, Andres Valverde

Re: Need help building winboard

Postby Charles Browne » 19 Dec 2008, 22:41

Charles Browne wrote:I'd like to be able to compile it the way H.G. Muller showed in the below post but I haven't been able to, I guess since this is Windows Me and he showed a way using Windows 2000. But I'm happy being able to do it with a cygwin.mak file.

http://www.open-aurec.com/wbforum/viewt ... 6854#31739



I've made some progress being able to compile Winboard the way that H.G. Muller showed in the above linked to post, the information that he supplied in the above post, he also included, along with a few more commands, in a read me file in his source files.

H.G.Muller in the above linked to post wrote:To share my acquired expertise for compiling under W2000 + Cygwin + gcc:
Code: Select all
gcc -I. -I.. -O2 -mwindows -mno-cygwin -c *.c
windres --use-temp-file --include-dir .. windres.rc -O coff -o windres.o
gcc -mwindows -mno-cygwin *.o -lwsock32 -lwinmm -o winboard.exe



I was typing the number 0 where it reads -O2 and -O when I should have been typing the upper case letter O (0 and O looked similar in notepad, where I had copy and pasted the instructions). Where it reads windres.rc in the above instructions, it should be winboard.rc (it's only a typo). Winboard.rc is in the source files read me file version of the instructions.

I would think that I did have windres installed on my computer since I was compiling using the cygwin.mak file but after getting errors associated with windres while trying to compile, I did a search for it on my computer and I could not locate it. I did search engine searches to try and get an idea of what windres was and finally installed/reinstalled it by installing/reinstalling the "binutils" package through cygwin.

In the source files read me file version of the instructions H.G. Muller included a strip winboard.exe command. After searching and trying to get a wee bit of understanding of what the strip command was (trying to make sure I wasn't going to blow anything up) I also ran that.


This is what I used, in the order listed below:

Code: Select all
gcc -I. -I.. -O2 -mwindows -mno-cygwin -c *.c
windres --use-temp-file --include-dir .. winboard.rc -O coff -o windres.o
gcc -mwindows -mno-cygwin *.o -lwsock32 -lwinmm -o winboard.exe
strip winboard.exe


The resultant compiled exe file compared to the cygwin.mak file compile was much smaller in size.


In my limited understanding of things I think others are most likely correct when they say that Windows ME isn't a good platform to compile on, but I'm happy with what has been done the last couple of days since I really expected total failure from the beginning.


I do have a question regarding the backend.c file for 4.3.14, and I will try to post that question in this thread later.
Charles Browne
 
Posts: 209
Joined: 26 May 2008, 00:30

Re: Need help building winboard

Postby Charles Browne » 20 Dec 2008, 03:50

I have some questions concerning the backend.c file for 4.3.14. I ask the questions because I would very much like to save a ready to compile version of the 4.3.14 source files to the archive of files that I save to disc.


Among the things that Rigao in an earlier post listed to do to get 4.3.14 to compile was this:

rigao wrote:3- Change backend.c file so it can compile -> go to line 5443, create a new line (which will be 5444) and add:
Code: Select all
int NrW=0, bare=0,NrPiece=0;




H.G. Muller in a reply post to Rigao wrote:

H.G.Muller wrote:1) The NrPiece should not be declared at all: this is a typo, and it should have been NrPieces in stead (which was declared).

2) "int NrW=0" should indeed be declared should indeed be declared where rigao had it. (I have it on line 5442, amongst the other int declarations.)

3) I have "static int bare = 1;" appended to the end of line 5415 in my version that works. It probably would also work if you declare it at the place where rigao did it. But important is that it should be declared as "static". (This only affects Shatranj anyway, it is for detecting the bare-king loss condition.)



Below are lines 5439 - 5444 of the backend.c file that is in the source files of Winboard 4.3.14 without any changes made to it yet (for anyone reading later, I added the line numbers. The line numbers are not in the actual file). I also did a search in the file for the word bare and found no use of the word bare in any entry that resembled static int bare = 1; or bare=0, but there was an entry in the file on line 5507 for "else bare = 1;".


Code: Select all
5439            if( appData.testLegality )
5440            {   /* [HGM] Some more adjudications for obstinate engines */
5441                int NrWN=0, NrBN=0, NrWB=0, NrBB=0, NrWR=0, NrBR=0,
5442                    NrWQ=0, NrBQ=0, bishopsColor = 0,
5443                    NrPieces=0, NrPawns=0, PawnAdvance=0, i, j, k;
5444                static int moveCount;





If I include the line Rigao posted (btw, if I just use this line it compiles with no problems):

Code: Select all
int NrW=0, bare=0,NrPiece=0;


and I alter the entry to reflect the changes H.G. Muller posted:

Code: Select all
int NrW=0, static int bare=1,NrPieces=0;



The entries in the backend.c file now look like this:

Code: Select all
5439            if( appData.testLegality )
5440            {   /* [HGM] Some more adjudications for obstinate engines */
5441                int NrWN=0, NrBN=0, NrWB=0, NrBB=0, NrWR=0, NrBR=0,
5442                    NrWQ=0, NrBQ=0, bishopsColor = 0,
5443                    NrPieces=0, NrPawns=0, PawnAdvance=0, i, j, k;
5444                int NrW=0, static int bare=1,NrPieces=0;
5445                static int moveCount;



And when I go to compile I get this:

Code: Select all
$ make -f cygwin.mak
gcc -I. -I.. -mno-cygwin -g   -c -o winboard.o winboard.c
gcc -I. -I.. -mno-cygwin -g   -c -o backend.o ../backend.c
../backend.c: In function `HandleMachineMove':
../backend.c:5444: error: parse error before "static"
../backend.c:5501: error: `bare' undeclared (first use in this function)
../backend.c:5501: error: (Each undeclared identifier is reported only once
../backend.c:5501: error: for each function it appears in.)
../backend.c:5504: error: `NrPiece' undeclared (first use in this function)
make: *** [backend.o] Error 1



Any help on how I should handle this? Through cygwin's installer I installed flex and bison (for the m4.exe) should they be needed. I'll do some further search engine looking tomorrow.


Another question, too.

Can you tell me if this whole line from the backend.c file only has to do with the variant Shatranj? or was it just the "static int bare = 1;" entry itself that was mentioned in a previous post that has to do with Shatranj?

Code: Select all
int NrW=0, static int bare=1,NrPieces=0;
Charles Browne
 
Posts: 209
Joined: 26 May 2008, 00:30

Re: Need help building winboard

Postby Don Cross » 20 Dec 2008, 04:23

Instead of this:
Code: Select all
int NrW=0, static int bare=1,NrPieces=0;


Try this:
Code: Select all
int NrW=0;
static int bare=1;
int NrPieces=0;


- Don
Author of Chenard - http://cosinekitty.com/chenard
User avatar
Don Cross
 
Posts: 29
Joined: 13 Nov 2008, 04:13
Location: Florida, USA

Re: Need help building winboard

Postby Charles Browne » 20 Dec 2008, 07:53

Don Cross wrote:Try this:
Code: Select all
int NrW=0;
static int bare=1;
int NrPieces=0;


- Don


Thanks for the reply. With the above I get:

Code: Select all
5439            if( appData.testLegality )
5440            {   /* [HGM] Some more adjudications for obstinate engines */
5441                int NrWN=0, NrBN=0, NrWB=0, NrBB=0, NrWR=0, NrBR=0,
5442                    NrWQ=0, NrBQ=0, bishopsColor = 0,
5443                    NrPieces=0, NrPawns=0, PawnAdvance=0, i, j, k;
5444                int NrW=0;
5445                static int bare=1;
5446                int NrPieces=0;
5447                static int moveCount;




Code: Select all
$ make -f cygwin.mak
gcc -I. -I.. -mno-cygwin -g   -c -o winboard.o winboard.c
gcc -I. -I.. -mno-cygwin -g   -c -o backend.o ../backend.c
../backend.c: In function `HandleMachineMove':
../backend.c:5446: error: redefinition of 'NrPieces'
../backend.c:5443: error: previous definition of 'NrPieces' was here
../backend.c:5506: error: `NrPiece' undeclared (first use in this function)
../backend.c:5506: error: (Each undeclared identifier is reported only once
../backend.c:5506: error: for each function it appears in.)
make: *** [backend.o] Error 1



I know I'm way out of my understanding with these compiler error messages and I've spent more time than I should have on it. I'll look into it later. Thank you much for the help though.

***********

Edit: edited out request for files.
Last edited by Charles Browne on 23 Dec 2008, 07:03, edited 2 times in total.
Charles Browne
 
Posts: 209
Joined: 26 May 2008, 00:30

Re: Need help building winboard

Postby rigao » 20 Dec 2008, 16:56

You are almost there, Charles. The error you receive is because you must change every (i think there is just one, but you better go to replace all in your text editor) 'NrPiece' for 'NrPieces'. It was just an s missing, and this is why it was not working.

Anyways, as far as i know, using my string will do, if you just want to play with the code (if not, you simply can use the already compiled winboard), because it will only affect very specific questions.

HGMuller: uci.c needs windows.h, not winboard.h. In windows.h it needs a function which otherwise is undefined, but i dont really remember which. If you are interested, i will look at it, because it was one of the first calls in uci.c, so i imagine i will find it with effort (but i dont have the uci.c here atm).
rigao
 
Posts: 63
Joined: 14 Dec 2008, 17:33

Re: Need help building winboard

Postby Charles Browne » 20 Dec 2008, 19:24

O.K., Rigao, putting an "s" on the end of the NrPiece with the missing "s" did the trick. Also that was the only NrPiece entry in the backend.c file that didn't have an "s" on the end of it.

Compiling 4.3.14 now gets this:
Code: Select all
$ make -f cygwin.mak
gcc -I. -I.. -mno-cygwin -g   -c -o winboard.o winboard.c
gcc -I. -I.. -mno-cygwin -g   -c -o backend.o ../backend.c
../backend.c: In function `HandleMachineMove':
../backend.c:5446: error: redefinition of 'NrPieces'
../backend.c:5443: error: previous definition of 'NrPieces' was here
make: *** [backend.o] Error 1


I removed the entry (string) "int NrPieces=0;" that I had added at line 5446 since it is saying it is already defined at 5443 and the entries in the backend.c file now look like this.


Code: Select all
5439            if( appData.testLegality )
5440            {   /* [HGM] Some more adjudications for obstinate engines */
5441                int NrWN=0, NrBN=0, NrWB=0, NrBB=0, NrWR=0, NrBR=0,
5442                    NrWQ=0, NrBQ=0, bishopsColor = 0,
5443                    NrPieces=0, NrPawns=0, PawnAdvance=0, i, j, k;
5444                int NrW=0;
5445                static int bare=1;
5446                static int moveCount;



And it compiled without any additional error messages. Leaving off the "int NrPieces=0;" entry at line 5446 is o.k. as to the functioning of the program??
Charles Browne
 
Posts: 209
Joined: 26 May 2008, 00:30

Re: Need help building winboard

Postby H.G.Muller » 20 Dec 2008, 20:29

The problem is that you have declared NrPieces=0 twice. It was already there, and you shouldn't have added it.

The error messages seem clear enough: in line 5446 you decleared NrPieces for the second time; the first declaration was at line 5443.

The 4.3.15 pre-release on my website now should have all problems fixed. I upgraded the winboard.h and resource.h files, included the shogi bitmaps, and fixed the include prooblem in uci.c (I hope).

It compiles and runs under Linux, and includes new pop-up menus there for "File->New Variant...", "File->New Shuffle Game...", "Options->Engine...", "Options->UCI...", and "Options->Time Control", similar to those of WinBoard. It also includes a Move-History and Engine-Output window, like Winboard_x, which you can pop up forom the "Mode" menu.
User avatar
H.G.Muller
 
Posts: 3453
Joined: 16 Nov 2005, 12:02
Location: Diemen, NL

Re: Need help building winboard

Postby Charles Browne » 20 Dec 2008, 21:44

H.G.Muller wrote:The 4.3.15 pre-release on my website now should have all problems fixed. I upgraded the winboard.h and resource.h files, included the shogi bitmaps, and fixed the include prooblem in uci.c (I hope).


I'll post the beginning compiler messages. Compiling with the updated cygwin.mak file.

Code: Select all
gcc -I. -I.. -mno-cygwin -g   -c -o uci.o ../uci.c
In file included from ./winboard.h:48,
                 from ../uci.c:37:
/usr/lib/gcc/i686-pc-mingw32/3.4.4/../../../../include/w32api/dlgs.h:177: error:
 parse error before "BYTE"
/usr/lib/gcc/i686-pc-mingw32/3.4.4/../../../../include/w32api/dlgs.h:179: error:
 parse error before "bBlue"
/usr/lib/gcc/i686-pc-mingw32/3.4.4/../../../../include/w32api/dlgs.h:180: error:
 parse error before "bExtra"
In file included from ../uci.c:37:
./winboard.h:52: error: `LF_FACESIZE' undeclared here (not in a function)
./winboard.h:54: error: parse error before "BYTE"
./winboard.h:54: warning: no semicolon at end of struct or union
./winboard.h:55: warning: data definition has no type or storage class
./winboard.h:59: error: parse error before "MyFontParams"
Charles Browne
 
Posts: 209
Joined: 26 May 2008, 00:30

Re: Need help building winboard

Postby H.G.Muller » 20 Dec 2008, 22:39

OK, stupid: I included winboard.h in uci.c in stead of windows.h... On top of it, I included it too late: it should have been included before the common.h include.

Try the uci.c that is now on my website:

http://home.hccnet.nl/h.g.muller/uci.c
User avatar
H.G.Muller
 
Posts: 3453
Joined: 16 Nov 2005, 12:02
Location: Diemen, NL

Re: Need help building winboard

Postby Charles Browne » 20 Dec 2008, 22:57

H.G.Muller wrote:Try the uci.c that is now on my website:

http://home.hccnet.nl/h.g.muller/uci.c



Code: Select all
windres --use-temp-file --include-dir .. winboard.rc -O coff -o wbres.o
gcc -I. -I.. -mno-cygwin -g   -c -o wclipbrd.o wclipbrd.c
gcc -I. -I.. -mno-cygwin -g   -c -o woptions.o woptions.c
gcc -I. -I.. -mno-cygwin -g   -c -o uci.o ../uci.c
gcc -I. -I.. -mno-cygwin -g   -c -o wengineoutput.o wengineoutput.c
gcc -I. -I.. -mno-cygwin -g   -c -o wevalgraph.o wevalgraph.c
gcc -I. -I.. -mno-cygwin -g   -c -o whistory.o whistory.c
gcc -I. -I.. -mno-cygwin -g   -c -o wlayout.o wlayout.c
gcc -I. -I.. -mno-cygwin -g   -c -o wplugin.o wplugin.c
gcc -I. -I.. -mno-cygwin -g   -c -o wsnap.o wsnap.c
gcc -I. -I.. -mno-cygwin -mwindows -g  winboard.o backend.o parser.o moves.o lis
ts.o gamelist.o pgntags.o wedittags.o wgamelist.o zippy.o wsockerr.o wbres.o wcl
ipbrd.o woptions.o uci.o wengineoutput.o wevalgraph.o whistory.o wlayout.o wplug
in.o wsnap.o  \
        -lwsock32 -lwinmm \
        -o winboard.exe
zippy.o: In function `ZippyInit':
/cygdrive/c/00/winboard/../zippy.c:192: undefined reference to `_srandom'
zippy.o: In function `Speak':
/cygdrive/c/00/winboard/../zippy.c:311: undefined reference to `_random'
/cygdrive/c/00/winboard/../zippy.c:326: undefined reference to `_random'
zippy.o: In function `ZippyControl':
/cygdrive/c/00/winboard/../zippy.c:549: undefined reference to `_random'
zippy.o: In function `ZippyConverse':
/cygdrive/c/00/winboard/../zippy.c:605: undefined reference to `_random'
/cygdrive/c/00/winboard/../zippy.c:618: undefined reference to `_random'
zippy.o:/cygdrive/c/00/winboard/../zippy.c:638: more undefined references to `_r
andom' follow
collect2: ld returned 1 exit status
make: *** [winboard.exe] Error 1
Charles Browne
 
Posts: 209
Joined: 26 May 2008, 00:30

Re: Need help building winboard

Postby H.G.Muller » 20 Dec 2008, 23:52

Weird! This must be a difference between Cygwin versions. You should change the definition of HAVE_RANDOM in config.h from 1 to 0, then it should work. But on my Cygwin it gives no problem with HAVE_RANDOM = 1.
User avatar
H.G.Muller
 
Posts: 3453
Joined: 16 Nov 2005, 12:02
Location: Diemen, NL

Re: Need help building winboard

Postby Charles Browne » 21 Dec 2008, 00:08

H.G.Muller wrote:You should change the definition of HAVE_RANDOM in config.h from 1 to 0, then it should work.


Correct, changing 1 to 0 and it compiled.

So much to know isn't there.


Checked Help > About Winboard

xboard 4.3.15 ("Winboard_F")


Also, when I replaced the cygwin.mak file in the source with the updated file I didn't have to comment out the three lines in this section of the mak file.

Code: Select all
# Update the help file if necessary
$(proj).hlp : $(proj).rtf
   $(HC) $(proj).hpj
   cat $(proj).err
Charles Browne
 
Posts: 209
Joined: 26 May 2008, 00:30

Re: Need help building winboard

Postby Charles Browne » 21 Dec 2008, 10:46

I'm posting this to make something clear. I can compile 4.3.15 (beta) from source, so on my end here I am fine.

Maybe you already know about this and it will be insignificant, but I will post it in case it enlightens in some way.


H.G.Muller wrote:You should change the definition of HAVE_RANDOM in config.h from 1 to 0, then it should work.


1.) I was compiling with the cygwin.mak file which points to the config.h file in the winboard directory.

2.) When I changed the HAVE_RANDOM entry in the config.h file I changed the entry to the file that was in the xboard15 directory. I really did not realize there was another config.h file in the source files so I changed the entry in the file I saw first, the one in the xboard directory.

3.) As already noted in the above post. The exe compiled without error (or warnings) when the 1 was changed to 0.

4.) When compiling with the cygwin.mak file, the file version in the help > About box is - xboard 4.3.15 ("Winboard_F")



Now when I go to compile with the below method and have the necessary files in one folder, I am using the config.h file from the winboard directory and I have kept the HAVE_RANDOM entry at its default state of 1 in the file, and I actually deleted the config.h file from the xboard15 directory while compiling with this method. -

Code: Select all
gcc -I. -I.. -O2 -mwindows -mno-cygwin -c *.c
windres --use-temp-file --include-dir .. winboard.rc -O coff -o windres.o
gcc -mwindows -mno-cygwin *.o -lwsock32 -lwinmm -o winboard.exe



And it compiled without problems.

The version number I get when compiling with this method is - Winboard 4.3.15K ("Winboard_F")


Like I wrote, I am fine and I am not seeking help or understanding here. I only post it in case it may have some value to you. No need to reply.
Charles Browne
 
Posts: 209
Joined: 26 May 2008, 00:30

Re: Need help building winboard

Postby Denis P. Mendoza » 22 Dec 2008, 02:16

HG,

Sorry to interrupt but where could I get this WBSRC4.3.15 beta sources. I'm also interested in compiling this new one.

Thanks.

Denis
I'm proud to be a Pinoy! Ikaw dre?
Denis P. Mendoza
 
Posts: 84
Joined: 31 Oct 2007, 16:38
Location: Philippines

Re: Need help building winboard

Postby H.G.Muller » 22 Dec 2008, 20:33

Charles Browne wrote:Like I wrote, I am fine and I am not seeking help or understanding here. I only post it in case it may have some value to you. No need to reply.

OK, thanks very much. I am kind of done with xboard, and returning to WinBoard now to test if I haven't broken anything. This thread was extremely helpful, and I can use the cygwin makefile now to compile the tree 'as is'. Especialy the need for deleting the config.h in the parent (xboard) directory had me baffled. Apparently there is also a definition of HAVE_RANDOM there, and because zippy.c is including a config.h, but is in the xboard directory, it prefers the xboard config.h over that of the winboard directory. So I kept getting errors for calls to the non-existent 'random' from zippy.c only, despite the fact that HAVE_RANDOM was set to false in the winboard/config.h.
User avatar
H.G.Muller
 
Posts: 3453
Joined: 16 Nov 2005, 12:02
Location: Diemen, NL

Re: Need help building winboard

Postby Charles Browne » 22 Dec 2008, 22:57

H.G.Muller wrote:Especialy the need for deleting the config.h in the parent (xboard) directory had me baffled.


Right. Sorry. The config.h file could have just been kept in the xboard directory of course. There was no need for me to remove it.
Charles Browne
 
Posts: 209
Joined: 26 May 2008, 00:30

Re: Need help building winboard

Postby H.G.Muller » 22 Dec 2008, 23:50

Yes, there was! I did leave it in the xboard directory, and if you do, the cygwin.makk does not work! :shock:
User avatar
H.G.Muller
 
Posts: 3453
Joined: 16 Nov 2005, 12:02
Location: Diemen, NL

Re: Need help building winboard

Postby Charles Browne » 23 Dec 2008, 00:15

H.G.Muller wrote:Yes, there was! I did leave it in the xboard directory, and if you do, the cygwin.makk does not work! :shock:


O.K, but if I compile by the cygwin.mak method, leaving the config.h file in the xboard directory does work if I change the HAVE_RANDOM entry in the file from 1 to 0 (except for xboard being shown in Help > About Winboard). Honestly, as of yet I haven't tried compiling by the cygwin.mak file with the config.h file in the xboard directory removed. So for me that it does compile with the xboard config.h file removed is a - :shock:.


When I posted about having deleted the config.h file from the xboard directory I was talking about when compiling by the below method, where the necessary .c files and the .h files and parser.l file are moved to the winboard directory. In this case there was no need for me to do anything to the config.h file in the xboard directory and I could have just left it there.

Code: Select all
gcc -I. -I.. -O2 -mwindows -mno-cygwin -c *.c
windres --use-temp-file --include-dir .. winboard.rc -O coff -o windres.o
gcc -mwindows -mno-cygwin *.o -lwsock32 -lwinmm -o winboard.exe



Anyway, everything is again in your capable hands now.


When you finally release your finished source files to us, the public. Don't include that wengineo.c file. :D
Charles Browne
 
Posts: 209
Joined: 26 May 2008, 00:30

Re: Need help building winboard

Postby Charles Browne » 23 Dec 2008, 02:51

H.G.Muller wrote:Yes, there was! I did leave it in the xboard directory, and if you do, the cygwin.makk does not work! :shock:


Charles Browne wrote:Honestly, as of yet I haven't tried compiling by the cygwin.mak file with the config.h file in the xboard directory removed.


You are correct, I just compiled it with the cygwin.mak file, first removing the config.h file from the xboard directory and it compiled without any problems. The config.h file in the winboard directory was left at the default of HAVE_RANDOM 1. And the "Help > About Winboard" reads " Winboard 4.3.15K ("Winboard_F")".


Was the config.h file put in the xboard directory in the 4.3.15 (beta) source files because it has something to do with your reworking of xboard?
Charles Browne
 
Posts: 209
Joined: 26 May 2008, 00:30

Re: Need help building winboard

Postby H.G.Muller » 23 Dec 2008, 16:15

Indeed, the config.h in xboard is the one needed for xboard. Apparently make gets confused because they have the same name, although they are in different directories. What amazes me, however, is thatt there are many other files that are needed for WinBoard in the xboard directory (e.g. backend.h), which also include config.h, but they all use the correct config.h (otherise they would have given errors for random and srandom as well).
User avatar
H.G.Muller
 
Posts: 3453
Joined: 16 Nov 2005, 12:02
Location: Diemen, NL

PreviousNext

Return to WinBoard development and bugfixing

Who is online

Users browsing this forum: No registered users and 3 guests