Compiling Problem on Raspberry Pi 2

Discussion of chess software programming and technical issues.

Moderators: hgm, Dann Corbit, Harvey Williamson

User avatar
WinPooh
Posts: 267
Joined: Fri Mar 17, 2006 8:01 am
Location: Russia
Full name: Vladimir Medvedev

Re: Compiling Problem on Raspberry Pi 2

Post by WinPooh »

chess1974lover wrote:GreKo has had a >2200 Elo since at least 2009. It shouldn't give away pieces at its highest level...
~2600 in the latest CCRL 40/40
chess1974lover
Posts: 6
Joined: Tue Jun 30, 2015 9:53 am

Re: Compiling Problem on Raspberry Pi 2

Post by chess1974lover »

init input...

GreKo 12.9 (01-Aug-2015)


perft 3

h2h3 - 0
h2h4 - 0
g2g3 - 0
g2g4 - 0
f2f3 - 0
f2f4 - 0
e2e3 - 0
e2e4 - 0
d2d3 - 0
d2d4 - 0
c2c3 - 0
c2c4 - 0
b2b3 - 0
b2b4 - 0
a2a3 - 0
a2a4 - 0
g1h3 - 0
g1f3 - 0
b1c3 - 0
b1a3 - 0

Nodes: 9
Time: 0.009000
Knps: 989.111111


values for perft 4:
Nodes: 233
Time: 0.233000
Knps: 846.699571

values for perft 5:
Nodes: 4729
Time: 4.729000
Knps: 1028.887503

values for perft 6:
Nodes: 113759
Time: 113.759000
Knps: 1046.601359
User avatar
WinPooh
Posts: 267
Joined: Fri Mar 17, 2006 8:01 am
Location: Russia
Full name: Vladimir Medvedev

Re: Compiling Problem on Raspberry Pi 2

Post by WinPooh »

Did you try clean rebuild from scratch in the empty directory? I used to get such errors when mistakenly mixed .obj files from different versions.
chess1974lover wrote:init input...

GreKo 12.9 (01-Aug-2015)


perft 3

h2h3 - 0
chess1974lover
Posts: 6
Joined: Tue Jun 30, 2015 9:53 am

Re: Compiling Problem on Raspberry Pi 2

Post by chess1974lover »

Yes, I extracted the source archive in an otherwise empty ~/Downloads directory.

Perhaps GreKo cannot be built on a 32 bit platform?
User avatar
WinPooh
Posts: 267
Joined: Fri Mar 17, 2006 8:01 am
Location: Russia
Full name: Vladimir Medvedev

Re: Compiling Problem on Raspberry Pi 2

Post by WinPooh »

chess1974lover wrote:Yes, I extracted the source archive in an otherwise empty ~/Downloads directory.

Perhaps GreKo cannot be built on a 32 bit platform?
No, GreKo can be built on 32-bit. I use 32-bit Windows as one of my development environments, everything runs ok. No 64-bit specific code is in GreKo.
User avatar
WinPooh
Posts: 267
Joined: Fri Mar 17, 2006 8:01 am
Location: Russia
Full name: Vladimir Medvedev

Re: Compiling Problem on Raspberry Pi 2

Post by WinPooh »

Which compiler do you use for build? Is it gcc? Version?
How do you build executable? Do you use Makefile.Linux?
chess1974lover
Posts: 6
Joined: Tue Jun 30, 2015 9:53 am

Re: Compiling Problem on Raspberry Pi 2

Post by chess1974lover »

Checked gcc version again. It defaulted to 4.6 even though 4.9 was installed. I set the default gcc and g++ version to 4.9 and voilà... a working GreKo 12.9. :D It's no longer playing silly moves now.

Got some warnings about bitboards.cpp, though:

Code: Select all

g++  -DNDEBUG -Wall -O3  -c -o bitboards.o bitboards.cpp
bitboards.cpp: In static member function ‘static void Bitboard::InitBitboards()’:
bitboards.cpp:218:27: warning: array subscript is below array bounds [-Warray-bounds]
         m_between[from][to] = y;     \
                           ^
bitboards.cpp:226:4: note: in expansion of macro ‘TRACE_DIR’
    TRACE_DIR (DIR_UR, UpRight,  -7)
    ^
bitboards.cpp:218:27: warning: array subscript is below array bounds [-Warray-bounds]
         m_between[from][to] = y;     \
                           ^
bitboards.cpp:228:4: note: in expansion of macro ‘TRACE_DIR’
    TRACE_DIR (DIR_UL, UpLeft,   -9)
    ^
User avatar
WinPooh
Posts: 267
Joined: Fri Mar 17, 2006 8:01 am
Location: Russia
Full name: Vladimir Medvedev

Re: Compiling Problem on Raspberry Pi 2

Post by WinPooh »

chess1974lover wrote:Checked gcc version again. It defaulted to 4.6 even though 4.9 was installed. I set the default gcc and g++ version to 4.9 and voilà... a working GreKo 12.9. :D It's no longer playing silly moves now.

Got some warnings about bitboards.cpp, though:

Code: Select all

g++  -DNDEBUG -Wall -O3  -c -o bitboards.o bitboards.cpp
bitboards.cpp: In static member function ‘static void Bitboard::InitBitboards()’:
bitboards.cpp:218:27: warning: array subscript is below array bounds [-Warray-bounds]
         m_between[from][to] = y;     \
                           ^
bitboards.cpp:226:4: note: in expansion of macro ‘TRACE_DIR’
    TRACE_DIR (DIR_UR, UpRight,  -7)
    ^
bitboards.cpp:218:27: warning: array subscript is below array bounds [-Warray-bounds]
         m_between[from][to] = y;     \
                           ^
bitboards.cpp:228:4: note: in expansion of macro ‘TRACE_DIR’
    TRACE_DIR (DIR_UL, UpLeft,   -9)
    ^
Thank you for a warnings report, I will take a look. Never used this -Warray-bounds compiler key, only -Wall.
Last edited by WinPooh on Sun Aug 09, 2015 10:34 pm, edited 1 time in total.
User avatar
WinPooh
Posts: 267
Joined: Fri Mar 17, 2006 8:01 am
Location: Russia
Full name: Vladimir Medvedev

Re: Compiling Problem on Raspberry Pi 2

Post by WinPooh »

No, this is not an error. The compiler does not understand that negative "to" variable will never be used as an index in array because of while(x) condition.

Code: Select all

#define TRACE_DIR(dir, Shift, delta) \
    x = Shift(m_single[from]);       \
    y = 0;                           \
    to = from + (delta);             \
    while (x)                        \
    {                                \
        m_between[from][to] = y;     \
        y |= x;                      \
        x = Shift(x);                \
        to += (delta);               \
    }                                \
    m_dir[from][dir] = y;
BTW, my gcc/MinGW 4.6.2 does not generate such warning.