6

I don't like the default C compiler clang provided by Termux. Is there a way I can get GNU GCC in my Termux environment?

3

Another way to get gcc would be to add the community repo hosted by its-pointless at https://github.com/its-pointless/its-pointless.github.io. Sources are (more or less) available at https://github.com/its-pointless/gcc_termux.

Other popular packages available includes numpy and scipy.

More information about this and other community repositories can be found in the termux wiki.

To add this particular repository to your termux environment, run:

# Get some needed tools. coreutils for mkdir command, gnugp for the signing key, and apt-transport-https to actually connect to the repo
apt-get update
apt-get  --assume-yes upgrade 
apt-get  --assume-yes install coreutils gnupg2 apt-transport-https wget 
# Make the sources.list.d directory
mkdir $PREFIX/etc/apt/sources.list.d
# Write the needed source file - Added Missing "> character on line below
echo "deb [trusted=yes] https://its-pointless.github.io/files/ termux extras" > $PREFIX/etc/apt/sources.list.d/pointless.list
# Download signing key from https://its-pointless.github.io/pointless.gpg 
wget https://its-pointless.github.io/pointless.gpg
apt-key add pointless.gpg
# Update apt
apt update

(instructions taken from https://github.com/its-pointless/its-pointless.github.io/blob/master/setup-pointless-repo.sh)

2

This is a very interesting solution.

First download GCC for C4droid from Google Play.

Go find its apk under /data/app/com.n0n3m4.gcc4droid-#, take the APK and extract /assets/gcc.zip. Now extract gcc.zip to

/data/data/com.termux/files/usr/libexec

Apply chmod -R 644 to the whole folder and chmod -R 755 to ARCH/bin, bin and libexec. Link gcc programs to $PREFIX/bin and you'll be able to use GCC instead of Clang. Remember to add -pie when compiling executables.

1

Install Arch Linux in Termux PRoot to get a full Linux development environment. See https://sdrausty.github.io/TermuxArch/docs/install for installation instructions. Use pacman -S base base-devel to install the developer's environment which includes GCC. Arch Linux in Termux PRoot

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.