Need Help Getting GCC Working?!?

Discussion of chess software programming and technical issues.

Moderator: Ras

User avatar
Steve Maughan
Posts: 1315
Joined: Wed Mar 08, 2006 8:28 pm
Location: Florida, USA

Need Help Getting GCC Working?!?

Post by Steve Maughan »

Are there any Ninja compiler experts who can help me?

I have Maverick doing error free perft in a Microsoft Visual Studio Express 2012 environment. I was about to plunge into developing the evaluation function. But then I thought now is probably a good time to get GCC working. A couple of reasons for this:

1. Since Maverick is a bitboard program I'd like it to work on a 64 bit platform (I think it is possible with Express, but so far I haven't been able to get it to work)

2. Once I have 64 but working I can utilize the SSE 4.2 bit-flipping intrinsics (e.g. popcount etc.) to get a nice speed-up

3. I've heard the latest version of GCC is as good as, or better than, Microsoft for 64 bit compiles (so why pay $500 for Microsoft's Professional version).

But the task doesn't seem to be trivial. Although I'm certainly no expert when it comes to C or C++ development.

Can anyone help me - I'd certainly appreciate it!

You can find the zipped source, along with all the MSVC file here:

http://goo.gl/VJW73

Using Express 2012 it compiles nicely. I have it set to use multi-threads (which I use for getting user input) and it's compiling as C++ (mainly for variable declarations in the middle of a procedure). The only real command which works is "testperft".

I've tried to get it working using the NetBeans and Code::Blocks IDEs in 32 bit mode but to no avail. The GCC compiler seems to get stuck on

Code: Select all

t_chess_move_type 
enumerated type whoch occurs in

Code: Select all

t_move_record
- I've no idea why!

Any help appreciated!

Many Thanks,

Steve
lucasart
Posts: 3243
Joined: Mon May 31, 2010 1:29 pm
Full name: lucasart

Re: Need Help Getting GCC Working?!?

Post by lucasart »

Steve Maughan wrote: http://goo.gl/VJW73
Your zipped source code is 9 MB. What did you put in there? A Trojan horse :p

I cannot compile it either, because it's infamously non portable. Your main.c starts with

Code: Select all

#include <windows.h>
but doens't even use anything from windows.h !?
Theory and practice sometimes clash. And when that happens, theory loses. Every single time.
mar
Posts: 2672
Joined: Fri Nov 26, 2010 2:00 pm
Location: Czech Republic
Full name: Martin Sedlak

Re: Need Help Getting GCC Working?!?

Post by mar »

I have succeeded in compiling Maverick with g++ (mingw), it runs but it doesn't start searching at all when asked to.
I succeeded in compiling under VS2012 as c++ code, but I got these warnings:
Source\genmoves.cpp(308): warning C4333: '>>' : right shift by too large amount, data loss
Source\genmoves.cpp(312): warning C4333: '>>' : right shift by too large amount, data loss
Where you shift right an unsigned char by 8, I wonder if that was intended?

test.cpp(49): warning C4715: 'test_bitscan' : not all control paths return a value

PS you don't need to include .sdf in the archive.
jundery
Posts: 18
Joined: Thu Mar 14, 2013 5:57 am

Re: Need Help Getting GCC Working?!?

Post by jundery »

Steve Maughan wrote:
I've tried to get it working using the NetBeans and Code::Blocks IDEs in 32 bit mode but to no avail. The GCC compiler seems to get stuck on

Code: Select all

t_chess_move_type 
enumerated type whoch occurs in

Code: Select all

t_move_record
- I've no idea why!
Compiling this under MinGW and gcc 4.8 64bit your problem seems to be the 3 inline function definitions in bitboards.c need to be in a header (so they are visible to any tralnslation unit using them). Moving that code and it compiled and ran testperft as 64bit.
Sven
Posts: 4052
Joined: Thu May 15, 2008 9:57 pm
Location: Berlin, Germany
Full name: Sven Schüle

Re: Need Help Getting GCC Working?!?

Post by Sven »

mar wrote:PS you don't need to include .sdf in the archive.
Same for the .suo file.

Sven
User avatar
Steve Maughan
Posts: 1315
Joined: Wed Mar 08, 2006 8:28 pm
Location: Florida, USA

Re: Need Help Getting GCC Working?!?

Post by Steve Maughan »

Hi James,

Thanks. They are already in "procs.h". Apologies for the newbie questions but can I ask where you put them so that it compiled? Also, what environment did you use to compile it?

Thanks,

Steve
User avatar
Steve Maughan
Posts: 1315
Joined: Wed Mar 08, 2006 8:28 pm
Location: Florida, USA

Re: Need Help Getting GCC Working?!?

Post by Steve Maughan »

Hi Lucas,

Sorry - one of the MSVC files was massive. I didn't need it, so removed it. And I've removed <windows.h>

Thanks,

Steve
User avatar
Steve Maughan
Posts: 1315
Joined: Wed Mar 08, 2006 8:28 pm
Location: Florida, USA

Re: Need Help Getting GCC Working?!?

Post by Steve Maughan »

Hi Martin,

The shift were intended for pawn moves. There is no data loss since there are never any pawns on the first or eighth row.

I'll take a look at test_bitscan.

I still can't get it to compile. Can I ask what GCC IDE / environment did you use to compile it? Did it start searching after typing "testperft"?

Thanks,

Steve
User avatar
Steve Maughan
Posts: 1315
Joined: Wed Mar 08, 2006 8:28 pm
Location: Florida, USA

Re: Need Help Getting GCC Working?!?

Post by Steve Maughan »

Thanks Sven - noted!

Steve
jundery
Posts: 18
Joined: Thu Mar 14, 2013 5:57 am

Re: Need Help Getting GCC Working?!?

Post by jundery »

Steve Maughan wrote:Hi James,

Thanks. They are already in "procs.h". Apologies for the newbie questions but can I ask where you put them so that it compiled? Also, what environment did you use to compile it?
Hi, I actually meant the code, not just the definition (function signature).

As for the environment I just grabbed a a build from http://sourceforge.net/projects/mingw-w ... %20Builds/ (the actual one was http://sourceforge.net/projects/mingw-w ... 8-release/) and ran the setup script in it, then I just ran "gcc *.c -o Maverick.exe" to build from the source directory.

You'll need also need the MSYS tools or cygwin in your path environment variable but you can get that from a real release and 32bit is fine is they are just supporting tools.