Debugging native cython module with visual studio toolchain

Jeff jmoguill2 at gmail.com
Sat Nov 14 16:41:27 EST 2020


>
> Hi,
>
> We developed a Python module that interfaces with native code via Cython.
>
> We currently build on Windows with Visual Studio Toolchain.
>
> We encounter the following issues when trying to build a debug version:
>
> 1) 3rd party modules installed via PIP are Release mode, but Visual Studio
>> toolchain doesn't allow to mix Debug and Release libs.  To workaround this
>> issue, we build our module in "Release" mode, with debug symbols enabled,
>> and with compiled optimization disabled (essentially a hack).
>
> 2) To build our module we currently use the following hack:
>
> step 1: run python.exe setup.py build --compiler=msvc
>
> step 2: extract the output
>
> step 3: change /Ox to /Od (disable compiler optimization)
>
>         add /Zi flag to compiler flags (enable debug symbols)
>
>         add /DEBUG flag to linker flags
>
>
>> Please advise what is the best solution?
>
>


More information about the Python-list mailing list