amanjpro / zahak

A UCI compatible chess AI in Go
https://zahak.amanj.me
MIT License
30 stars 11 forks source link

Raspberry Pi 4 32 bit compile problems #120

Closed ScallyBag closed 3 years ago

ScallyBag commented 3 years ago

Hi,

whenever I try to compile your engine I get these errors:

Al@RPi4-SSD:~/go $ go get -u github.com/amanjpro/zahak/zahak

github.com/amanjpro/zahak/engine

src/github.com/amanjpro/zahak/engine/cache.go:32:27: syntax error: unexpected b1111111111111111111111111111 after top level declaration src/github.com/amanjpro/zahak/engine/cache.go:33:27: syntax error: unexpected b1111111111111111 after top level declaration src/github.com/amanjpro/zahak/engine/cache.go:34:28: syntax error: unexpected b1111111 after top level declaration src/github.com/amanjpro/zahak/engine/cache.go:35:27: syntax error: unexpected b111 after top level declaration src/github.com/amanjpro/zahak/engine/cache.go:36:26: syntax error: unexpected b1111111111 after top level declaration

Also I’ve tried your provided binaries for 32bit and 64bit for v5 and v6 but neither run on Raspberry Pi 4, which is completely up to date running Raspbian OS 32bit.

Thanks,

Al.

amanjpro commented 3 years ago

I have never tried using go get command to compile, I use make build for building, can you try this instead:

$ git clone https://github.com/amanjpro/zahak.git
$ cd zahak
$ make build

Also, I don't have RaspberryPi 4, or any ARM 64 for that matter, I have once tried running it on a friend's computer and it worked.

I am currently successfully running versions 5 and 6 on RaspberryPi 3 - 32bit... will look into this

Thanks for having interest in Zahak

amanjpro commented 3 years ago

Also, what version of golang are you using?

ScallyBag commented 3 years ago

Hi,

Thanks for the quick reply, I had already tried GitHub but tried the other way because other GO engines work that way too. However here is what you asked:

Al@RPi4-SSD:~/Engine-Source $ git clone https://github.com/amanjpro/zahak.git Cloning into 'zahak'... remote: Enumerating objects: 4323, done. remote: Counting objects: 100% (886/886), done. remote: Compressing objects: 100% (478/478), done. remote: Total 4323 (delta 541), reused 558 (delta 376), pack-reused 3437 Receiving objects: 100% (4323/4323), 931.33 KiB | 4.00 MiB/s, done. Resolving deltas: 100% (2903/2903), done. Al@RPi4-SSD:~/Engine-Source $ cd zahak Al@RPi4-SSD:~/Engine-Source/zahak $ make build mkdir -p bin go build -ldflags "-X 'main.version=d3d1b0fc2d8e06a518b8c8a162d0673b2db564a0'" -o bin ./... go build: cannot use -o with multiple packages make: *** [Makefile:6: build] Error 1

Also, here’s what I get when I try your binaries:

Al@RPi4-SSD:~ $ ./zahak-linux-arm32-5.0

ZZZZZZZZZZZZZZZZZZZ hhhhhhh kkkkkkkk Z:::::::::::::::::Z h:::::h k::::::k Z:::::::::::::::::Z h:::::h k::::::k Z:::ZZZZZZZZ:::::Z h:::::h k::::::k ZZZZZ Z:::::Z aaaaaaaaaaaaa h::::h hhhhh aaaaaaaaaaaaa k:::::k kkkkkkk Z:::::Z a::::::::::::a h::::hh:::::hhh a::::::::::::a k:::::k k:::::k Z:::::Z aaaaaaaaa:::::a h::::::::::::::hh aaaaaaaaa:::::a k:::::k k:::::k Z:::::Z a::::a h:::::::hhh::::::h a::::a k:::::k k:::::k Z:::::Z aaaaaaa:::::a h::::::h h::::::h aaaaaaa:::::a k::::::k:::::k Z:::::Z aa::::::::::::a h:::::h h:::::h aa::::::::::::a k:::::::::::k Z:::::Z a::::aaaa::::::a h:::::h h:::::h a::::aaaa::::::a k:::::::::::k ZZZ:::::Z ZZZZZa::::a a:::::a h:::::h h:::::ha::::a a:::::a k::::::k:::::k Z::::::ZZZZZZZZ:::Za::::a a:::::a h:::::h h:::::ha::::a a:::::a k::::::k k:::::k Z:::::::::::::::::Za:::::aaaa::::::a h:::::h h:::::ha:::::aaaa::::::a k::::::k k:::::k Z:::::::::::::::::Z a::::::::::aa:::ah:::::h h:::::h a::::::::::aa:::ak::::::k k:::::k ZZZZZZZZZZZZZZZZZZZ aaaaaaaaaa aaaahhhhhhh hhhhhhh aaaaaaaaaa aaaakkkkkkkk kkkkkkk

uci id name Zahak 5.0 id author Amanj option name Ponder type check default false option name Hash type spin default 10 min 1 max 8000 option name Pawnhash type spin default 2 min 1 max 10 option name Book type check default false uciok go infinite panic: runtime error: invalid memory address or nil pointer dereference [signal SIGSEGV: segmentation violation code=0x1 addr=0x1c pc=0xef700]

goroutine 6 [running]: github.com/amanjpro/zahak/engine.(Position).IsDraw(0x0, 0x1da8000) /home/runner/work/zahak/zahak/engine/position.go:294 +0x14 github.com/amanjpro/zahak/search.(Engine).alphaBeta(0x1dac000, 0x80010001, 0x7fff, 0x9dbcd2a7) /home/runner/work/zahak/zahak/search/search.go:142 +0xb8 github.com/amanjpro/zahak/search.(Engine).aspirationWindow(0x1dac000, 0x18001, 0x1e34000) /home/runner/work/zahak/zahak/search/search.go:106 +0x14c github.com/amanjpro/zahak/search.(Engine).rootSearch(0x1dac000, 0x10ba064) /home/runner/work/zahak/zahak/search/search.go:63 +0x208 github.com/amanjpro/zahak/search.(Engine).Search(0x1dac000, 0xc0456864) /home/runner/work/zahak/zahak/search/search.go:14 +0x30 github.com/amanjpro/zahak/uci.(UCI).findMove(0x10a00e0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, ...) /home/runner/work/zahak/zahak/uci/uci.go:232 +0x9c4 created by github.com/amanjpro/zahak/uci.(*UCI).Start /home/runner/work/zahak/zahak/uci/uci.go:126 +0x81c Al@RPi4-SSD:~ $

=============

Al@RPi4-SSD:~ $ ./zahak-linux-arm32-6.0

ZZZZZZZZZZZZZZZZZZZ hhhhhhh kkkkkkkk Z:::::::::::::::::Z h:::::h k::::::k Z:::::::::::::::::Z h:::::h k::::::k Z:::ZZZZZZZZ:::::Z h:::::h k::::::k ZZZZZ Z:::::Z aaaaaaaaaaaaa h::::h hhhhh aaaaaaaaaaaaa k:::::k kkkkkkk Z:::::Z a::::::::::::a h::::hh:::::hhh a::::::::::::a k:::::k k:::::k Z:::::Z aaaaaaaaa:::::a h::::::::::::::hh aaaaaaaaa:::::a k:::::k k:::::k Z:::::Z a::::a h:::::::hhh::::::h a::::a k:::::k k:::::k Z:::::Z aaaaaaa:::::a h::::::h h::::::h aaaaaaa:::::a k::::::k:::::k Z:::::Z aa::::::::::::a h:::::h h:::::h aa::::::::::::a k:::::::::::k Z:::::Z a::::aaaa::::::a h:::::h h:::::h a::::aaaa::::::a k:::::::::::k ZZZ:::::Z ZZZZZa::::a a:::::a h:::::h h:::::ha::::a a:::::a k::::::k:::::k Z::::::ZZZZZZZZ:::Za::::a a:::::a h:::::h h:::::ha::::a a:::::a k::::::k k:::::k Z:::::::::::::::::Za:::::aaaa::::::a h:::::h h:::::ha:::::aaaa::::::a k::::::k k:::::k Z:::::::::::::::::Z a::::::::::aa:::ah:::::h h:::::h a::::::::::aa:::ak::::::k k:::::k ZZZZZZZZZZZZZZZZZZZ aaaaaaaaaa aaaahhhhhhh hhhhhhh aaaaaaaaaa aaaakkkkkkkk kkkkkkk

uci id name Zahak 6.0 id author Amanj option name Ponder type check default false option name Hash type spin default 128 min 1 max 24000 option name Pawnhash type spin default 2 min 1 max 10 option name Book type check default false option name Threads type spin default 1 min 1 max 4 uciok go infinite panic: unaligned 64-bit atomic operation

goroutine 17 [running]: runtime/internal/atomic.panicUnaligned() /opt/hostedtoolcache/go/1.16.7/x64/src/runtime/internal/atomic/unaligned.go:8 +0x24 runtime/internal/atomic.Xadd64(0x8a2024, 0x0, 0x0, 0xffffffff, 0x0) /opt/hostedtoolcache/go/1.16.7/x64/src/runtime/internal/atomic/asm_arm.s:233 +0x14 github.com/amanjpro/zahak/search.(Engine).ShareInfo(0x8982000) /home/runner/work/zahak/zahak/search/types.go:55 +0x38 github.com/amanjpro/zahak/search.(Engine).rootSearch(0x8982000, 0x10164) /home/runner/work/zahak/zahak/search/search.go:144 +0x44c github.com/amanjpro/zahak/search.(Engine).Search(0x8982000, 0x64) /home/runner/work/zahak/zahak/search/search.go:41 +0x4c github.com/amanjpro/zahak/search.(Runner).Search(0x8a2000, 0x64) /home/runner/work/zahak/zahak/search/search.go:17 +0xf0 created by github.com/amanjpro/zahak/uci.(*UCI).findMove /home/runner/work/zahak/zahak/uci/uci.go:249 +0x820 Al@RPi4-SSD:~ $

===========

Al@RPi4-SSD:~ $ ./zahak-linux-arm64-5.0 -bash: ./zahak-linux-arm64-5.0: cannot execute binary file: Exec format error

===========

Al@RPi4-SSD:~ $ ./zahak-linux-arm64-6.0 -bash: ./zahak-linux-arm64-6.0: cannot execute binary file: Exec format error Al@RPi4-SSD:~ $

============

I’m using a Raspberry Pi4 running 32 bit Raspbian OS that is fully up to date with the latest software. I’ve compiled over 100 engines for the RPi for Picochess using lots of different Compilers.

Thanks for your time.

Al.

ScallyBag commented 3 years ago

Hi,

Al@RPi4-SSD:~ $ go version go version go1.10.1 linux/arm

Al.

amanjpro commented 3 years ago

Oh, this is very old version of GoLang, my engine has been tested with 1.16 and above

As for the version 5, it actually works if you send ucinewgame before sending go infinite, so please try that... And I am currently trying to fix the version 6.0 issue, and will do a hotfix right after

amanjpro commented 3 years ago

Can you try this hotfix: https://github.com/amanjpro/zahak/releases/tag/6.1

amanjpro commented 3 years ago

Actually try that one instead: https://github.com/amanjpro/zahak/releases/tag/6.2

ScallyBag commented 3 years ago

Hi,

Your older 32 bit v5 does run, I forgot the ucinewgame which I normally try on a failure. v6 does not run as you’re aware.

I quickly tried your v6.2 but the makefile refers to your original version not the fixes.

I’m away in Scotland now, so will try any fixes and try to upgrade GO when I return next week.

thanks for your efforts,

Al aka Scally on the forums.

amanjpro commented 3 years ago

Don't try make, just download this binary for raspberrypi 32bit: https://github.com/amanjpro/zahak/releases/download/6.2/zahak-linux-arm32-6.2

ScallyBag commented 3 years ago

Hi,

yes that binary works thanks.

I’ve also update to go v1.17.1

Al.

amanjpro commented 3 years ago

Cool, thanks for confirmation. I'll close the issue :)

ScallyBag commented 3 years ago

Thanks again.

go v1.17.1 didn’t work for me, however go 1.14.4 works, I can run Makefile and the go get command, both provide working binaries.

Al.

amanjpro commented 3 years ago

I have never tried Go 1.17, will try that later

amanjpro commented 3 years ago

Out of curiosity, are you running it on a DGT Pi?

ScallyBag commented 3 years ago

I will be, I’m just home after a week away, so will be trying your engine tomorrow on my DGT Pi.

Al.

Sent from Scally's iPhone 11 Pro

On 12 Sep 2021, at 21:21, Amanj Sherwany @.***> wrote:

 Out of curiosity, are you running it on a DGT Pi?

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or unsubscribe. Triage notifications on the go with GitHub Mobile for iOS or Android.

amanjpro commented 3 years ago

Cool, I'm really interested in your experience, as I also want to get a DGT Pi + DGT board setup :)

ScallyBag commented 3 years ago

Hi Amanj,

I have emailed you on your email address given on your website. I think I spelt your name wrong, apologies.

Al.