https://web.archive.org/web/20211227192213/https://cctools.info/index.php/Main_Page
Compiling Stockfish with gcc on Termux
Moderators: Elijah, Igbo, timetraveller
-
- Forum Contributions
- Points: 42 582,00
- Posts: 2059
- Joined: 04/11/2019, 21:13
- Status: Online (Active 2 Hours, 33 Minutes ago)
- Medals: 2
- Topics: 158
- Reputation: 7111
- Been thanked: 6477 times
-
- Forum Contributions
- Points: 14 078,00
- Posts: 327
- Joined: 17/10/2020, 22:28
- Status: Offline (Active 5 Days, 8 Hours, 36 Minutes ago)
- Medals: 2
- Topics: 5
- Reputation: 506
- Has thanked: 349 times
- Been thanked: 671 times
Re: Compiling Stockfish with gcc on Termux
Did anyone test it if everything necessary was archived and allows a fresh installation of the cctools/gcc?Archimedes wrote: ↑04/10/2022, 9:44https://web.archive.org/web/20211227192213/https://cctools.info/index.php/Main_Page
Would be nice to know since all termux users will buy a new phone or tablet sooner or later.
-
- Forum Contributions
- Points: 42 582,00
- Posts: 2059
- Joined: 04/11/2019, 21:13
- Status: Online (Active 2 Hours, 33 Minutes ago)
- Medals: 2
- Topics: 158
- Reputation: 7111
- Been thanked: 6477 times
-
- Forum Contributions
- Points: 14 078,00
- Posts: 327
- Joined: 17/10/2020, 22:28
- Status: Offline (Active 5 Days, 8 Hours, 36 Minutes ago)
- Medals: 2
- Topics: 5
- Reputation: 506
- Has thanked: 349 times
- Been thanked: 671 times
Re: Compiling Stockfish with gcc on Termux
@hagtorp since you probably will install cctools, let us know, if it worked.
-
- Forum Contributions
- Points: 19 796,00
- Posts: 159
- Joined: 04/11/2019, 3:15
- Status: Offline (Active 7 Months, 1 Day, 2 Hours, 15 Minutes ago)
- Topics: 3
- Reputation: 30
- Has thanked: 9 times
- Been thanked: 24 times
Re: Compiling Stockfish with gcc on Termux
@hagtorp since you probably will install cctools, let us know, if it worked.
[/quote]
Maybe with time. So far I am satisfied with the standard gcc-11
-
- Forum Contributions
- Points: 19 796,00
- Posts: 159
- Joined: 04/11/2019, 3:15
- Status: Offline (Active 7 Months, 1 Day, 2 Hours, 15 Minutes ago)
- Topics: 3
- Reputation: 30
- Has thanked: 9 times
- Been thanked: 24 times
Re: Compiling Stockfish with gcc on Termux
in general, you can build gcc yourself in termux. I collected
-
- Forum Contributions
- Points: 14 078,00
- Posts: 327
- Joined: 17/10/2020, 22:28
- Status: Offline (Active 5 Days, 8 Hours, 36 Minutes ago)
- Medals: 2
- Topics: 5
- Reputation: 506
- Has thanked: 349 times
- Been thanked: 671 times
Re: Compiling Stockfish with gcc on Termux
Where did you get gcc11 for termux? I also would like to have it!
Edit: OK, you compiled it by yourself, great!
Could you please make a package (or a somewhat detailed description how to do it) for the ones who are to stupid for self-compiling gcc11 like me?
-
- Forum Contributions
- Points: 19 796,00
- Posts: 159
- Joined: 04/11/2019, 3:15
- Status: Offline (Active 7 Months, 1 Day, 2 Hours, 15 Minutes ago)
- Topics: 3
- Reputation: 30
- Has thanked: 9 times
- Been thanked: 24 times
Re: Compiling Stockfish with gcc on Termux
[/quote]
Where did you get gcc11 for termux? I also would like to have it!
Edit: OK, you compiled it by yourself, great!
Could you please make a package for the ones who are to stupid for self-compiling gcc11 like me?
[/quote]
No, right now I'm using gcc-11 which comes with termux and it works well. I say that I used to build compilers myself.
Where did you get gcc11 for termux? I also would like to have it!
Edit: OK, you compiled it by yourself, great!
Could you please make a package for the ones who are to stupid for self-compiling gcc11 like me?
[/quote]
No, right now I'm using gcc-11 which comes with termux and it works well. I say that I used to build compilers myself.
-
- Forum Contributions
- Points: 42 582,00
- Posts: 2059
- Joined: 04/11/2019, 21:13
- Status: Online (Active 2 Hours, 33 Minutes ago)
- Medals: 2
- Topics: 158
- Reputation: 7111
- Been thanked: 6477 times
Re: Compiling Stockfish with gcc on Termux
Another way to use GCC under Termux is to use a distribution under Termux (e.g. Arch Linux) and use the GCC compiler inside of this distribution. Did a short test with Arch Linux and it worked so far. However, the compilation takes an extremely long time. Maybe there are better distributions for Termux out there.
https://wiki.termux.com/wiki/PRoot
https://wiki.termux.com/wiki/PRoot
-
- Forum Contributions
- Points: 19 796,00
- Posts: 159
- Joined: 04/11/2019, 3:15
- Status: Offline (Active 7 Months, 1 Day, 2 Hours, 15 Minutes ago)
- Topics: 3
- Reputation: 30
- Has thanked: 9 times
- Been thanked: 24 times
Re: Compiling Stockfish with gcc on Termux
What for? There is also gcc-11.1 from its-pointless. It works well and is faster than clangArchimedes wrote: ↑05/10/2022, 13:23 Another way to use GCC under Termux is to use a distribution under Termux (e.g. Arch Linux) and use the GCC compiler inside of this distribution. Did a short test with Arch Linux and it worked so far. However, the compilation takes an extremely long time. Maybe there are better distributions for Termux out there.
https://wiki.termux.com/wiki/PRoot
-
- Forum Contributions
- Points: 40 305,00
- Posts: 1924
- Joined: 04/11/2019, 14:45
- Status: Offline (Active 3 Months, 5 Days, 23 Hours, 11 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
This method is still great. ssfgmfgsoke
That was the one I mentioned few weeks ago Archimedes. Glad I've found it back.
That was the one I mentioned few weeks ago Archimedes. Glad I've found it back.
Archimedes wrote: ↑17/10/2021, 13:06 Make changes to the makefile, as the following code pieces are shown:
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
-
- Forum Contributions
- Points: 42 582,00
- Posts: 2059
- Joined: 04/11/2019, 21:13
- Status: Online (Active 2 Hours, 33 Minutes ago)
- Medals: 2
- Topics: 158
- Reputation: 7111
- Been thanked: 6477 times
Re: Compiling Stockfish with gcc on Termux
This is just a quick and messy solution. I'm glad it still works. But in the meantime I use my own Makefile for this. This way I am mostly independent against changes in the original Makefile. However, the Makefile is only for arm64-v8a and the network is not automatically downloaded. Just copy the Makefile into the src directory of Stockfish and enter the following two commands. GCC is the default compiler.kramnik wrote: ↑25/03/2023, 5:20 This method is still great. ssfgmfgsoke
That was the one I mentioned few weeks ago Archimedes. Glad I've found it back.
Archimedes wrote: ↑17/10/2021, 13:06 Make changes to the makefile, as the following code pieces are shown:
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
Code: Select all
make net
make profile-build
-
- Forum Contributions
- Points: 40 305,00
- Posts: 1924
- Joined: 04/11/2019, 14:45
- Status: Offline (Active 3 Months, 5 Days, 23 Hours, 11 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
I'm getting the following error while trying to compile BrainLearn:
I searched on Google about "mm_malloc.h: No such file or directory" but I didn't found anything relevant. Looks like this header is inside the libgcc-*-dev that is not in the Termux repositories.
Any help?
Code: Select all
In file included from position.h:31,
from endgame.h:28,
from material.h:22,
from material.cpp:22:
misc.h:32:10: fatal error: mm_malloc.h: No such file or directory
32 | #include <mm_malloc.h>
| ^~~~~~~~~~~~~
compilation terminated.
g++ -Wall -Wcast-qual -fexceptions -std=c++17 -fprofile-generate=profdir -pedantic -Wextra -Wshadow -Wmissing-declarations -DUSE_PTHREADS -DNDEBUG -O3 -march=native -DIS_64BIT -DUSE_POPCNT -DUSE_NEON=8 -flto -flto-partition=one -fPIE -c -o ucioption.o ucioption.cpp
In file included from position.h:31,
from benchmark.cpp:26:
misc.h:32:10: fatal error: mm_malloc.h: No such file or directory
32 | #include <mm_malloc.h>
| ^~~~~~~~~~~~~
compilation terminated.
In file included from position.h:31,
from endgame.h:28,
from endgame.cpp:22:
misc.h:32:10: fatal error: mm_malloc.h: No such file or directory
32 | #include <mm_malloc.h>
| ^~~~~~~~~~~~~
compilation terminated.
In file included from position.h:31,
from endgame.h:28,
from material.h:22,
from evaluate.cpp:32:
misc.h:32:10: fatal error: mm_malloc.h: No such file or directory
32 | #include <mm_malloc.h>
| ^~~~~~~~~~~~~
compilation terminated.
make[2]: *** [<builtin>: benchmark.o] Error 1
make[2]: *** Waiting for unfinished jobs....
make[2]: *** [<builtin>: endgame.o] Error 1
make[2]: *** [<builtin>: evaluate.o] Error 1
make[2]: *** [<builtin>: material.o] Error 1
In file included from learn.cpp:4:
misc.h:32:10: fatal error: mm_malloc.h: No such file or directory
32 | #include <mm_malloc.h>
| ^~~~~~~~~~~~~
compilation terminated.
make[2]: *** [<builtin>: learn.o] Error 1
In file included from position.h:31,
from polybook.h:23,
from search.cpp:26:
misc.h:32:10: fatal error: mm_malloc.h: No such file or directory
32 | #include <mm_malloc.h>
| ^~~~~~~~~~~~~
compilation terminated.
make[2]: *** [<builtin>: search.o] Error 1
In file included from position.h:31,
from endgame.h:28,
from main.cpp:22:
misc.h:32:10: fatal error: mm_malloc.h: No such file or directory
32 | #include <mm_malloc.h>
| ^~~~~~~~~~~~~
compilation terminated.
In file included from bitboard.cpp:23:
misc.h:32:10: fatal error: mm_malloc.h: No such file or directory
32 | #include <mm_malloc.h>
| ^~~~~~~~~~~~~
compilation terminated.
make[2]: *** [<builtin>: main.o] Error 1
make[2]: *** [<builtin>: bitboard.o] Error 1
In file included from position.h:31,
from movepick.h:27,
from movepick.cpp:22:
misc.h:32:10: fatal error: mm_malloc.h: No such file or directory
32 | #include <mm_malloc.h>
| ^~~~~~~~~~~~~
compilation terminated.
In file included from pawns.h:22,
from pawns.cpp:23:
misc.h:32:10: fatal error: mm_malloc.h: No such file or directory
32 | #include <mm_malloc.h>
| ^~~~~~~~~~~~~
compilation terminated.
make[2]: *** [<builtin>: pawns.o] Error 1
make[2]: *** [<builtin>: movepick.o] Error 1
In file included from search.h:24,
from thread.cpp:23:
misc.h:32:10: fatal error: mm_malloc.h: No such file or directory
32 | #include <mm_malloc.h>
| ^~~~~~~~~~~~~
compilation terminated.
make[2]: *** [<builtin>: thread.o] Error 1
In file included from position.h:31,
from polybook.h:23,
from polybook.cpp:19:
misc.h:32:10: fatal error: mm_malloc.h: No such file or directory
32 | #include <mm_malloc.h>
| ^~~~~~~~~~~~~
compilation terminated.
In file included from position.h:31,
from movegen.cpp:22:
misc.h:32:10: fatal error: mm_malloc.h: No such file or directory
32 | #include <mm_malloc.h>
| ^~~~~~~~~~~~~
compilation terminated.
In file included from ucioption.cpp:25:
misc.h:32:10: fatal error: mm_malloc.h: No such file or directory
32 | #include <mm_malloc.h>
| ^~~~~~~~~~~~~
compilation terminated.
make[2]: *** [<builtin>: polybook.o] Error 1
make[2]: *** [<builtin>: ucioption.o] Error 1
In file included from position.cpp:28:
misc.h:32:10: fatal error: mm_malloc.h: No such file or directory
32 | #include <mm_malloc.h>
| ^~~~~~~~~~~~~
compilation terminated.
make[2]: *** [<builtin>: movegen.o] Error 1
make[2]: *** [<builtin>: position.o] Error 1
In file included from misc.cpp:67:
misc.h:32:10: fatal error: mm_malloc.h: No such file or directory
32 | #include <mm_malloc.h>
| ^~~~~~~~~~~~~
compilation terminated.
make[2]: *** [<builtin>: misc.o] Error 1
In file included from tt.cpp:24:
misc.h:32:10: fatal error: mm_malloc.h: No such file or directory
32 | #include <mm_malloc.h>
| ^~~~~~~~~~~~~
compilation terminated.
make[2]: *** [<builtin>: tt.o] Error 1
In file included from position.h:31,
from uci.cpp:28:
misc.h:32:10: fatal error: mm_malloc.h: No such file or directory
32 | #include <mm_malloc.h>
| ^~~~~~~~~~~~~
compilation terminated.
In file included from search.h:24,
from timeman.cpp:23:
misc.h:32:10: fatal error: mm_malloc.h: No such file or directory
32 | #include <mm_malloc.h>
| ^~~~~~~~~~~~~
compilation terminated.
make[2]: *** [<builtin>: uci.o] Error 1
make[2]: *** [<builtin>: timeman.o] Error 1
make[2]: Leaving directory '/data/data/com.termux/files/home/BrainLearn-23/BrainLearn-23/src'
make[1]: *** [Makefile:1022: gcc-profile-make] Error 2
make[1]: Leaving directory '/data/data/com.termux/files/home/BrainLearn-23/BrainLearn-23/src'
make: *** [Makefile:859: profile-build] Error 2
Any help?
-
- Forum Contributions
- Points: 42 582,00
- Posts: 2059
- Joined: 04/11/2019, 21:13
- Status: Online (Active 2 Hours, 33 Minutes ago)
- Medals: 2
- Topics: 158
- Reputation: 7111
- Been thanked: 6477 times
Re: Compiling Stockfish with gcc on Termux
Should be present in the include directory of the Clang compiler.
-
- Forum Contributions
- Points: 40 305,00
- Posts: 1924
- Joined: 04/11/2019, 14:45
- Status: Offline (Active 3 Months, 5 Days, 23 Hours, 11 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
So how can I use it to compile BrainLearn?
Archimedes wrote: ↑14/04/2023, 9:54Should be present in the include directory of the Clang compiler.