blob: 83f22da73322b0e60c4920833224eab90d5f5a24 [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
Nguyen Anh Quynhf74bebf2013-12-09 13:53:11 +08008(1) On *nix (such as MacOSX, Linux & FreeBSD):
Nguyen Anh Quynh26ee41a2013-11-27 12:11:31 +08009
10- To compile for current platform, run either:
11 $ ./compile.sh
12 or:
13 $ make
14
Nguyen Anh Quynhf74bebf2013-12-09 13:53:11 +080015 For FreeBSD, use 'gmake' instread of 'make':
16
17 $ gmake
18
Nguyen Anh Quynh26ee41a2013-11-27 12:11:31 +080019 Then run "./tests/test*" to see the tests disassembling sample code.
20
Nguyen Anh Quynh2cd33702013-12-02 20:32:41 +080021- On 64-bit OS, run command below to cross-compile Capstone for 32-bit binary:
Nguyen Anh Quynh26ee41a2013-11-27 12:11:31 +080022
23 $ ./compile.sh nix32
24
25 Then similarly, run "./tests/test*" to see the tests disassembling sample code.
26
27
28
29(2) To install Capstone, run:
30
31 $ sudo make install
32
Nguyen Anh Quynhf74bebf2013-12-09 13:53:11 +080033 For FreeBSD, use 'gmake' instead of 'make':
34
35 $ sudo gmake install
36
Nguyen Anh Quynh2cd33702013-12-02 20:32:41 +080037Users are then required to enter root password to copy Capstone into machine
Nguyen Anh Quynh26ee41a2013-11-27 12:11:31 +080038system directories.
39
40NOTE: The core framework that will be installed by "make install" consist of
41only following files:
42
Patroklos Argyroudisa6503fe2013-11-27 14:25:34 +020043 /usr/include/capstone/capstone.h
44 /usr/include/capstone/x86.h
45 /usr/include/capstone/arm.h
46 /usr/include/capstone/arm64.h
47 /usr/include/capstone/mips.h
Nguyen Anh Quynh26ee41a2013-11-27 12:11:31 +080048 /usr/lib/libcapstone.so (for Linux/*nix), or /usr/lib/libcapstone.dylib (OSX)
Nguyen Anh Quynh04271222013-12-09 11:12:47 +080049 /usr/lib/libcapstone.a
Nguyen Anh Quynh26ee41a2013-11-27 12:11:31 +080050
51
52
53(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 +080054for 64-bit binaries) are required.
Nguyen Anh Quynh26ee41a2013-11-27 12:11:31 +080055
56 - To cross-compile Windows 32-bit binary, simply run
Daniel Godas-Lopezcf05e112013-11-28 18:23:39 +000057 $ ./compile.sh cross-win32
Nguyen Anh Quynh26ee41a2013-11-27 12:11:31 +080058
59 - To cross-compile Windows 64-bit binary, simply run
Daniel Godas-Lopezcf05e112013-11-28 18:23:39 +000060 $ ./compile.sh cross-win64
Nguyen Anh Quynh26ee41a2013-11-27 12:11:31 +080061
62Resulted files "capstone.dll" and "tests/test*.exe" can then be used on Windows machine.
63
64
65
Daniel Godas-Lopezcf05e112013-11-28 18:23:39 +000066(4) To compile under Cygwin gcc-mingw-w64-i686 or x86_64-w64-mingw32 run:
67
68 - To compile Windows 32-bit binary under Cygwin, simply run
69 $ ./compile.sh cygwin-mingw32
70
71 - To compile Windows 64-bit binary under Cygwin, simply run
72 $ ./compile.sh cygwin-mingw64
73
74
Nguyen Anh Quynh2cd33702013-12-02 20:32:41 +080075(5) By default, gcc is used as compiler. To use "clang" compiler instead, run command below:
Nguyen Anh Quynh26ee41a2013-11-27 12:11:31 +080076
Nguyen Anh Quynh46e8ca82013-11-28 10:10:50 +080077 $ ./compile.sh clang
Nguyen Anh Quynh26ee41a2013-11-27 12:11:31 +080078
79
Nguyen Anh Quynh676cabd2013-12-02 20:23:35 +080080(6) So far, Python, Ruby, Ocaml, Java, C# and Go are supported by bindings. Look for
81the bindings under directory bindings/, and refer to README file of corresponding languages.
82