Quantcast
Channel: Active questions tagged gcc - Stack Overflow
Viewing all articles
Browse latest Browse all 22072

mingw32-gcc compiling Cython output: unknown multiarch location for pyconfig.h (and other warnings)

$
0
0

I am trying to make executables of my python application for Linux and Windows, but the Windows build process is failing.

Here is my Makefile:

all: transpile compile-linux compile-w64

transpile: main.py
    cython --embed -3 -o main.c main.py

compile-linux: main.c
    gcc -I/usr/include/python3.7 -o main main.c -lpython3.7m -lpthread -lm -lutil -ldl

compile-w32: main.c
    i686-w64-mingw32-gcc -o main-x86.exe main.c -lpython3.7m -lpthread -lm -lutil -ldl -I/usr/include/python3.7m

compile-w64: main.c
    x86_64-w64-mingw32-gcc -o main-x64.exe main.c -lpython3.7m -lpthread -lm -lutil -ldl -I/usr/include/python3.7m

(compile-w32 is not mentioned in all because I'm not using it yet, and I was going to try it later.)

When I try to compile the code, this is the makefile/mingw32-gcc output. The linux version is compiled without any problem (I've ran it already once and it worked well), but the windows x86_64 shows a lot of errors and warnings:

cython --embed -3 -o main.c main.py
gcc -I/usr/include/python3.7 -o main main.c -lpython3.7m -lpthread -lm -lutil -ldl
x86_64-w64-mingw32-gcc -o main-x64.exe main.c -lpython3.7m -lpthread -lm -lutil -ldl -I/usr/include/python3.7m
In file included from /usr/include/python3.7m/Python.h:8,
                 from main.c:4:
/usr/include/python3.7m/pyconfig.h:104:3: error: #error unknown multiarch location for pyconfig.h
  104 | # error unknown multiarch location for pyconfig.h
      |   ^~~~~
In file included from /usr/include/python3.7m/pyport.h:4,
                 from /usr/include/python3.7m/Python.h:63,
                 from main.c:4:
/usr/include/python3.7m/pyconfig.h:104:3: error: #error unknown multiarch location for pyconfig.h
  104 | # error unknown multiarch location for pyconfig.h
      |   ^~~~~
In file included from /usr/include/python3.7m/pymath.h:4,
                 from /usr/include/python3.7m/Python.h:86,
                 from main.c:4:
/usr/include/python3.7m/pyconfig.h:104:3: error: #error unknown multiarch location for pyconfig.h
  104 | # error unknown multiarch location for pyconfig.h
      |   ^~~~~
In file included from /usr/include/python3.7m/pytime.h:5,
                 from /usr/include/python3.7m/Python.h:87,
                 from main.c:4:
/usr/include/python3.7m/pyconfig.h:104:3: error: #error unknown multiarch location for pyconfig.h
  104 | # error unknown multiarch location for pyconfig.h
      |   ^~~~~
In file included from /usr/include/python3.7m/Python.h:99,
                 from main.c:4:
/usr/include/python3.7m/unicodeobject.h:68:2: error: #error Must define SIZEOF_WCHAR_T
   68 | #error Must define SIZEOF_WCHAR_T
      |  ^~~~~
In file included from /usr/include/python3.7m/pystate.h:11,
                 from /usr/include/python3.7m/traceback.h:8,
                 from /usr/include/python3.7m/Python.h:119,
                 from main.c:4:
/usr/include/python3.7m/pythread.h:122:5: error: #error "Require native threads. See https://bugs.python.org/issue31370"
  122 | #   error "Require native threads. See https://bugs.python.org/issue31370"
      |     ^~~~~
/usr/include/python3.7m/pythread.h:131:5: error: unknown type name ‘NATIVE_TSS_KEY_T’
  131 |     NATIVE_TSS_KEY_T _key;
      |     ^~~~~~~~~~~~~~~~
In file included from /usr/include/python3.7m/Python.h:156,
                 from main.c:4:
/usr/include/python3.7m/fileutils.h:95:27: warning: ‘struct stat’ declared inside parameter list will not be visible outside of this definition or declaration
   95 | #  define _Py_stat_struct stat
      |                           ^~~~
/usr/include/python3.7m/fileutils.h:100:12: note: in expansion of macro ‘_Py_stat_struct’
  100 |     struct _Py_stat_struct *status);
      |            ^~~~~~~~~~~~~~~
/usr/include/python3.7m/fileutils.h:95:27: warning: ‘struct stat’ declared inside parameter list will not be visible outside of this definition or declaration
   95 | #  define _Py_stat_struct stat
      |                           ^~~~
/usr/include/python3.7m/fileutils.h:104:12: note: in expansion of macro ‘_Py_stat_struct’
  104 |     struct _Py_stat_struct *status);
      |            ^~~~~~~~~~~~~~~
/usr/include/python3.7m/fileutils.h:108:12: warning: ‘struct stat’ declared inside parameter list will not be visible outside of this definition or declaration
  108 |     struct stat *status);
      |            ^~~~
make: *** [Makefile:13: compile-w64] Error 1

I have already tried the solution from this page (which uses CFLAGS) but it didn't work.

If needed, the rest of the code (including the main.py file) is here.


Viewing all articles
Browse latest Browse all 22072

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>