abulmo / amoeba

an UCI chess engine in D language
GNU General Public License v3.0
45 stars 8 forks source link

Compile errors on Raspberry Pi 3 #9

Closed djdekker closed 7 years ago

djdekker commented 7 years ago

I'm trying to compile Amoeba on Raspberry Pi 3 (running Raspbian Linux) using gdc. This is the command I'm using to compile:

amoeba-master/src $ gdc -o amoeba *.d

And this is the output -- only these three messages and no binary:

board.d:750: error: found '(' when expecting '.' following ulong
board.d:750: error: found ')' when expecting ';' following return statement
board.d:750: error: found '<<' instead of statement
abulmo commented 7 years ago

Can you try: DC=gdc make If the error is still here, can you tell me which version of gdc do you use? On my core i7 cpu, gdc compiles fine (under Linux) with gdc v2.068.

djdekker commented 7 years ago

The error is still there. :(

$ gdc --version
gdc (Raspbian 4.9.2-10) 4.9.2
$ ldc2 --version
LDC - the LLVM D compiler (0.14.0):
  based on DMD v2.065 and LLVM 3.5.0
  Default target: arm-unknown-linux-gnueabihf
  Host CPU: (unknown)
abulmo commented 7 years ago

I have just bought a raspberry pi 3 (and will receive it on tuesday) , so I will see what is wrong by myself. You can try to replace the line 750 by return (cast (ulong) ranks[o * 4 + f]) << r; I probably use a construct that was not available on older version of the language.

djdekker commented 7 years ago

I changed line 750 to return (cast (ulong) ranks[o * 4 + f]) << r;. The result is:

$ gdc -W -Wno-uninitialized -Wall -Wpedantic -Wextra -O3 -frelease -fno-bounds-check -o amoeba amoeba.d util.d board.d eval.d kpk.d move.d search.d uci.d weight.d
util.d:49: error: function core.bitop.bsf (uint v) is not callable using argument types (ulong)
util.d:133: error: no property 'fracSecs' for type 'const(SysTime)', did you mean 'fracSec'?
board.d:134: error: function core.bitop.bsf (uint v) is not callable using argument types (const(ulong))
board.d:750: error: cannot implicitly convert expression (o * 4LU + cast(ulong)f) of type ulong to uint

Or using ldc2:

$ ldc2 -O3 -release -singleobj -w -dw -of amoeba amoeba.d util.d board.d eval.d kpk.d move.d search.d uci.d weight.d
util.d(133): Error: no property 'fracSecs' for type 'const(SysTime)', did you mean 'fracSec'?
board.d(750): Error: cannot implicitly convert expression (o * 4LU + cast(ulong)f) of type ulong to uint
abulmo commented 7 years ago

Most of the errors are due to too old versions of the language. Wait a little, I will see what I can do next week.

abulmo commented 7 years ago

The ldc package in raspbian does not work at all, even if I modify my program for the compilation to be successfull, the resulting program will immediately crash. It appears this obsolete version of ldc is broken and can not even compile a simple hello world. I was able to build more recent versions of ldc2 (both 0.17.4 and 1.2.0) using the 3 year old llvm 3.5 provided by raspbian. I got a working executable, but not very fast. For gdc, I did not even try the version present with raspbian. However I am afraid the compilation of a more recent gdc may take some time. I hope to get a working compiler tomorrow, so that I can do some tests. I will then release the best executable I can (targeting arm cortex-7).

abulmo commented 7 years ago

I failed to compile gdc. As I do not want to spent to much time on this, I stop here. A working binary for raspberry (3, maybe 2) is available here: https://github.com/abulmo/amoeba/releases/download/v2.4/amoeba-2.4-rpi.bz2