blob: 3eef2aff525dcbb3d3eeebf4c27a0e0cca588f18 [file] [log] [blame]
How To Compile, install & run Capstone for Linux, Mac OSX, *BSD and Windows
Capstone requires no prerequisite packages, so it is easy to compile & install.
(0) Tailor Capstone to your need.
Out of 5 archtitectures supported by Capstone (Arm, Arm64, Mips, PPC & X86),
if you just need several selected archs, you can choose which ones you want
to compile in by modifying before going to next steps.
By default, all 5 architectures are compiled.
(1) Compile from source
On *nix (such as MacOSX, Linux, *BSD, Solaris):
- To compile for current platform, run:
$ ./
- On 64-bit OS, run command below to cross-compile Capstone for 32-bit binary:
$ ./ nix32
(2) Install Capstone on *nix
To install Capstone, run:
$ sudo ./ install
For FreeBSD/OpenBSD, where sudo is unavailable, run:
$ su; ./ install
Users are then required to enter root password to copy Capstone into machine
system directories.
Afterwards, run "./tests/test*" to see the tests disassembling sample code.
NOTE: The core framework installed by "./ install" consist of
following files:
/usr/lib/ (for Linux/*nix), or /usr/lib/libcapstone.dylib (OSX)
(3) Cross-compile Windows from *nix
To cross-compile for Windows, Linux & gcc-mingw-w64-i686 (and also gcc-mingw-w64-x86-64
for 64-bit binaries) are required.
- To cross-compile Windows 32-bit binary, simply run:
$ ./ cross-win32
- To cross-compile Windows 64-bit binary, run:
$ ./ cross-win64
Resulted files "capstone.dll" and "tests/test*.exe" can then be used on Windows machine.
(4) Compile on Windows with Cygwin
To compile under Cygwin gcc-mingw-w64-i686 or x86_64-w64-mingw32 run:
- To compile Windows 32-bit binary under Cygwin, simply run
$ ./ cygwin-mingw32
- To compile Windows 64-bit binary under Cygwin, run
$ ./ cygwin-mingw64
(5) By default, "cc" (default C compiler on the system) is used as compiler.
- To use "clang" compiler instead, run command below:
$ ./ clang
- To use "gcc" compiler instead, run:
$ ./ gcc
(6) Language bindings
So far, Python, Ruby, Ocaml, Java, C# and Go are supported by bindings. Look for
the bindings under directory bindings/, and refer to README file of
corresponding languages.