BimmerBass / Loki

C++17 chess engine
GNU General Public License v3.0
9 stars 2 forks source link

No popcnt 64-bit compilation? #1

Closed rwbc closed 3 years ago

rwbc commented 3 years ago

Hi Niels,

Would you mind releasing a no popcnt 64-bit version (WIN) too?

I tried compiling it myself with plain gcc -O3 -march=native *.cpp *.h -o loki, but there are lots of warnings and some errors. Obviously it also uses MS extensions, which will not work with gcc. (It seems it will only compile in MSVC currently) https://stackoverflow.com/questions/49570839/strerror-s-strcpy-s-localtime-s-sprintf-s-not-declared-in-this-scope

Is this a typo? ... (b)) should this be ...(bb))? (thats one of the error complaints of the compiler) https://github.com/BimmerBass/Loki/blob/master/Loki/bitboard.h#L267v

Guenther

BimmerBass commented 3 years ago

Hi Guenther.

I will fix the errors/warnings and add a USE_POPCNT flag tomorrow, since I don't have time to do it today. I have added a makefile to make compilation a bit easier and I will try to fix all the warnings and apparent include errors gcc gives. Do you also get an error saying that libraries like thread and iostream aren't included?

rwbc commented 3 years ago

Sorry, I don't remember right now and haven't saved a log. I could try it again though in the evening.

BimmerBass commented 3 years ago

So it turns out i didn't have mingw64 installed but rather mingw32 which is what caused the inclusion problems. I have added a makefile for gcc which compiles now (mingw64), and i will implement the no popcount version when school is finished later today. After that, i intend to fix the warnings.

Please reach out if you experience more compilation errors with gcc

rwbc commented 3 years ago

It compiles now and works!

Just some partially 'sloppy' warnings and one enum-compare warning appear several times (gcc 10.2.0 is nitpicking)

Loki/bitboard.h:28:3: warning: integer constant is so large that it is unsigned
   28 |   18374686479671623680
      |   ^~~~~~~~~~~~~~~~~~~~
Loki/bitboard.h:53:3: warning: integer constant is so large that it is unsigned
   53 |   9241421688590303745,
      |   ^~~~~~~~~~~~~~~~~~~
In file included from Loki/search.h:4,
                 from Loki/search.cpp:1:
Loki/misc.h:8: warning: "NOMINMAX" redefined
    8 | #define NOMINMAX
      |
In file included from C:/msys64/mingw64/include/c++/10.2.0/x86_64-w64-mingw32/bits/c++config.h:518,
                 from C:/msys64/mingw64/include/c++/10.2.0/iostream:38,
                 from Loki/defs.h:5,
                 from Loki/bitboard.h:4,
                 from Loki/position.h:5,
                 from Loki/movegen.h:3,
                 from Loki/search.h:3,
                 from Loki/search.cpp:1:
C:/msys64/mingw64/include/c++/10.2.0/x86_64-w64-mingw32/bits/os_defines.h:45: note: this is the location of the previous definition
   45 | #define NOMINMAX 1
      |
In file included from Loki/position.h:5,
                 from Loki/movegen.h:3,
                 from Loki/thread.h:3,
                 from Loki/thread.cpp:1:
Loki/evaluation.cpp: In function 'int Eval::{anonymous}::material(GameState_t*)':
Loki/evaluation.cpp:32:24: warning: enumerated mismatch in conditional expression: 'Eval::mgValues' vs 'Eval::egValues' [-Wenum-compare]
   32 |    v += ((phase == MG) ? pawnValMg : pawnValEg) * countBits(pos->pieceBBS[PAWN][side]);
      |          ~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~
Loki/evaluation.cpp:33:24: warning: enumerated mismatch in conditional expression: 'Eval::mgValues' vs 'Eval::egValues' [-Wenum-compare]
   33 |    v += ((phase == MG) ? knightValMg : knightValEg) * countBits(pos->pieceBBS[KNIGHT][side]);
      |          ~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~
Loki/evaluation.cpp:34:24: warning: enumerated mismatch in conditional expression: 'Eval::mgValues' vs 'Eval::egValues' [-Wenum-compare]
   34 |    v += ((phase == MG) ? bishopValMg : bishopValEg) * countBits(pos->pieceBBS[BISHOP][side]);
      |          ~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~
Loki/evaluation.cpp:35:24: warning: enumerated mismatch in conditional expression: 'Eval::mgValues' vs 'Eval::egValues' [-Wenum-compare]
   35 |    v += ((phase == MG) ? rookValMg : rookValEg) * countBits(pos->pieceBBS[ROOK][side]);
      |          ~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~
Loki/evaluation.cpp:36:24: warning: enumerated mismatch in conditional expression: 'Eval::mgValues' vs 'Eval::egValues' [-Wenum-compare]
   36 |    v += ((phase == MG) ? queenValMg : queenValEg) * countBits(pos->pieceBBS[QUEEN][side]);
      |          ~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~
BimmerBass commented 3 years ago

Yes and I have just added non-popcount support which should work if you just change the use_popcount = yes to use_popcount = no in the makefile and use make. I will take care of the warnings a little later... need a break from all compilers ;))

rwbc commented 3 years ago

Yes and I have just added non-popcount support which should work if you just change the use_popcount = yes to use_popcount = no in the makefile and use make.

yeah, noticed it and already used it for my compilation

I will take care of the warnings a little later... need a break from all compilers ;))

:)