Archimedes wrote: ↑17/10/2021, 13:06 Here is a short description, how you can compile Stockfish for arm64-v8a based CPUs with gcc on Termux.
At first, forget the installation of gcc via the repository https://github.com/its-pointless/its-pointless.github.io. It works for Demolito, which is a C based chess engine, but not for Stockfish (and probably other C++ based chess engines).
If you have already installed gcc via the above repository, remove it with:
Use CCTools for that purpose. A detailed description, how you install the cctool packages under Termux can be found here:Code: Select all
apt-get remove gcc-11 apt-get autoremove
https://cctools.info/index.php/Termux_repository_with_cctools_packages_(gcc_with_fortran_support_etc)
Follow the explanations step by step.
After that, download the Stockfish sources.
Make changes to the makefile, as the following code pieces are shown:Code: Select all
git clone https://github.com/official-stockfish/Stockfish cd Stockfish/src
Before:After:Code: Select all
ifeq ($(COMP),gcc) comp=gcc CXX=g++ CXXFLAGS += -pedantic -Wextra -Wshadow ifeq ($(arch),$(filter $(arch),armv7 armv8)) ifeq ($(OS),Android) CXXFLAGS += -m$(bits) LDFLAGS += -m$(bits)
Before:Code: Select all
ifeq ($(COMP),gcc) comp=gcc CXX=g++ CXXFLAGS += -pedantic -Wextra -Wshadow ifeq ($(arch),$(filter $(arch),armv7 armv8)) ifeq ($(OS),Android) CXXFLAGS += LDFLAGS +=
After:Code: Select all
### Sometimes gcc is really clang ifeq ($(COMP),gcc)
Before:Code: Select all
### Sometimes gcc is really clang ifeq ($(COMP),)
After:Code: Select all
### 3.3 Optimization ifeq ($(optimize),yes) CXXFLAGS += -O3 ifeq ($(comp),gcc) ifeq ($(OS), Android) CXXFLAGS += -fno-gcse -mthumb -march=armv7-a -mfloat-abi=softfp
Now you can compile Stockfish with gcc and PGO optimization with the following command:Code: Select all
### 3.3 Optimization ifeq ($(optimize),yes) CXXFLAGS += -O3 ifeq ($(comp),gcc) ifeq ($(OS), Android) CXXFLAGS += -march=native
Code: Select all
make -j profile-build ARCH=armv8 COMP=gcc
Compiling Stockfish with gcc on Termux
-
- Forum Contributions
- Points: 40 305,00
- Posts: 1924
- Joined: 04/11/2019, 14:45
- Status: Offline (Active 3 Months, 6 Days, 2 Hours, 25 Minutes ago)
- Medals: 1
- Topics: 71
- Reputation: 2388
- Location: North-Italy
- Has thanked: 1185 times
- Been thanked: 2951 times
Re: Compiling Stockfish with gcc on Termux
Does the produced binary work outside Termux?