Skip to content

Installing on Cygwin & Python3

E:V:A edited this page Oct 21, 2018 · 1 revision

If you want to use the latest Capstone features on Cygwin and Python3, you need to follow this procedure (and not use pip install capstone.)

  1. Install Cygwin Requirements

Here are some minimal requirements (not tested from scratch).

apt-cyg install base-cygwin base-files bind-utils diffutils
apt-cyg install coreutils binutils patch cygutils util-linux

apt-cyg install make cmake ncurses
apt-cyg install gcc-core gcc-g++ 
#apt-cyg install <countless other libraries>

apt-cyg install python3 python3-devel python3-pip

There will liekly be many more, but very similar to any *nix distribution.
Always use apt-cyg!

  • (1b) Install Python3 Requirements
    You should already have these...
pip3 install ...
  1. Download Capstone Sources
cd $HOME
git clone https://github.com/aquynh/capstone.git
cd capstone
  1. Use the "next" branch for the most recent API enhancements
git branch -a
git checkout next
  1. Clear the LIBCAPSTONE_PATH environment variable
echo $LIBCAPSTONE_PATH
export -n LIBCAPSTONE_PATH
  1. Compile Capstone (core) from sources
make clean
./make.sh gcc

🔴 (E1) Fix broken filename

ls -alh capstone*
mv capstone. capstone.dll
  1. Install Capstone: core
./make.sh install
  1. Install Capstone: Python3 Bindings
#----------------------------------------------------
#  You can use:  `pip3 install capstone`, BUT then 
#  you will miss out on new features! Use sources!
#----------------------------------------------------
cd bindings/python
make clean
make install3
  1. Check that your Python Core and API bindings match:
python3 -c "from capstone import *; version_bind(); cs_version(); print(version_bind() == cs_version())"
  1. Check PIP package version
pip3 list |grep capstone
  1. Test all python scripts
python3 test_all.py

Done!

NOTE:
If you get any errors with this, it most likely due to missing Cygwin packages.
Make sure you have all the "normal" GCC stuff like, make, cmake and automake etc.