fabianvdW / FabChess

UCI compliant chess engine written in Rust
BSD 3-Clause "New" or "Revised" License
30 stars 6 forks source link

Fail to compile on ARM Cortex-A53 SBC #66

Closed rontant closed 4 years ago

rontant commented 4 years ago

When trying to compile on my Rock64 SBC running Ubuntu, I got the following errors:

root@rock64:~/FabChess# cargo run --release -p uci-engine Compiling core-sdk v0.1.0 (/root/FabChess/core-sdk) error[E0433]: failed to resolve: could not find x86_64 in arch --> core-sdk/src/build.rs:36:28 | 36 | std::arch::x86_64::_pext_u64(bb, OCCUPANCY_MASKS_ROOK[sq]) as usize | ^^^^^^ could not find x86_64 in arch

error[E0433]: failed to resolve: could not find x86_64 in arch --> core-sdk/src/build.rs:59:28 | 59 | std::arch::x86_64::_pext_u64(bb, OCCUPANCY_MASKS_BISHOP[sq]) as usize | ^^^^^^ could not find x86_64 in arch

error: aborting due to 2 previous errors

Here are some infos about Rock64:

root@rock64:~/FabChess# uname -a Linux rock64 4.4.167-1213-rockchip-ayufan-g34ae07687fce #1 SMP Tue Jun 18 20:44:49 UTC 2019 aarch64 aarch64 aarch64 GNU/Linux root@rock64:~/FabChess# 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

Would you be able to give some pointers? Thanks in advance.

fabianvdW commented 4 years ago

Hi, thanks for the report, this is my mistake.

Please try again with latest commit on master 80813b9.

rontant commented 4 years ago

Greetings from Singapore!

I have tried again and this time got another error as follows:

FabChess# cargo rustc --release -p uci-engine -- -C target-cpu=native Compiling libc v0.2.69 Compiling getrandom v0.1.14 Compiling cfg-if v0.1.10 Compiling ppv-lite86 v0.2.6 Compiling rand_core v0.5.1 Compiling rand_chacha v0.2.2 Compiling rand v0.7.3 Compiling core-sdk v0.1.0 (/root/FabChess/core-sdk) error: failed to run custom build command for core-sdk v0.1.0 (/root/FabChess/core-sdk)

Caused by: process didn't exit successfully: /root/FabChess/target/release/build/core-sdk-043a30132d84a48d/build-script-build (exit code: 101) --- stderr thread 'main' panicked at 'called Result::unwrap() on an Err value: NotPresent', core-sdk/src/build.rs:18:20 note: run with RUST_BACKTRACE=1 environment variable to display a backtrace

fabianvdW commented 4 years ago

Hello, sorry for the inconvenice, we are getting closer! For me this env variable was always set, but okay I pushed 94b9a7f to hopefully fix it now after all.

Edit: If it still does not compile after this, will have to change build command to set RUSTFLAGS=-C target-cpu=native env variable and cargo build --release -p uci-engine, but make sure to cargo clean before. I thought this was only necessary for cross compiles, but I might only be right for my architecture.

rontant commented 4 years ago

Thank you very much. I really appreciate your very prompt response.

It works now.

root@rock64:~# git clone https://github.com/fabianvdW/FabChess Cloning into 'FabChess'... remote: Enumerating objects: 202, done. remote: Counting objects: 100% (202/202), done. remote: Compressing objects: 100% (123/123), done. remote: Total 4594 (delta 100), reused 158 (delta 73), pack-reused 4392 Receiving objects: 100% (4594/4594), 27.66 MiB | 1.45 MiB/s, done. Resolving deltas: 100% (3280/3280), done. root@rock64:~# cd FabChess root@rock64:~/FabChess# cargo rustc --release -p uci-engine -- -C target-cpu=native Compiling libc v0.2.69 Compiling getrandom v0.1.14 Compiling cfg-if v0.1.10 Compiling ppv-lite86 v0.2.6 Compiling rand_core v0.5.1 Compiling rand_chacha v0.2.2 Compiling rand v0.7.3 Compiling core-sdk v0.1.0 (/root/FabChess/core-sdk) Compiling uci-engine v1.15.0 (/root/FabChess/uci-engine) Finished release [optimized] target(s) in 6m 04s

root@rock64:~/FabChess# cd target/release root@rock64:~/FabChess/target/release# ./uci-engine info string Initialization Time: 0ms uci id name FabChess v1.15 id author Fabian von der Warth id contributors Erik Imgrund, Marcin Mielniczuk option name Hash type spin default 256 min 0 max 131072 option name ClearHash type button option name Threads type spin default 1 min 1 max 65536 option name MoveOverhead type spin default 25 min 0 max 20000 option name DebugSMPPrint type check default false option name SMPSkipRatio type spin default 2 min 1 max 1024 uciok go movetime 3000 info depth 1 seldepth 0 nodes 0 nps 0 hashfull 0 time 3 score cp 4 pv a2a3 info depth 1 seldepth 0 nodes 0 nps 0 hashfull 0 time 3 score cp 19 pv b2b3 info depth 1 seldepth 0 nodes 0 nps 0 hashfull 0 time 3 score cp 24 pv c2c3 info depth 1 seldepth 0 nodes 0 nps 0 hashfull 0 time 3 score cp 69 pv d2d3 info depth 1 seldepth 0 nodes 0 nps 0 hashfull 0 time 4 score cp 81 pv e2e3 info depth 2 seldepth 0 nodes 0 nps 0 hashfull 0 time 4 score cp 28 pv e2e3 d7d6 info depth 2 seldepth 0 nodes 0 nps 0 hashfull 0 time 5 score cp 28 pv e2e3 d7d6 info depth 2 seldepth 0 nodes 0 nps 0 hashfull 0 time 5 score cp 28 pv e2e3 d7d6 info depth 2 seldepth 0 nodes 0 nps 0 hashfull 0 time 6 score cp 10 pv e2e3 e7e6 info depth 3 seldepth 0 nodes 0 nps 0 hashfull 0 time 7 score cp 19 pv e2e3 e7e6 b2b3 info depth 4 seldepth 0 nodes 0 nps 0 hashfull 0 time 9 score cp 32 pv e2e3 e7e6 b2b3 d7d6 info depth 5 seldepth 0 nodes 0 nps 0 hashfull 0 time 12 score cp 17 pv e2e3 e7e6 a2a3 info depth 5 seldepth 0 nodes 0 nps 0 hashfull 0 time 21 score cp 18 pv a2a3 e7e6 e2e3 g8f6 d2d4 info depth 5 seldepth 0 nodes 0 nps 0 hashfull 0 time 26 score cp 38 pv g1f3 c7c6 e2e3 d7d5 d2d4 info depth 6 seldepth 0 nodes 0 nps 0 hashfull 0 time 28 score cp 24 pv g1f3 c7c6 b2b4 d7d5 e2e3 info depth 6 seldepth 0 nodes 0 nps 0 hashfull 0 time 32 score cp 26 pv d2d4 g8f6 g1f3 e7e6 c2c3 d7d5 info depth 6 seldepth 0 nodes 0 nps 0 hashfull 0 time 36 score cp 28 pv e2e4 d7d5 e4d5 g8f6 d2d4 d8d5 info depth 7 seldepth 0 nodes 0 nps 0 hashfull 0 time 49 score cp 32 pv e2e4 d7d5 e4e5 d5d4 c2c3 c7c6 g1f3 info depth 8 seldepth 13 nodes 8192 nps 107789 hashfull 0 time 76 score cp 24 pv e2e4 d7d5 e4d5 g8f6 d2d4 f6d5 b1c3 b8c6 info depth 9 seldepth 15 nodes 16384 nps 129007 hashfull 0 time 127 score cp 38 pv e2e4 e7e6 d2d4 b7b5 info depth 9 seldepth 15 nodes 16384 nps 111455 hashfull 0 time 147 score cp 41 pv e2e4 e7e6 d2d4 d7d5 e4d5 e6d5 b1c3 b8c6 g1f3 info depth 10 seldepth 15 nodes 24576 nps 121663 hashfull 0 time 202 score cp 27 pv e2e4 d7d5 e4d5 c7c6 d2d4 c6d5 g1f3 b8c6 f3e5 c6e5 d4e5 info depth 10 seldepth 16 nodes 40960 nps 123003 hashfull 0 time 333 score cp 23 pv e2e4 d7d5 e4d5 c7c6 d5c6 b8c6 g1f3 e7e5 f1b5 g8e7 info depth 10 seldepth 17 nodes 65536 nps 153480 hashfull 0 time 427 score cp 36 pv d2d4 d7d5 e2e3 e7e6 g1f3 b8d7 c2c4 g8f6 b1c3 c7c6 c4d5 info depth 11 seldepth 18 nodes 90112 nps 158927 hashfull 3 time 567 score cp 39 pv d2d4 d7d5 e2e3 b8d7 c2c4 d5c4 g1f3 e7e6 b1c3 d7b6 f3e5 info depth 12 seldepth 18 nodes 131072 nps 167611 hashfull 5 time 782 score cp 35 pv d2d4 d7d5 e2e3 e7e6 c2c4 b8c6 g1f3 g8f6 b1c3 f6e4 f1d3 f8b4 c4d5 info depth 13 seldepth 20 nodes 237568 nps 172026 hashfull 5 time 1381 score cp 39 pv d2d4 d7d5 e2e3 e7e6 c2c4 b8c6 g1f3 g8f6 b1c3 f6e4 c4d5 e4c3 b2c3 e6d5 info depth 14 seldepth 21 nodes 335872 nps 173667 hashfull 6 time 1934 score cp 25 pv d2d4 d7d5 e2e3 e7e6 c2c4 b8c6 g1f3 g8f6 c4d5 e6d5 b1c3 c8f5 f1e2 f8d6 bestmove d2d4 quit root@rock64:~/FabChess/target/release#

I am going to test further pitting it against other engines (i.e. Arasan, Winter, Ethereal, Igel, etc) on this Arm Cortex-A53 SBC. Again, thank you very much for your help.

fabianvdW commented 4 years ago

No problem, this shouldn't have occured in the first place ;)

Finished release [optimized] target(s) in 6m 04s

Oof, Rust isn't going easy on your machine D: FabChess takes around 20-22 seconds to compile here, which is already very long, but 6m is crazy :D

Greetings, Fabi

rontant commented 4 years ago

Oh... it took 6m 04s because a chess tournament was running in the background using 100% of all 4 CPU cores. I should have killed the background process first. My bad...

Anyway, I got curious and compiled it again. This time it took 3m 54s. Yeah, it's still bad.

root@rock64:~/FabChess# cargo clean root@rock64:~/FabChess# cargo rustc --release -p uci-engine -- -C target-cpu=native Compiling libc v0.2.69 Compiling getrandom v0.1.14 Compiling cfg-if v0.1.10 Compiling ppv-lite86 v0.2.6 Compiling rand_core v0.5.1 Compiling rand_chacha v0.2.2 Compiling rand v0.7.3 Compiling core-sdk v0.1.0 (/root/FabChess/core-sdk) Compiling uci-engine v1.15.0 (/root/FabChess/uci-engine) Finished release [optimized] target(s) in 3m 54s