Issue
I need to install arm-none-eabi-gcc / gcc-arm-none-eabi ARM compiler on android in order to convert C++ to ASM (M3 Cortex), on android device with AArch64 architecture (not rooted) using third party Termux app as terminal and linux enviroment emulator for that arm compiler. Using Termux with it's API I'm planning to create a simple android app which will do the convertion task easily, by running arm compiler from shell with parameters to convert C++ to ASM.
I tried many times following online articles to build the arm compiler but could not be able to install that package. For example:
$ sudo apt-get remove binutils-arm-none-eabi gcc-arm-none-eabi
$ sudo add-apt-repository ppa:team-gcc-arm-embedded/ppa
$ sudo apt-get update
$ sudo apt-get install gcc-arm-none-eabi
$ sudo apt-get install gdb-arm-none-eabi
Because, I use Termux as terminal and linux enviroment emulator, I fail to build the arm compiler everytime.
How to install that arm compiler on android (posible using termux), if all I want is to run the compiler from shell with parameters to get C++ converted to ASM (M3 Cortex)
arm-none-eabi-gcc -O2 -mthumb -c test.c -o test.o
Solution
Install proot and proot-distro packeges in termux
pkg install proot
Install debian distro with proot and after that do loging into debian
pkg install proot-distro
proot-distro install debian
proot-distro login debian
If sudo is not installed in debian, then you have to install it.
pkg install sudo
After that just install the compiler like you do on usual debian system.
On a Debian-based Linux distribution, gcc 4.9.3 for ARM can be installed with apt-get as documented below. The steps are explained in depth at https://launchpad.net/~team-gcc-arm-embedded/+archive/ubuntu/ppa.
$ sudo apt-get remove binutils-arm-none-eabi gcc-arm-none-eabi
$ sudo add-apt-repository ppa:team-gcc-arm-embedded/ppa
$ sudo apt-get update
$ sudo apt-get install gcc-arm-none-eabi
$ sudo apt-get install gdb-arm-none-eabi
If add-apt-repository
fails or causes some errors then try without it, or do this:
sudo apt install software-properties-common
sudo apt-add-repository "deb http://ppa.launchpad.net/ubuntu-mozilla-security/ppa/ubuntu focal main"
sudo apt update
Answered By - Aziz