Skip to content

Instantly share code, notes, and snippets.

@ancat
Last active March 10, 2017 09:41
Show Gist options
  • Star 4 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save ancat/8078106 to your computer and use it in GitHub Desktop.
Save ancat/8078106 to your computer and use it in GitHub Desktop.
Compiling PySide for IDA Pro on Windows

Compiling PySide for IDA Pro on Windows

If 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

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:
diff --git a/setuptools/build.py b/setuptools/build.py
index 36d83ea..1b63bab 100644
--- a/setuptools/build.py
+++ b/setuptools/build.py
@@ -22,14 +22,14 @@ modules = {
         ["Generatorrunner", "master", "https://github.com/PySide/Generatorrunner.git"],
         ["Shiboken", "master", "https://github.com/PySide/Shiboken.git"],
         ["PySide", "master", "https://github.com/PySide/PySide.git"],
-        ["Tools", "master", "https://github.com/PySide/Tools.git"],
+        # ["Tools", "master", "https://github.com/PySide/Tools.git"],
     ],
     'stable': [
         ["Apiextractor", "0.10.8", "https://github.com/PySide/Apiextractor.git"],
         ["Generatorrunner", "0.6.14", "https://github.com/PySide/Generatorrunner.git"],
         ["Shiboken", "1.0.9", "https://github.com/PySide/Shiboken.git"],
         ["PySide", "1.0.8", "https://github.com/PySide/PySide.git"],
-        ["Tools", "0.2.13", "https://github.com/PySide/Tools.git"],
+        # ["Tools", "0.2.13", "https://github.com/PySide/Tools.git"],
     ],
 }
  • 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
  • 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

@SwooshyCueb
Copy link

link to pyside_diff.diff is broken

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment