blob: e56d416ed05b7db787fe860e7f1a9ba771d1dce4 [file] [log] [blame]
Nguyen Anh Quynh26ee41a2013-11-27 12:11:31 +08001How To Compile & Run Capstone for Linux, Mac OSX, *nix and Windows
2 *-*-*-*-*-*
3
4
5Capstone requires no prerequisite packages, so it is easy to compile & install.
6
7
8(1) On Linux, Mac OSX or *nix:
9
10- To compile for current platform, run either:
11 $ ./compile.sh
12 or:
13 $ make
14
15 Then run "./tests/test*" to see the tests disassembling sample code.
16
17- On 64-bit OS, if you want to cross-compile Capstone for 32-bit binary, run:
18
19 $ ./compile.sh nix32
20
21 Then similarly, run "./tests/test*" to see the tests disassembling sample code.
22
23
24
25(2) To install Capstone, run:
26
27 $ sudo make install
28
29You are then required to enter root password to copy Capstone into machine
30system directories.
31
32NOTE: The core framework that will be installed by "make install" consist of
33only following files:
34
Patroklos Argyroudisa6503fe2013-11-27 14:25:34 +020035 /usr/include/capstone/capstone.h
36 /usr/include/capstone/x86.h
37 /usr/include/capstone/arm.h
38 /usr/include/capstone/arm64.h
39 /usr/include/capstone/mips.h
Nguyen Anh Quynh26ee41a2013-11-27 12:11:31 +080040 /usr/lib/libcapstone.so (for Linux/*nix), or /usr/lib/libcapstone.dylib (OSX)
41
42
43
44(3) To cross-compile for Windows, Linux & gcc-mingw-w64-i686 (and also gcc-mingw-w64-x86-64
45if you want 64-bit binaries) are required.
46
47 - To cross-compile Windows 32-bit binary, simply run
Daniel Godas-Lopezcf05e112013-11-28 18:23:39 +000048 $ ./compile.sh cross-win32
Nguyen Anh Quynh26ee41a2013-11-27 12:11:31 +080049
50 - To cross-compile Windows 64-bit binary, simply run
Daniel Godas-Lopezcf05e112013-11-28 18:23:39 +000051 $ ./compile.sh cross-win64
Nguyen Anh Quynh26ee41a2013-11-27 12:11:31 +080052
53Resulted files "capstone.dll" and "tests/test*.exe" can then be used on Windows machine.
54
55
56
Daniel Godas-Lopezcf05e112013-11-28 18:23:39 +000057(4) To compile under Cygwin gcc-mingw-w64-i686 or x86_64-w64-mingw32 run:
58
59 - To compile Windows 32-bit binary under Cygwin, simply run
60 $ ./compile.sh cygwin-mingw32
61
62 - To compile Windows 64-bit binary under Cygwin, simply run
63 $ ./compile.sh cygwin-mingw64
64
65
66(5) By default, gcc is used as compiler. If you want to use "clang" instead, compile
Nguyen Anh Quynh26ee41a2013-11-27 12:11:31 +080067the code with:
68
Nguyen Anh Quynh46e8ca82013-11-28 10:10:50 +080069 $ ./compile.sh clang
Nguyen Anh Quynh26ee41a2013-11-27 12:11:31 +080070
71
Nguyen Anh Quynh676cabd2013-12-02 20:23:35 +080072(6) So far, Python, Ruby, Ocaml, Java, C# and Go are supported by bindings. Look for
73the bindings under directory bindings/, and refer to README file of corresponding languages.
74
75For each binding, the common method to compile its code is to run the command below
76from the directory of the binding (such as in ./bindings/python/ for Python and so on)
77
78 $ make
79
80For some bindings (such as Python), you can install the code into your machine with:
81
82 $ sudo make install