Cook Book: Compile Crafty Chess Engine with gcc under Windows
Why is a modified file "X86.s" used for compiling version 19.7 (and some versions after) with Dev-C++ (gcc/g++/as) ?
When compiling these Crafty versions with the original "X86.s", then I get linking errors like these:
Q.: This did not occur in v. 19.6! What has changed in the new versions?
- evaluate.o(.text+0xb83):evaluate.c: undefined reference to `FirstOne'
- evaluate.o(.text+0x119e):evaluate.c: undefined reference to `AttacksRankFunc'
- evaluate.o(.text+0x1d14):evaluate.c: undefined reference to `PopCnt'
- evaluate.o(.text+0x202c):evaluate.c: undefined reference to `MobilityDiaga1Func'
- movgen.o(.text+0x422):movgen.c: undefined reference to `AttacksBishopFunc'
- attacks.o(.text+0xa2):attacks.c: undefined reference to `AttacksRookFunc'
- etc. ...
A.: In the "X86.s" of version 19.6, some label names like "FirstOne" or "PopCnt" are preceeded by "_" underscores. In versions 19.7 (and later) these underscores have been removed. As a consequence, the names somehow conflict with other parts of the C- source code where the same names are used. This yields linking errors when compiling with Dev-C++ 22.214.171.124 (gcc 3.2 / g++ 3.2 / as 2.13.90).
Therefore, I have re-introduced the underscores, in the same way as it was already the case in the X86.s of version 19.6. That's all, no further changes have been made.
→ Now, the compilation works without any problems !
The picture below shoes in which way the original X86.s of crafty 19.7 differs from the modified version: