Nguyen Anh Quynh | 26ee41a | 2013-11-27 12:11:31 +0800 | [diff] [blame] | 1 | How To Compile & Run Capstone for Linux, Mac OSX, *nix and Windows |
| 2 | *-*-*-*-*-* |
| 3 | |
| 4 | |
| 5 | Capstone 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 | |
| 29 | You are then required to enter root password to copy Capstone into machine |
| 30 | system directories. |
| 31 | |
| 32 | NOTE: The core framework that will be installed by "make install" consist of |
| 33 | only following files: |
| 34 | |
Patroklos Argyroudis | a6503fe | 2013-11-27 14:25:34 +0200 | [diff] [blame^] | 35 | /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 Quynh | 26ee41a | 2013-11-27 12:11:31 +0800 | [diff] [blame] | 40 | /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 |
| 45 | if you want 64-bit binaries) are required. |
| 46 | |
| 47 | - To cross-compile Windows 32-bit binary, simply run |
| 48 | $ ./compile.sh win32 |
| 49 | |
| 50 | - To cross-compile Windows 64-bit binary, simply run |
| 51 | $ ./compile.sh win64 |
| 52 | |
| 53 | Resulted files "capstone.dll" and "tests/test*.exe" can then be used on Windows machine. |
| 54 | |
| 55 | |
| 56 | |
| 57 | (4) By default, gcc is used as compiler. If you want to use "clang" instead, compile |
| 58 | the code with: |
| 59 | |
| 60 | $ ./compile clang |
| 61 | |
| 62 | |
| 63 | (5) So far, Python, Ruby, Ocaml, Java, C# and Go are supported by bindings. Look for the bindings |
| 64 | under directory bindings/, and refer to README file of corresponding languages. |