Compiling PySide for IDA Pro on Windows
21 Dec 2013If you’ve ever wanted to use IDA’s native GUIs, you’ll need PySide. Unfortunately PySide is annoying to compile, and the only available binaries are for Python 2.6. This should work for any version.
Note: The python module installer executable at the end of this guide did not work for me. The compiled pyd and dll files, however were completely usable from within IDA.
Prequisites
- Visual Studio 2010
- Visual Studio 2010 Service Pack 1
- Qt 4.7.3 Source Code
- http://download.qt-project.org/archive/qt/4.7/qt-everywhere-opensource-src-4.7.3.zip
- Extract this to an easily accessible directory, I’ll be using
C:\Users\IEUser\Desktop\qt4.7.3\
- Extract this to an easily accessible directory, I’ll be using
- http://download.qt-project.org/archive/qt/4.7/qt-everywhere-opensource-src-4.7.3.zip
- setuptools python module
- https://pypi.python.org/pypi/setuptools
- cmake
- http://www.cmake.org/cmake/resources/software.html
- git for windows
- http://git-scm.com/download/win
Compiling QT
Before we can compile PySide, we need to compile Qt. IDA’s version of Qt uses a custom namespace, so our version of Qt will need to as well.
- Open up the Visual Studio 2010 Command Prompt. This sets a lot of stuff in the PATH environment variable for you.
- Change directory to the Qt source code directory
cd C:\Users\IEUser\Desktop\qt4.7.3\
- Configure the build environment
configure -debug-and-release -platform win32-msvc2010 -no-qt3support -qtnamespace QT
- Build!
nmake
This stage took around 5 hours on my VM. If you customize the configure line, make sure you leave in the -qtnamespace QT
! Otherwise your binaries will be unusable from within IDA.
Compiling PySide
I did some of this on Linux and some of this on Windows.
- Get the packaging code
git clone git://gitorious.org/pyside/packaging.git
- Change directory to
packaging/setuptools/
- Edit build.py to comment out the Tools repository
- The resulting diff:
- Open the Visual Studio 2010 Comand Prompt
- Add the directory of qmake to your path
set path=%path%;C:\Users\IEUser\Desktop\qt4.7.3\qmake
- Download all the repositories
build.py -d
- Change directory into each of the repositories and run the following commands:
- Apiextractor:
git checkout 0.10.8
- Generatorrunner:
git checkout 0.6.14
- Shiboken:
git checkout 1.0.9
- PySide:
git checkout 1.0.8
- Apiextractor:
- Download this patch and apply it using git
cd packaging/setuptools/
git apply pyside_diff.diff
- I did this on Linux, I couldn’t get it working on Windows :{
- Patch the calls to
deallocdata
so they pass in two arguments (second argument should be True) - Open up another Visual Studio 2010 Command Prompt
- Add cmake/qmake/git/qt to your PATH and set the Qt namespace
set path=%path%;C:\Program Files\CMake 2.8\bin
set path=%path%;C:\Users\IEUser\Desktop\qt4.7.3\qmake
set path=%path%;C:\Program Files\Git\bin
set path=%path%;C:\Users\IEUser\Desktop\qt4.7.3\bin
set QT_NAMESPACE=QT
- Start the build process
build.py
- This takes around an hour on my VM
- Your new PySide installer should be available in
packaging\setuptools\dist
- This installer did not work for me, so I unpacked the installer
- All the files needed for the module to work should be available in the
PURELIB
directory.
Credits
- Aaron Portnoy for outlining this process for python 2.6
- Daniel Pistelli for his guide on compiling Qt correctly with Visual Studio 2008