Skip to content

Instantly share code, notes, and snippets.

@vit1-irk
Created July 6, 2016 09:37
Show Gist options
  • Star 4 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save vit1-irk/f45bec7f882d319d01c66ce6d54dfc9f to your computer and use it in GitHub Desktop.
Save vit1-irk/f45bec7f882d319d01c66ce6d54dfc9f to your computer and use it in GitHub Desktop.
Binary SBCL on Android (and Termux too)
Original: http://ii-net.tk/ii/ii-web.php?msgid=dv3z3xUssnrCkrxJSXY3
Quick installation of SBCL on Termux and some other Android systems
Does not require root access on your phone (only on PC)
Part 1 (desktop system)
====
# You can find these packages easily for your own distribution
sudo pacman -S qemu-static qemu-arch-extra-static binfmt-qemu-static
mkdir archey
cd archey
wget -c http://ru.mirror.archlinuxarm.org/os/ArchLinuxARM-armv7-latest.tar.gz
tar xvf *.tar.gz
mv ArchLinuxARM-armv7-latest.tar.gz ..
cp /usr/bin/qemu-arm-static ./usr/bin/
# Both pacman and sbcl can't run without locale support
echo "en_US.UTF-8 UTF-8" > ./etc/locale.gen
echo "ru_RU.UTF-8 UTF-8" >> ./etc/locale.gen
# If you haven't got systemd, update binfmt rules for qemu-arm-static some other way instead
sudo systemctl start systemd-binfmt.service
# For correct chroot into arch
git clone https://projects.archlinux.org/arch-install-scripts.git
cd arch-install-scripts
make
cp arch-chroot ..
cd ..
sudo ./arch-chroot . /bin/bash
locale-gen
pacman -S sbcl
exit
cd ..
# Easy way; slow and overheaded, but you'll eventually get full archlinux chroot!
tar cvJf archey.tar.xz archey/
# Complex way; you can save some free space on your storage by doing this
mkdir new-root
cd new-root
mkdir -p ./usr/{lib,bin,share}
cp -r ../archey/usr/lib/sbcl/ ./usr/lib
cp -r ../archey/usr/share/locale ./usr/share/
cp -r ../archey/usr/share/i18n ./usr/share/
cp -r ../archey/usr/bin/sbcl ./usr/bin/
cp -r ../archey/usr/share/sbcl-source/ ./usr/share/
ln -s ./usr/lib .
cp ../archey/usr/lib/ld* ./usr/lib/
cp ../archey/lib/libgcc* ./usr/lib/
cp ../archey/lib/libssl* ./usr/lib/
cp ../archey/lib/libcrypto* ./usr/lib/
cp ../archey/lib/libdl* ./usr/lib/
cp ../archey/lib/libz* ./usr/lib/
cp ../archey/lib/libm* ./usr/lib/
cp ../archey/lib/libc.* ./usr/lib
cd ..
tar cvJf new-root.tar.xz new-root/
====
Part 2 (mobile phone)
Move your archive in Termux's $HOME
Unzip: tar xvf your-archive.tar.xz
Now you have "mini-chroot" to use with proot program to transparently execute sbcl
@12Tall
Copy link

12Tall commented May 31, 2019

Thanks

@francogrex
Copy link

This unfortunately is not the same as building a binary executable directly runnable on android. chroot/proot to use executables inside a small linux environment is rather well known but not much appreciated as it isn't the light flexible option.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment