rosenthj / Winter

UCI Chess Engine
GNU General Public License v3.0
88 stars 12 forks source link

immintrin.h not found during compile #11

Closed rontant closed 4 years ago

rontant commented 4 years ago

When trying to compile for my Rock64, a Raspberry Pi like SBC, I got an error here:

root@rock64:~/Winter# make -j4 g++ -c -DNDEBUG -O3 -flto -g3 -Wall -Wno-sign-compare -march=native -std=c++11 -Isrc -Isrc/general -Isrc/learning src/general/bookkeeping.cc -o src/general/bookkeeping.o g++ -c -DNDEBUG -O3 -flto -g3 -Wall -Wno-sign-compare -march=native -std=c++11 -Isrc -Isrc/general -Isrc/learning src/general/wdl_score.cc -o src/general/wdl_score.o g++ -c -DNDEBUG -O3 -flto -g3 -Wall -Wno-sign-compare -march=native -std=c++11 -Isrc -Isrc/general -Isrc/learning src/general/debug.cc -o src/general/debug.o g++ -c -DNDEBUG -O3 -flto -g3 -Wall -Wno-sign-compare -march=native -std=c++11 -Isrc -Isrc/general -Isrc/learning src/general/parse.cc -o src/general/parse.o g++ -c -DNDEBUG -O3 -flto -g3 -Wall -Wno-sign-compare -march=native -std=c++11 -Isrc -Isrc/general -Isrc/learning src/general/magic.cc -o src/general/magic.o g++ -c -DNDEBUG -O3 -flto -g3 -Wall -Wno-sign-compare -march=native -std=c++11 -Isrc -Isrc/general -Isrc/learning src/learning/machine_learning.cc -o src/learning/machine_learning.o src/general/magic.cc:30:10: fatal error: immintrin.h: No such file or directory

include

rosenthj commented 4 years ago

I am reasonably confident that is only needed for the pext instruction. Assuming that I am right and the Rock64 does not support the BMI2 instruction set, the easiest workaround is to simply remove line 30 in Winter/src/general/magic.cc

If this does not suffice you can further replace -march=native with -m64. This may have some effect on performance.

Could you try that and get back to me? If it works I will patch Winter to avoid issues like this for other users in the future.

rontant commented 4 years ago

Thank you very much for your prompt response.

Simply removing line 30 as per your suggestion works. We can keep -march=native option.

You are right that rock64 doesn't support BMI2 set.

root@rock64:~/Winter# lscpu
Architecture:        aarch64
Byte Order:          Little Endian
CPU(s):              4
On-line CPU(s) list: 0-3
Thread(s) per core:  1
Core(s) per socket:  4
Socket(s):           1
Vendor ID:           ARM
Model:               4
Model name:          Cortex-A53
Stepping:            r0p4
CPU max MHz:         1296.0000
CPU min MHz:         408.0000
BogoMIPS:            48.00
Flags:               fp asimd evtstrm aes pmull sha1 sha2 crc32

root@rock64:~/Winter# file Winter
Winter: ELF 64-bit LSB shared object, ARM aarch64, version 1 (SYSV), dynamically linked, interpreter /lib/ld-linux-aarch64.so.1, for GNU/Linux 3.7.0, BuildID[sha1]=75e4cd43bbcd91a9a975d55950f4831a724165ba, not stripped

To make sure everything works fine, I have this compiled version of Winter pitted against Lc0 using my own Javascript/PHP GUI. Interestingly, Winter managed to check mate Lc0 in 47 moves.

Again, thank you very much. Just let me know if you need any info regarding my rock64.

I am pasting the moves below just in case you are interested:

[ white: "Winter 0.84"] [ black: "Lc0 I-forget-the-network-file-name"]

  1. e2e4 c7c5
  2. b1c3 b8c6
  3. g1f3 e7e5
  4. f1c4 f8e7
  5. e1g1 g8f6
  6. d2d3 e8g8
  7. h2h3 d7d6
  8. c1g5 h7h6
  9. g5f6 e7f6
  10. c3d5 g8h8
  11. c2c3 c8e6
  12. d5e3 d8d7
  13. a2a3 a8c8
  14. c4e6 f7e6
  15. b2b4 b7b6
  16. d1e2 c6e7
  17. f1c1 e7g6
  18. g2g3 f6d8
  19. h3h4 d7f7
  20. g1g2 d8h4
  21. f3h4 g6h4
  22. g3h4 f7e7
  23. b4c5 c8c5
  24. e2h5 f8f4
  25. c1c2 h8h7
  26. a1h1 c5a5
  27. e3c4 a5c5
  28. h1h3 g7g6
  29. h5d1 f4h4
  30. h3h4 e7h4
  31. d1f3 h4e7
  32. a3a4 c5c7
  33. f3g3 h7g7
  34. c2c1 c7c6
  35. c1h1 e7f6
  36. g3g4 c6c7
  37. c4d6 c7e7
  38. g4g3 g7h7
  39. d6c4 h6h5
  40. c4e5 e7e8
  41. h1h4 e8g8
  42. h4f4 f6e5
  43. f4f7 h7h6
  44. g3e5 b6b5
  45. e5f4 g6g5
  46. f4f6 g8g6
  47. f6h8 a1a1
rosenthj commented 4 years ago

Thanks for the bug report and game. I have made an update so you shouldn't have to change any source code when you compile Winter in the future.

I am closing this issue now!