This is a guest entry written by Elias Bachaalany. His views and opinions are his own and not those of Hex-Rays. Any questions with regards to the content of this blog post should be directed to the author.
On Linux/macOS, the process is straightforward as per the BUILDING.txt.
In this article:
- Setting up VS 2019
- Setting up Cygwin
- Setting up Python 3.x
- Setting up SWIG
- Setting up IDA SDK
- Building IDAPython
Make sure you already installed the latest IDA for Windows and grabbed yourself a copy of the SDK.
Let's get started.
Setting up VS 2019 Community Edition
IDA SDK's default configuration is targeted towards VS 2019. Just to keep this article simple, let's stick with that.
Grab VS2019 from here https://visualstudio.microsoft.com/vs/older-downloads/
When you install it, make sure you leave all the default installation location (in the
C:\Program Files (x86), etc.)
Setting up Cygwin 64
Download Cygwin 64 and install the following components:
Setting up Python 3.x
Download Python 3.x AMD64 (say 3.4 to 3.11) and select custom install:
- Install to C:\PythonXY (X = major, Y = minor)
- Make sure you select the following options:
- for all users
- Precompile standard library
- Optional: "Download debugging symbols"
After Python is installed, install the
C:\PythonXY\Scripts\pip install six
Setting up SWIG
In this section, we will build SWIG for Windows from scratch. We need a special patched version of SWIG (version 4.0.1, with support for
-py3-limited-api) and we cannot use the pre-built binaries.
Whether you are using a Linux distro (for example Ubuntu 20) or WSL on Windows 10/11, all the steps below still apply.
Depending on your Linux setup, you may have already installed the needed packages. Just to be on the safe side, you need the following:
sudo apt update sudo apt install wget build-essential mingw-w64 byacc bison automake autotools-dev patchelf -y
If mingw-64 failed to install:
sudo apt-add-repository ppa:mingw-w64/ppa && sudo apt-get update && sudo apt-get install mingw-w64
Clone IDAPython's patched SWIG
git clone --branch py3-stable-abi https://github.com/idapython/swig.git swig-py3-stable-abi
Download PCRE library and build it
Download PCRE directly into SWIG's source directory:
Then edit the PCRE build script in SWIG to specify the host compiler:
./Tools/pcre-build.sh and change this line:
cd pcre && ./configure --prefix=$pcre_install_dir --disable-shared $* || bail "PCRE configure failed"
cd pcre && ./configure --host=x86_64-w64-mingw32 --prefix=$pcre_install_dir --disable-shared $* || bail "PCRE configure failed"
(we only added the
Now just run the PCRE build script again:
You are now ready to build SWIG.
./autogen.sh, then run the configure script with the
--host switch, while also specifying static linking:
LDFLAGS="-static -static-libgcc -static-libstdc++" \ ./configure --host=x86_64-w64-mingw32 --prefix=/tmp/swig4-win
Now you can run
make install as usual.
Alternatively, you can download the pre-build version from here.
Copy the SWIG Windows binaries from
/tmp/swig4-win to your Windows machine.
Let's put them in
Setting up the IDA SDK
Download the IDA SDK and unzip to a folder, for example
If you have the Decompiler installed, then copy the Decompiler headers from
Initialize the SDK's config files
We need to configure various configurations. Open the "Developer Command Prompt for VS 2019".
If Cygwin was not in the path, then typing 'make' will cause an error. If that's the case, just add it to the PATH:
(Keep that command prompt open for the remainder of this article.)
c:\idasdk, type the following commands:
cd c:\idasdk set __NT__=1 set __X64__=1
Now let's generate the various config files:
- ida64 debug build:
cmd /c "set __EA64__=1 && make env"
- ida64 optimized build:
cmd /c "set __EA64__=1 && set NDEBUG=1 && make env"
- ida debug build:
- ida optimized build:
cmd /c "set NDEBUG=1 && make env
If you have done everything right, you should have these files in
To test if everything is okay, let's try building the
cd c:\idasdk\plugins\hello make
Last but not least, let's put the IDA binaries in the correct place in accordance with the SDK make system. Assuming that IDA was installed in
xcopy /s c:\Tools\IDA82 c:\idasdk\bin
Now, anything we build will go to
plugins: for plugin binaries
loaders: for loader modules
procs: for processor modules
Okay, now we are ready to build IDAPython!
c:\idasdk\plugins and clone IDAPython there:
git clone https://github.com/idapython/src.git idapython
Now we have all the prerequisit steps completed, let's build IDAPython:
set PYTHON_VERSION_MAJOR=X set PYTHON_VERSION_MINOR=Y C:\PythonXY\python.exe build.py --with-hexrays --swig-home c:\ida\swig4 --ida-install c:\idasdk\bin --debug
Ywith the proper values
- If you don't have the Decompiler then omit the
- Similarily, drop the
--debugfor optimized builds.
build.py --helpfor more information
Be patient, this can take between 5 and 30 minutes to complete the first time.
I know, this has been tedious but I hope it is helpful.
Contributions and suggestions to IDAPython. We are happy to discuss and merge your changes as applicable.