-
-
Save drhuffman12/2c1857fc76c213a1ef5ca6bd9da4a420 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# See also: https://forum.crystal-lang.org/t/running-crystal-on-termux/3880 | |
# Termux | |
pkg install -y \ | |
automake \ | |
build-essential \ | |
clang \ | |
git \ | |
libbsd* \ | |
libedit* \ | |
libevent* \ | |
libgc* \ | |
libgmp* \ | |
libpcre* \ | |
libssh* \ | |
libtool* \ | |
libxml2* \ | |
libyaml* \ | |
libllvm* \ | |
lld* \ | |
# libgmpxx4ldbl \ | |
# ln -sf /usr/bin/ld.lld-8 /usr/bin/ld.lld | |
# zip up `crystal` folder and copy to device | |
# cd ~/storage/shared/Android/data/com.termux/files | |
# tar xvzf file.tar.gz | |
# aka: data/data/com.termux/files/home/storage/shared/Android/data/com.termux/files | |
# copy crystal | |
cp crystal.tar.gz ~/ | |
PATH=/data/data/com.termux/files/usr/bin:$PATH | |
cd ~/ | |
tar xvzf crystal.tar.gz | |
cd crystal | |
# LLVM_CONFIG=$(which llvm-config) make deps | |
make deps | |
cc crystal.o -o .build/crystal -rdynamic src/llvm/ext/llvm_ext.o `llvm-config --libs --system-libs --ldflags 2> /dev/null` -lstdc++ -lpcre -lm -lgc -lpthread -levent -lrt -ldl |
Note: After copying files to device , on the device you must remove llvm_ext.o
from device and re-run make deps
and then run cc crystal ...
:
$ find -name llvm_ext.o
./src/llvm/ext/llvm_ext.o
$ rm ./src/llvm/ext/llvm_ext.o
make deps
cc crystal.o -o .build/crystal -rdynamic src/llvm/ext/llvm_ext.o `llvm-config --libs --system-libs --ldflags 2> /dev/null` -lstdc++ -lpcre -lm -lgc -lpthread -levent -lrt -ldl
~/crystal $ bin/crystal -v
bin/crystal: 153: crystal: not found
Using compiled compiler at .build/crystal
Crystal 1.2.0-dev ()
LLVM: 12.0.0
Default target: aarch64-unknown-linux-android24
~/crystal $ bin/crystal eval "puts(1+2)"
bin/crystal: 153: crystal: not found
Using compiled compiler at .build/crystal
3
~/crystal $ bin/crystal eval "puts Time.utc""
> "
bin/crystal: 153: crystal: not found
Using compiled compiler at .build/crystal
2021-09-25 15:33:44 UTC
Now to rebuild Crystal on device and run specs:
# backup
mv bin/crystal bin/crystal.OLD
# rebuild
make clean crystal
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Gets stuck at: