Based on https://github.com/qilingframework/qiling/blob/master/docs/SETUP.md with customizations to make things install nicely in my environment.
Build and install keystone. I use pyenv to manage my python versions so use pyenv local
to set keystone to build with python2.7
git clone https://github.com/keystone-engine/keystone
cd keystone
pyenv local 2.7.x
mkdir build
cd build
cmake -DCMAKE_INSTALL_PREFIX=$HOME/.local -DBUILD_LIBS_ONLY=0 -DLLVM_BUILD_32_BITS=0 -DCMAKE_BUILD_TYPE=Release -DBUILD_SHARED_LIBS=ON -DLLVM_TARGETS_TO_BUILD=all -G "Unix Makefiles" ..
make -j8
cd ../bindings/python
make
Now that we are done with python2, remove the local pyenv version and install the python3 bindings
rm ../.python-version
make install
git clone https://github.com/qilingframework/qiling
cd qiling
sudo pip3 install -r requirements.txt
sudo python3 setup.py install
pyenv global 3.8.2 2.7.16 system hobbes:~/.../keystone/build aaron$ cmake -DCMAKE_INSTALL_PREFIX=$HOME/.local -DBUILD_LIBS_ONLY=0 -DLLVM_BUILD_32_BITS=0 -DCMAKE_BUILD_TYPE=Release -DBUILD_SHARED_LIBS=ON -DLLVM_TARGETS_TO_BUILD=all -G "Unix Makefiles" ..