[Python] Cygwin: compile C API calls for Python with gcc

Discussão em 'Python' iniciado por Stack, Dezembro 21, 2024.

  1. Stack

    Stack Membro Participativo

    I have a bash script for compiling a Python project with C API calls (SWIG):

    swig -python trace_skeleton.i
    gcc -O3 -c trace_skeleton.c trace_skeleton_wrap.c -I/usr/local/x/python/3.7.6_1/Frameworks/Python.framework/Versions/3.7/include/python3.7m
    gcc $(python3-config --ldflags) -dynamiclib *.o -o _trace_skeleton.so -I/usr/local/x/python/3.7.6_1/Frameworks/Python.framework/Versions/3.7/lib/libpython3.7m.dylib -undefined dynamic_lookup


    The script links to some user's Python libs on Linux. On Cygwin I installed bash, swig, gcc and Python (C:\cygwin64\bin\python3.9.exe). I also have a separate full Python install (C:\Python310). When I run bash, obviously I get an error, since gcc can't locate Python.h on Win:

    trace_skeleton_wrap.c:194:11: fatal error: Python.h: No such file or directory 194 | # include <Python.h>


    In compile.sh, how do I point gcc to my (Win) Python libs? Do I use Cygwin's Python, or my full-install Python?

    Continue reading...

Compartilhe esta Página