blob: b881176dc8fa9135eefe94812581d68333cc9f69 [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
Nguyen Anh Quynh2cd33702013-12-02 20:32:41 +080017- On 64-bit OS, run command below to cross-compile Capstone for 32-bit binary:
Nguyen Anh Quynh26ee41a2013-11-27 12:11:31 +080018
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
Nguyen Anh Quynh2cd33702013-12-02 20:32:41 +080029Users are then required to enter root password to copy Capstone into machine
Nguyen Anh Quynh26ee41a2013-11-27 12:11:31 +080030system 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
Nguyen Anh Quynh2cd33702013-12-02 20:32:41 +080045for 64-bit binaries) are required.
Nguyen Anh Quynh26ee41a2013-11-27 12:11:31 +080046
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
Nguyen Anh Quynh2cd33702013-12-02 20:32:41 +080066(5) By default, gcc is used as compiler. To use "clang" compiler instead, run command below:
Nguyen Anh Quynh26ee41a2013-11-27 12:11:31 +080067
Nguyen Anh Quynh46e8ca82013-11-28 10:10:50 +080068 $ ./compile.sh clang
Nguyen Anh Quynh26ee41a2013-11-27 12:11:31 +080069
70
Nguyen Anh Quynh676cabd2013-12-02 20:23:35 +080071(6) So far, Python, Ruby, Ocaml, Java, C# and Go are supported by bindings. Look for
72the bindings under directory bindings/, and refer to README file of corresponding languages.
73
74For each binding, the common method to compile its code is to run the command below
75from the directory of the binding (such as in ./bindings/python/ for Python and so on)
76
77 $ make
78
Nguyen Anh Quynh2cd33702013-12-02 20:32:41 +080079For some bindings (such as Python), the code can be installed into system with:
Nguyen Anh Quynh676cabd2013-12-02 20:23:35 +080080
81 $ sudo make install
Nguyen Anh Quynh2cd33702013-12-02 20:32:41 +080082