Compiling Winboard

Programming Topics (Computer Chess) and technical aspects as test techniques, book building, program tuning etc

Moderator: Andres Valverde

Compiling Winboard

Postby BrettVsop » 21 Nov 2007, 21:39

I would like to compile Winboard and play around with the code a bit.

I am not very familiar with compiling other peoples code, or make files. I have been spoiled by Visual Studios. Could someone help me compile the source? I need Borland right? Does it matter which version?

Thanks.
BrettVsop
 
Posts: 50
Joined: 04 Nov 2007, 18:32

Re: Compiling Winboard

Postby H.G.Muller » 22 Nov 2007, 16:25

I only did it using gcc and cygwin

I did not use any make files either. If you want to build it all the way from scratch, assuming that you have the complete tree as from the download from Tim Mann's website:

From the winboard directory do:

windres --use-temp-file --include-dir .. winboard.rc -O coff -o wbres.o
gcc -I. -I.. -O2 -mwindows -mno-cygwin -c *.c

then go to the parent directory and do

flex -oparser.c -L parser.l
gcc -I. -I.. -O2 -mwindows -mno-cygwin -c *.c

collect all the *.o files that you need in one directory, and do

gcc -mwindows -mno-cygwin *.o -lwsock32 -lwinmm -o winboard.exe
User avatar
H.G.Muller
 
Posts: 3453
Joined: 16 Nov 2005, 12:02
Location: Diemen, NL

Re: Compiling Winboard

Postby BrettVsop » 22 Nov 2007, 19:22

Ok assume I do not have any of the programs necessary to compile.

I need to get gcc and cygwin? I thought cygwin was for compiling linux executables.

I need to get flex. What is winres, is that another program that I need to get?

Also I may be missing some of the libraries as well. I have Visual Studios version 6 and I tried to compile with it. Since it is a newer version the code will not compile, but some of the problems I saw were missing libraries.

edit: Oh I guess I should of mentioned I am looking to create a windows executable.
BrettVsop
 
Posts: 50
Joined: 04 Nov 2007, 18:32

Re: Compiling Winboard

Postby Daniel Mehrmann » 25 Nov 2007, 00:06

BrettVsop wrote:Ok assume I do not have any of the programs necessary to compile.

I need to get gcc and cygwin? I thought cygwin was for compiling linux executables.

I need to get flex. What is winres, is that another program that I need to get?

Also I may be missing some of the libraries as well. I have Visual Studios version 6 and I tried to compile with it. Since it is a newer version the code will not compile, but some of the problems I saw were missing libraries.

edit: Oh I guess I should of mentioned I am looking to create a windows executable.


It works perfectly under VC 6 and newer MS compilers (Studio's).

btw: the winboard sources include a vc6 makefile already. Maybe you should read the documentation first ;-) (RTFM)

Best,
Daniel
User avatar
Daniel Mehrmann
 
Posts: 127
Joined: 02 Oct 2004, 06:10
Location: Germany

Re: Compiling Winboard

Postby BrettVsop » 25 Nov 2007, 19:56

I tried that before I posted. First thing that happened was it could not find a few of the source files. So I had to move some of the source files to the winboard directory. Next it was missing header files. So I found some header files off of the internet and copied them into the directory.

The current error that I am getting is:
.\sys/time.h(11) : error C2061: syntax error : identifier '__THROW'

It seems like it was created for Visual Studios 5, not 6. I believe that if I had 5, I would not be having any problems. This stupid program cannot compile any source (that I have seen or written) in any version, but the version it was written for. I have version 6 and 2005 installed for just this reason.
BrettVsop
 
Posts: 50
Joined: 04 Nov 2007, 18:32

Re: Compiling Winboard

Postby Daniel Mehrmann » 25 Nov 2007, 23:35

BrettVsop wrote:I tried that before I posted. First thing that happened was it could not find a few of the source files. So I had to move some of the source files to the winboard directory. Next it was missing header files. So I found some header files off of the internet and copied them into the directory.

The current error that I am getting is:
.\sys/time.h(11) : error C2061: syntax error : identifier '__THROW'

It seems like it was created for Visual Studios 5, not 6. I believe that if I had 5, I would not be having any problems. This stupid program cannot compile any source (that I have seen or written) in any version, but the version it was written for. I have version 6 and 2005 installed for just this reason.


I don't know which sources you're using. Please use the current cvs repository of winboard. It includes a makefile for Visuial Studio 6 and 2005/2003.

You'll find it here: http://savannah.gnu.org/projects/xboard/

Best,
Daniel
User avatar
Daniel Mehrmann
 
Posts: 127
Joined: 02 Oct 2004, 06:10
Location: Germany

Re: Compiling Winboard

Postby Sven Schüle » 26 Nov 2007, 00:27

Daniel Mehrmann wrote:I don't know which sources you're using. Please use the current cvs repository of winboard. It includes a makefile for Visuial Studio 6 and 2005/2003.

You'll find it here: http://savannah.gnu.org/projects/xboard/

Hi Daniel,

I think most people would like to download sources as a *.tar.gz file or similar, is this possible "easily" from the cvs repository? Or is there some archive to download which contains the current sources?

As far as I can tell this seems not to be the most recent source tree, if you say that the CVS repository has new stuff. Nevertheless I tried the GNU tree with VS2005, and after some steps I have been successful in compiling it.

@BrettVSOP: these were my steps based on the GNU download above.

- Converting winboard.dsw or using any of the *.mak files directly did not work for me, some ntwin32.mak was missing.

- Winboard_X sources seemed to cause similar trouble for me here with VS2005. Maybe I did something wrong.

- So I created a new project from scratch, added all *.c/*.h/*.rc from winboard folder and the following from the root folder:
backend*, common.h, gamelist.c, lists.*, moves.*, parser.*, pgntags.c, resource.h, zippy.*

- Extended include path for C++ compiler by adding root folder, winboard folder and the "Include" directory of the Platform SDK (you need to have this anyway for C/C++ development with MSVC, I have "Microsoft Platform SDK for Windows Server 2003 R2" which you can download for free)

- Extended also include path for resource compiler by adding Platform SDK "Include"

- Extended library path for linker by adding Platform SDK "Lib" directory

- Added the following additional libs under "Linker -> Command Line -> Additional options":
user32.lib gdi32.lib comdlg32.lib winmm.lib ws2_32.lib advapi32.lib

- Added under "C++ -> Preprocessor -> Preprocessor definitions" the value "_CRT_SECURE_NO_DEPRECATE" (to avoid many warnings, although not all of them could be removed)

- Made the following source changes:

winboard.c, below line 84 (#include "defaults.h") added "#undef wReserved"

backend.c, below line 87 (#endif) added
#if HAVE_FTIME
#include <sys/timeb.h>
#endif
and removed line 9438 "#include <sys/timeb.h>"

parser.c, commented out line 12 "#include <unistd.h>"


I hope I did not do complete nonsense, at least I could compile and run WinBoard this way. Perhaps too much of work that someone else had already done before, but as I mentioned, I did not find a downloadable archive with most recent sources.

Hope this helps!

Sven
User avatar
Sven Schüle
 
Posts: 240
Joined: 26 Sep 2004, 20:19
Location: Berlin, Germany

Re: Compiling Winboard

Postby PulsarMike » 30 Nov 2007, 05:43

I downloaded the source. 4.26 was available at manns site but 4.27 came as an empty file. I went to the repository and found this make file:

http://cvs.savannah.gnu.org/viewvc/xboa ... iew=markup

but i got the following error with visual studio 2003

fatal error U1052: file 'NTWIN32.MAK' not found

i googled and it said that file should be in the include directory and its not, no make files are, not sure i'm going about this right.

thanks
Mike
User avatar
PulsarMike
 
Posts: 83
Joined: 27 Nov 2007, 00:01
Location: California

Re: Compiling Winboard

Postby PulsarMike » 30 Nov 2007, 09:45

I found the solution to that error:

fatal error U1052: file 'NTWIN32.MAK' not found

you need to download Microsoft Platform Sdk and it will include the ntwin32.mak file ( forget where eathier in the bin or include directory) and i found i had to copy it to the directory were the winoboard code and make file was.

I'm running into another problem, i get that in winboard.c it cant find 'windows.h'. Now i've set the directory that windows.h is in to my path and i changed my include enviromental variable to map to where windows.h is. this is what i have for include:

C:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\include\

and windows.h is not in there. Any idea what i'm doing wrong. i'd hate to have to hard code the path of the includes into every include variable. yes i closed the dos console every time i wanted to update my path and i even rebooted.

thanks
Mike Adams
User avatar
PulsarMike
 
Posts: 83
Joined: 27 Nov 2007, 00:01
Location: California

Re: Compiling Winboard

Postby PulsarMike » 30 Nov 2007, 10:37

figured out the include paths. apparently there are two include variables, user and system.

it compiled but wont link. i have an unresolved external and it says its referenced in two function. outputmaybetelnet in backend.c and lffrommfp referenced in winboard.c. i dont see any common function caled in those two functions.



any ideas?
User avatar
PulsarMike
 
Posts: 83
Joined: 27 Nov 2007, 00:01
Location: California

Re: Compiling Winboard

Postby BrettVsop » 30 Nov 2007, 19:03

Is there this much work compiling the source in every compiler?

Thanks for the step by step Sven. I am still trying to get it running though. I am trying to figure out how to do some of the steps. (I usually do not mess around in the options area)

I am trying to get a copy of Visual Studios v5. I might be able to get a hold of it, and I think, if i do, i will be able to compile it without all of these steps.
BrettVsop
 
Posts: 50
Joined: 04 Nov 2007, 18:32

Re: Compiling Winboard

Postby Sven Schüle » 01 Dec 2007, 21:38

BrettVsop wrote:Is there this much work compiling the source in every compiler?

Thanks for the step by step Sven. I am still trying to get it running though. I am trying to figure out how to do some of the steps. (I usually do not mess around in the options area)

I am trying to get a copy of Visual Studios v5. I might be able to get a hold of it, and I think, if i do, i will be able to compile it without all of these steps.

Apart from the Platform SDK download+install it should not take longer than ten minutes to apply these changes with VS2005. I think it took me around 20 minutes to find out what to do.

I would not bother with the methusalem VS5, and also I think it might become a "dead end". VS2005 is by far the better environment.

Project options can be changed via right mouseclick on the project name in the "Solution explorer" -> Properties -> Configuration Properties, and then in most cases either C/C++ or Linker. (Just in case you did not find it, at least that's what I understood from your posting.)

Sven
User avatar
Sven Schüle
 
Posts: 240
Joined: 26 Sep 2004, 20:19
Location: Berlin, Germany

Re: Compiling Winboard

Postby Denis P. Mendoza » 04 Dec 2007, 19:54

Compiling Winboard is very tricky sometimes, but these links could supply some bit of ideas to make it work:

From a ElephantEye - a Chinese Chess (XiangQi) author:
http://sourceforge.net/project/showfile ... _id=196069

From A Robert Jurjevic WB version, thanks to Tim Mann site
http://homepage.ntlworld.com/robert.jur ... /WinBoard/

I'm sure these samples would be a great help to make a nice compile of Winboard.
I'm proud to be a Pinoy! Ikaw dre?
Denis P. Mendoza
 
Posts: 84
Joined: 31 Oct 2007, 16:38
Location: Philippines

Re: Compiling Winboard

Postby PulsarMike » 07 Dec 2007, 18:27

winboard_rj got me to be able to compile winboard. it has a valid winboard project file for visual studio 6. i just built winboard_rj out of box then coppied on top teh files from winboard. then compiled again it worked. Did the same thing with the winboardx files and got some link errors. realized there were some new .c files in winboardx so i added them to the project and it worked.

Mike
User avatar
PulsarMike
 
Posts: 83
Joined: 27 Nov 2007, 00:01
Location: California

Re: Compiling Winboard

Postby Denis P. Mendoza » 09 Dec 2007, 23:27

PulsarMike wrote:winboard_rj got me to be able to compile winboard. it has a valid winboard project file for visual studio 6. i just built winboard_rj out of box then coppied on top teh files from winboard. then compiled again it worked. Did the same thing with the winboardx files and got some link errors. realized there were some new .c files in winboardx so i added them to the project and it worked.

Mike


That's great! I also got it to work the way you did it. I already said this on similar thread at: http://64.68.157.89/forum/viewtopic.php?t=18100

I'm also interested to see your modified winboard to support shatranj.
I'm proud to be a Pinoy! Ikaw dre?
Denis P. Mendoza
 
Posts: 84
Joined: 31 Oct 2007, 16:38
Location: Philippines

Re: Compiling Winboard

Postby PulsarMike » 12 Dec 2007, 18:50

The code change to support shatranj is minor. And it was written by orionsknight of icc actually but he said it would be ok if i distributed it with my copies of winboard and xboard so people could utilize it and make my engine work which plays shatranj.

what it does is it modifies moves.c in two spots.

case whitebishop
case blackbishop

the code becomes an if( variant shatranj )

do this
else
normal winboard code

case whitequeen
case blackqueen is the same idea.

anyone in dire need of such code and cant wait for me to release feel free to email me at adam16mr at chessclub dot com

move legality still has to be off for the code to work i believe.

in xboard i got an error were winboard changed the variant from shatranj to variant -1 unknown and i had to hack to make the code work for both cases. not sure why it did that. in winboard it works clean.


Mike
User avatar
PulsarMike
 
Posts: 83
Joined: 27 Nov 2007, 00:01
Location: California


Return to Programming and Technical Discussions

Who is online

Users browsing this forum: No registered users and 38 guests