Snowman is written in C++. So, you will need a C++ compiler to build it. The following compilers are known to work:
-
GCC >= 4.6
-
Clang >= 3.1
-
MinGW GCC >= 4.6
-
MinGW-w64 GCC >= 4.6
-
Microsoft Visual Studio >= 2010
The following software packages must be installed before Snowman can be built:
For installation instructions for the above packages, please refer to the respective web pages and/or your operating system’s manual.
Note
|
If you want to use Visual Studio 2012 to build applications that would
run on Windows XP, you have to install Visual Studio 2012 Update 1 or
later and at configuration step choose v110_xp
toolset in CMake using -T switch (support since CMake 2.8.11, known to
work with Visual Studio generators).
|
-
The following additional package is required to build IDA plug-in:
-
IDA SDK >= 6.1
-
-
You must use the same compiler as the one used by IDA and the same version of Qt (different patch levels of the same major.minor version are binary compatible and work too):
-
IDA 6.1 — MSVC 2010 — Qt 4.7.2.
-
IDA 6.3 — MSVC 2010 — Qt 4.8.1.
-
IDA 6.4 — MSVC 2010 — Qt 4.8.1.
-
IDA 6.5 — MSVC 2010 — Qt 4.8.4.
-
-
Qt must be built in namespace
QT
, e.g.:configure.exe -qtnamespace QT -platform win32-msvc2010 -debug-and-release -opensource -no-qt3support -no-multimedia -no-audio-backend -no-phonon -no-webkit -no-script -no-scripttools -nomake demos -nomake examples && nmake
or, on Linux:
CXX=g++ CC=gcc ./configure -qtnamespace QT -platform linux-g++-32 -debug-and-release -confirm-license -opensource -no-qt3support -no-multimedia -no-audio-backend -no-phonon -no-webkit -no-script -no-scripttools -nomake demos -nomake examples -prefix /home/yegor/opt/qt-4.8.4-32 && make && make install
-
You must must build decompiler in
Release
mode, because this is the one used by IDA. Otherwise, you will end up linked against debug Qt library, while IDA uses the release version. Nothing good comes out of this.
Snowman is built using a tool called CMake. The build process consists of two steps: configuration and build.
You can help your system to find CMake and CMake to find the compiler and required libraries at non-standard locations by setting the following environment variables. Alternatively, you may specify these locations at configuration step.
-
Add CMake and the compiler to your
PATH
. -
Set
BOOST_ROOT
to the path to Boost installation directory (it should containboost
subdirectory with header files). -
Set
QTDIR
to the path to the Qt installation directory (it should containinclude
andlib
subdirectories). -
Set
IDA_SDK_DIR
to the IDA SDK installation directory (it should containinclude
andlib
) subdirectories.
CMake authors are advocates of out-of-tree builds, so a separate directory for compilation results must be created:
cd /path/to/decompiler && mkdir build && cd build && cmake ../src
You can specify a toolchain using CMake’s -G
switch, e.g.:
-
-G "Visual Studio 10"
— generate a Visual Studio 2010 solution for building 32-bit application. -
-G "Visual Studio 11 Win64"
— generate a Visual Studio 2012 solution for building 64-bit application. -
-G "MinGW Makefiles"
— generate Makefiles for building by MinGW GCC andmingw32-make
.
You can choose a build mode (Debug
, Release
, RelWithDebInfo
, or
MinSizeRel
):
-
-D CMAKE_BUILD_TYPE=Release
If you have built Qt in a namespace, do not forget to specify this, e.g.:
-
-D QT_NAMESPACE=QT
You can choose whether to build the IDA plug-in and which one to build:
-
-D IDA_PLUGIN_ENABLED=YES
(orNO
, defaults toYES
when IDA Pro SDK is found). -
-D IDA_64_BIT_EA_T=YES
(YES
to build.p64
version for handling 64-bit code,NO
for building.plw
version for handling 32-bit code).
You can choose to build 32-bit code on 64-bit Linux machine:
-
-D NC_M32=YES
.
You can choose between Qt5 and Qt4:
-
-D NC_QT5=YES
(YES
for Qt5,NO
for Qt4).
You can set the installation prefix:
-
-D CMAKE_INSTALL_PREFIX=/install/prefix
Note
|
The build mode specified at the configuration step will not have any
effect for builds by Visual Studio. There you can choose the build mode
using --config option of CMake directly at build and
installation steps.
|
Note
|
On Windows, when choosing release or debug mode, make sure that Qt and Boost libraries have been built in this mode too. If they were not, the build may fail, or even succeed but produce non-working executables. |
cmake --build . --target install
Note
|
On Windows, when the decompiler is built with Qt4, this command will
install to the same directory all non-system .dll files on which the
decompiler executables depend, so that the installation can be
painlessly moved to any other machine and remain workable.
|
Note
|
When IDA plug-in is enabled, it is the only target which is installed. The rationale is that IDA is thread-unsafe, and multithreading is disabled in the builds with plug-in enabled. This gives you less chances to install single-threaded standalone version of the decompiler (which you should not normally want). |