Trying to compile stockfish 15 on mac and build for smaller file size

Discussion of chess software programming and technical issues.

Moderator: Ras

adams161
Posts: 626
Joined: Sun May 13, 2007 9:55 pm
Location: Bay Area, CA USA
Full name: Mike Adams

Trying to compile stockfish 15 on mac and build for smaller file size

Post by adams161 »

I wanted to try to compile stockfish 15 from source for Mac because i heard it could be compiled for UCI only at a smaller file size without that learning stuff. I'm having two issues. I"ve not much experience compiling c or c++ from make files or things normally made for linux.

I chmodded the make file executable but when i run it on Mac i get
./Makefile: line 23: shell: command not found
./Makefile: line 23: KERNEL: command not found
./Makefile: line 24: syntax error near unexpected token `$(KERNEL),Linux'
./Makefile: line 24: `ifeq ($(KERNEL),Linux)'
I also dont know what to set to get that smaller file size not 47 megs that has only classical uci stockfish.

Any assistance appreciated.

Mike
Magnum
Posts: 195
Joined: Thu Feb 04, 2021 10:24 pm
Full name: Arnold Magnum

Re: Trying to compile stockfish 15 on mac and build for smaller file size

Post by Magnum »

adams161 wrote: Sat Jul 02, 2022 11:22 pm I wanted to try to compile stockfish 15 from source for Mac because i heard it could be compiled for UCI only at a smaller file size without that learning stuff. I'm having two issues. I"ve not much experience compiling c or c++ from make files or things normally made for linux.

I chmodded the make file executable but when i run it on Mac i get
./Makefile: line 23: shell: command not found
./Makefile: line 23: KERNEL: command not found
./Makefile: line 24: syntax error near unexpected token `$(KERNEL),Linux'
./Makefile: line 24: `ifeq ($(KERNEL),Linux)'
I also dont know what to set to get that smaller file size not 47 megs that has only classical uci stockfish.

Any assistance appreciated.

Mike
Terminal + HomeBrew

brew unlink stockfish

brew install stockfish --HEAD
(with --HEAD = newest development version)


Terminal + Github Stockfish Source Code

https://github.com/official-stockfish/Stockfish

cd /Users/me/Stockfish-master/src

make clean

make -j profile-build COMP=clang ARCH=apple-silicon

./stockfish compiler


Starting position:
(brew install stockfish --HEAD = 4 Mn/s)
(make build = 5 Mn/s)
(make -j profile-build ARCH=apple-silicon = 9 Mn/s)
(make profile-build COMP=clang ARCH=apple-silicon = 9 Mn/s)
(make -j profile-build COMP=clang ARCH=apple-silicon = 9.3 Mn/s)
User avatar
Ras
Posts: 2697
Joined: Tue Aug 30, 2016 8:19 pm
Full name: Rasmus Althoff

Re: Trying to compile stockfish 15 on mac and build for smaller file size

Post by Ras »

adams161 wrote: Sat Jul 02, 2022 11:22 pmI chmodded the make file executable
As a general note: makefiles are not shell scripts and not meant to be executed directly. They are rather description files that the program make will evaluate as detailed in Magnum's post.
Rasmus Althoff
https://www.ct800.net
adams161
Posts: 626
Joined: Sun May 13, 2007 9:55 pm
Location: Bay Area, CA USA
Full name: Mike Adams

Re: Trying to compile stockfish 15 on mac and build for smaller file size

Post by adams161 »

Magnum wrote: Sun Jul 03, 2022 12:14 am
adams161 wrote: Sat Jul 02, 2022 11:22 pm I wanted to try to compile stockfish 15 from source for Mac because i heard it could be compiled for UCI only at a smaller file size without that learning stuff. I'm having two issues. I"ve not much experience compiling c or c++ from make files or things normally made for linux.

I chmodded the make file executable but when i run it on Mac i get
./Makefile: line 23: shell: command not found
./Makefile: line 23: KERNEL: command not found
./Makefile: line 24: syntax error near unexpected token `$(KERNEL),Linux'
./Makefile: line 24: `ifeq ($(KERNEL),Linux)'
I also dont know what to set to get that smaller file size not 47 megs that has only classical uci stockfish.

Any assistance appreciated.

Mike
Terminal + HomeBrew

brew unlink stockfish

brew install stockfish --HEAD
(with --HEAD = newest development version)


Terminal + Github Stockfish Source Code

https://github.com/official-stockfish/Stockfish

cd /Users/me/Stockfish-master/src

make clean

make -j profile-build COMP=clang ARCH=apple-silicon

./stockfish compiler


Starting position:
(brew install stockfish --HEAD = 4 Mn/s)
(make build = 5 Mn/s)
(make -j profile-build ARCH=apple-silicon = 9 Mn/s)
(make profile-build COMP=clang ARCH=apple-silicon = 9 Mn/s)
(make -j profile-build COMP=clang ARCH=apple-silicon = 9.3 Mn/s)
Thanks. I'll fool around with this. Be interesting to see how to build a small file size version. Stockfish 8 was like 800 kilobytes. Stockfish 15 is like 47 Meg. I want to redistribute what I build with another app of mine and it would add 30 megs to installer to take default stockfish 15.
adams161
Posts: 626
Joined: Sun May 13, 2007 9:55 pm
Location: Bay Area, CA USA
Full name: Mike Adams

Re: Trying to compile stockfish 15 on mac and build for smaller file size

Post by adams161 »

Ras wrote: Sun Jul 03, 2022 9:38 am
adams161 wrote: Sat Jul 02, 2022 11:22 pmI chmodded the make file executable
As a general note: makefiles are not shell scripts and not meant to be executed directly. They are rather description files that the program make will evaluate as detailed in Magnum's post.
yea, i'm seeing that. thank you.