capstone/COMPILE

108 lines
2.7 KiB
Plaintext
Raw Normal View History

How To Compile, install & run Capstone for Linux, Mac OSX, *BSD and Windows
2013-11-27 04:11:31 +00:00
*-*-*-*-*-*
Capstone requires no prerequisite packages, so it is easy to compile & install.
(0) Tailor Capstone to your need.
Out of 4 archtitectures supported by Capstone (Arm, Arm64, Mips & X86), if
you just need several selected archs, you can choose which ones you want
to compile in by modifying config.mk before going to next steps.
By default, all 4 architectures are compiled.
(1) Compile from source
On *nix (such as MacOSX, Linux & FreeBSD):
- To compile for current platform, run either:
2013-11-27 04:11:31 +00:00
$ ./compile.sh
or:
$ make
2013-12-09 08:05:49 +00:00
For FreeBSD/OpenBSD, use 'gmake' instread of 'make':
$ gmake
2013-11-27 04:11:31 +00:00
Then run "./tests/test*" to see the tests disassembling sample code.
- On 64-bit OS, run command below to cross-compile Capstone for 32-bit binary:
2013-11-27 04:11:31 +00:00
$ ./compile.sh nix32
Then similarly, run "./tests/test*" to see the tests disassembling sample code.
(2) Install Capstone on *nix
To install Capstone, run:
2013-11-27 04:11:31 +00:00
$ sudo make install
2013-12-09 08:05:49 +00:00
For FreeBSD/OpenBSD, use 'gmake' instead of 'make':
$ sudo gmake install
Users are then required to enter root password to copy Capstone into machine
system directories.
2013-11-27 04:11:31 +00:00
NOTE: The core framework that will be installed by "make install" consist of
only following files:
2013-11-27 04:11:31 +00:00
/usr/include/capstone/capstone.h
/usr/include/capstone/x86.h
/usr/include/capstone/arm.h
/usr/include/capstone/arm64.h
/usr/include/capstone/mips.h
2013-11-27 04:11:31 +00:00
/usr/lib/libcapstone.so (for Linux/*nix), or /usr/lib/libcapstone.dylib (OSX)
/usr/lib/libcapstone.a
2013-11-27 04:11:31 +00:00
(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.
2013-11-27 04:11:31 +00:00
- To cross-compile Windows 32-bit binary, simply run
$ ./compile.sh cross-win32
2013-11-27 04:11:31 +00:00
- To cross-compile Windows 64-bit binary, simply run
$ ./compile.sh cross-win64
2013-11-27 04:11:31 +00:00
Resulted files "capstone.dll" and "tests/test*.exe" can then be used on Windows machine.
2013-11-27 04:11:31 +00:00
(4) Compile on Windows with Cygwin
2013-11-27 04:11:31 +00:00
To compile under Cygwin gcc-mingw-w64-i686 or x86_64-w64-mingw32 run:
- To compile Windows 32-bit binary under Cygwin, simply run
$ ./compile.sh cygwin-mingw32
- To compile Windows 64-bit binary under Cygwin, simply run
$ ./compile.sh cygwin-mingw64
(5) Compile with clang
By default, gcc is used as compiler. To use "clang" compiler instead, run command below:
2013-11-27 04:11:31 +00:00
2013-11-28 02:10:50 +00:00
$ ./compile.sh clang
2013-11-27 04:11:31 +00:00
(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.