From d3374a7bbd536ea9fa1277d989b761a2ce4e5f23 Mon Sep 17 00:00:00 2001 From: Nguyen Anh Quynh Date: Thu, 15 Oct 2015 16:05:30 +0800 Subject: [PATCH] improve COMPILE.TXT --- COMPILE.TXT | 121 ++++++++++++++++++++++++++-------------------------- 1 file changed, 60 insertions(+), 61 deletions(-) diff --git a/COMPILE.TXT b/COMPILE.TXT index 9001cbfd..edd4aaaa 100644 --- a/COMPILE.TXT +++ b/COMPILE.TXT @@ -17,7 +17,7 @@ Unicorn requires few dependent packages as followings $ sudo apt-get install libglib2.0-dev -- For Windows, cross-compile using Mingw. Mingw-glib2 is needed. +- For Windows, cross-compile requires Mingw. Mingw-glib2 is needed. On Ubuntu 14.04 64-bit, do: @@ -61,23 +61,20 @@ Unicorn requires few dependent packages as followings -[2] Compile from source +[2] Compile and install from source on *nix - On *nix (such as MacOSX, Linux, *BSD, Solaris): + To build Unicorn on *nix (such as MacOSX, Linux, *BSD, Solaris): - To compile for current platform, run: $ ./make.sh - - On 64-bit OS, run the command below to cross-compile Unicorn for 32-bit binary: + - To cross-compile Unicorn on 64-bit OS to target 32-bit binary, run: $ ./make.sh nix32 - -[3] Install Unicorn on *nix (such as MacOSX, Linux, *BSD, Solaris) - - To install Unicorn, run: + After compiling, install Unicorn with: $ sudo ./make.sh install @@ -88,7 +85,7 @@ Unicorn requires few dependent packages as followings Users are then required to enter root password to copy Unicorn into machine system directories. - Afterwards, run ./samples/sample_all.sh to see the sample emulations. + Afterwards, run ./samples/sample_all.sh to test the sample emulations. NOTE: The core framework installed by "./make.sh install" consist of @@ -102,12 +99,60 @@ Unicorn requires few dependent packages as followings /usr/include/unicorn/ppc.h /usr/include/unicorn/sparc.h /usr/include/unicorn/m68k.h - /usr/include/unicorn/platform.h + uusr/include/unicorn/platform.h /usr/lib/libunicorn.so (for Linux/*nix), or /usr/lib/libunicorn.dylib (OSX) /usr/lib/libunicorn.a +[3] Compile from source on Windows - with MinGW (MSYS2) + + To compile with MinGW you need to install MSYS2: https://msys2.github.io/ + Follow the install instructions and don't forget to update the system packages with: + + $ pacman --needed -Sy bash pacman pacman-mirrors msys2-runtime + + Then close MSYS2, run it again from Start menu and update the rest with: + + $ pacman -Su + + Finally, compile Unicorn with the next steps: + + - To compile Windows 32-bit binary with MinGW, run: + $ pacman -S make + $ pacman -S pkg-config + $ pacman -S mingw-w64-i686-glib2 + $ pacman -S mingw-w64-i686-toolchain + $ ./make.sh cross-win32 + + - To compile Windows 64-bit binary with MinGW, run: + $ pacman -S make + $ pacman -S pkg-config + $ pacman -S mingw-w64-x86_64-glib2 + $ pacman -S mingw-w64-x86_64-toolchain + $ ./make.sh cross-win64 + + Resulted files unicorn.dll, unicorn.lib & samples/sample*.exe can then + be used on Windows machine. + + To run sample_x86.exe on Windows 32-bit, you need the following files: + - unicorn.dll + - %MSYS2%\mingw32\bin\libiconv-2.dll + - %MSYS2%\mingw32\bin\libintl-8.dll + - %MSYS2%\mingw32\bin\libglib-2.0-0.dll + - %MSYS2%\mingw32\bin\libgcc_s_dw2-1.dll + - %MSYS2%\mingw32\bin\libwinpthread-1.dll + + To run sample_x86.exe on Windows 64-bit, you need the following files: + - unicorn.dll + - %MSYS2%\mingw64\bin\libiconv-2.dll + - %MSYS2%\mingw64\bin\libintl-8.dll + - %MSYS2%\mingw64\bin\libglib-2.0-0.dll + - %MSYS2%\mingw64\bin\libgcc_s_seh-1.dll + - %MSYS2%\mingw64\bin\libwinpthread-1.dll + + + [4] Cross-compile for Windows from *nix To cross-compile for Windows, Linux & gcc-mingw-w64-i686 (and also gcc-mingw-w64-x86-64 @@ -176,54 +221,7 @@ Unicorn requires few dependent packages as followings -[7] Compile on Windows with MinGW (MSYS2) - - To compile with MinGW you need to install MSYS2: https://msys2.github.io/ - Follow the install instructions and don't forget to update the system packages with: - - $ pacman --needed -Sy bash pacman pacman-mirrors msys2-runtime - - Then close MSYS2, run it again from Start menu and update the rest with: - - $ pacman -Su - - Finally, compile Unicorn with the next steps: - - - To compile Windows 32-bit binary with MinGW, run: - $ pacman -S make - $ pacman -S pkg-config - $ pacman -S mingw-w64-i686-glib2 - $ pacman -S mingw-w64-i686-toolchain - $ ./make.sh cross-win32 - - - To compile Windows 64-bit binary with MinGW, run: - $ pacman -S make - $ pacman -S pkg-config - $ pacman -S mingw-w64-x86_64-glib2 - $ pacman -S mingw-w64-x86_64-toolchain - $ ./make.sh cross-win64 - - Resulted files unicorn.dll, unicorn.lib & samples/sample*.exe can then - be used on Windows machine. - - To run sample_x86.exe on Windows 32-bit, you need the following files: - - unicorn.dll - - %MSYS2%\mingw32\bin\libiconv-2.dll - - %MSYS2%\mingw32\bin\libintl-8.dll - - %MSYS2%\mingw32\bin\libglib-2.0-0.dll - - %MSYS2%\mingw32\bin\libgcc_s_dw2-1.dll - - %MSYS2%\mingw32\bin\libwinpthread-1.dll - - To run sample_x86.exe on Windows 64-bit, you need the following files: - - unicorn.dll - - %MSYS2%\mingw64\bin\libiconv-2.dll - - %MSYS2%\mingw64\bin\libintl-8.dll - - %MSYS2%\mingw64\bin\libglib-2.0-0.dll - - %MSYS2%\mingw64\bin\libgcc_s_seh-1.dll - - %MSYS2%\mingw64\bin\libwinpthread-1.dll - - -[8] By default, "cc" (default C compiler on the system) is used as compiler. +[7] By default, "cc" (default C compiler on the system) is used as compiler. - To use "clang" compiler instead, run the command below: @@ -235,20 +233,21 @@ Unicorn requires few dependent packages as followings -[9] To uninstall Unicorn, run the command below: +[8] To uninstall Unicorn, run the command below: $ sudo ./make.sh uninstall -[10] Language bindings +[9] Language bindings So far, only Python is supported by bindings in the main code. Look for the bindings under directory bindings/, and refer to README file of corresponding languages. -[11] Unit tests + +[10] Unit tests Automated unit tests use the cmocka unit testing framework (https://cmocka.org/). It can be installed in most Linux distros using the package manager, e.g.