booot76 / Booot-chess-engine

11 stars 1 forks source link

how to compile on Linux ? #21

Open tissatussa opened 1 year ago

tissatussa commented 1 year ago

hi, it's nice that Booot can now be compiled on Linux, but your README does not show how .. once I used the FPC compiler to build Linux binaries from Pascal sources, can you give the full command line, including optional parameters ?

booot76 commented 1 year ago

I use Lasarus for it (open .lpi project file). I will add the command-line for pure fpc soon. Thanks for report.

tissatussa commented 1 year ago

I installed Lazarus on my Xubuntu 22.04 and i managed to compile ! Indeed, opening the .lpi file loads all source code files and then doing 'build' from the menu results in a valid binary, type AVX2-PEXT : the engine runs fine in CuteChess !

btw. i guess we don't need the full Lazarus IDE to compile / build your sources .. so, can you supply command line examples for FPC ? I also discovered LazBuild, which seems part of the Lazarus package.

booot76 commented 1 year ago

You are right - i have to include the command-line to compile it with pure FPC.

rchastain commented 1 year ago

Hello!

With -Mdelphi -Rintel, I can compile Booot from the command line.

If I append -CX -XX -Xs, I get a smaller file.

I see the following definitions in the Lazarus project: -dBorland -dVer150 -dDelphi7 -dCompiler6_Up -dPUREPASCAL

I wonder if they are really needed.

By the way, if I compile in DEBUG mode (-dDEBUG -ghl), the program crashes:

[roland@localhost 71-01]$ ./booot
An unhandled exception occurred at $000000000042E556:
EIntOverflow: Arithmetic overflow
  $000000000042E556  FINDBRUTEFORCEMAGIC,  line 329 of uMagic.pas
  $000000000042F5C1  FINDMAGICFORSQUARE,  line 426 of uMagic.pas
  $000000000042F68A  MAGICSINIT,  line 438 of uMagic.pas
  $000000000042C395  BITBOARDS_INIT,  line 270 of uBitBoards.pas
  $000000000042D1B5  UBITBOARDS_$$_init$,  line 339 of uBitBoards.pas
  $000000000041757C

I still have to test the effect of the -O2, -O3 and -O4 options. I see that the Lazarus project uses -O4.

rchastain commented 1 year ago

I created a simple README with building instructions.

I also started to write a Makefile. Tested only on Linux.

SRC = $(wildcard *.pas)

booot: booot7.dpr $(SRC)
    fpc -Mdelphi -Rintel -CX -XX -Xs $<

clean:
    rm -f *.o
    rm -f *.or
    rm -f *.ppu
rchastain commented 1 year ago

By the way, I think that the following files should be removed from the repository:

Maybe you could create a .gitignore file?

booot76 commented 1 year ago

Thank you Robert. I still novice in git and sometimes do not even know what to do with it :-)

rchastain commented 1 year ago

You are welcome. :)

rchastain commented 1 year ago

Yes, git can sometimes look complicated. Now I see that my fork is two commits ahead. I don't know why. But it doesn't matter. I can delete it and create another one.