Search code examples
pythonnumpycygwinsetuptools

How setuptools builds extensions, where to add a compiler option?


I was trying to build numpy on Cygwin, but I got a error with xlocale.h which is defined in X11/xlocale.h. My naive patch was to add this:

#ifdef __CYGWIN__ 
   #include "X11/Xlocale.h"
#else
   #include "xlocale.h"
#endif

Alternatively I could have added -I/usr/include/X11 to the Makefile, but there is no Makefiles in setuptools and I am trying to understand how it works.

When I type python setup.py build_ext how Python builds the extensions?


Solution

  • I know my solution is not good, but I ended up doing this:

    cd /usr/include
    ln -s locale.h xlocale.h
    

    Before running:

    pip3 install --user -U numpy 
    

    And it worked.

    I removed the link after pip finiched installing the package.