Search code examples
pythoncsetuptoolsdistutils

Printing compiler and linker commands when building C Extension with distutils


I'm trying to debug a setup.py file for a package that builds a C extension with

from distutils.core import Extension
ext = Extension(...

I'd like to see what compiler / linker commands are actually getting executed. How do I print them when running

pip install -e ./

or

python setup.py install

Solution

  • The problem seems to be that it wasn't rebuilding the extension, but rather using a cached version. If I run

    python setup.py clean --all
    python setup.py develop
    

    it rebuilds and shows all the compile/link commands.