msys2 / MINGW-packages

Package scripts for MinGW-w64 targets to build under MSYS2.
https://packages.msys2.org
BSD 3-Clause "New" or "Revised" License
2.25k stars 1.21k forks source link

Compile errors for mingw-w64-python2 v2.7.16 #5292

Closed tomay3000 closed 5 years ago

tomay3000 commented 5 years ago

../Python-2.7.16/Python/random.c: In function 'dev_urandom_python': ../Python-2.7.16/Python/random.c:247:16: warning: implicit declaration of function 'fcntl'; did you mean 'rintl'? [-Wimplicit-function-declaration] attr = fcntl(fd, F_GETFD); ^~~~~ rintl ../Python-2.7.16/Python/random.c:247:26: error: 'F_GETFD' undeclared (first use in this function) attr = fcntl(fd, F_GETFD); ^~~ ../Python-2.7.16/Python/random.c:247:26: note: each undeclared identifier is reported only once for each function it appears in ../Python-2.7.16/Python/random.c:249:21: error: 'FD_CLOEXEC' undeclared (first use in this function); did you mean 'S_IEXEC'? attr |= FD_CLOEXEC; ^~~~~~ S_IEXEC ../Python-2.7.16/Python/random.c:250:29: error: 'F_SETFD' undeclared (first use in this function) (void)fcntl(fd, F_SETFD, attr); ^~~ make: *** [Makefile:1376: Python/random.o] Error 1 ==> ERROR: A failure occurred in build(). Aborting...

lazka commented 5 years ago

It builds fine here. How do you build it?

tomay3000 commented 5 years ago

@lazka I am using a different variant of mingw-w64, the one with sjlj exception model and gcc v8.1.0

I am rebuilding another version of mingw-w64 to use sjlj exception model and gcc v8.3.0 this time and try see what I get.

I needed sjlj not dw2 for my needs, to link against MSVC built DLLs.

Dwarf Crashed a lot for this kinda DLLs.

lazka commented 5 years ago

OK, the error indicates that MS_WINDOWS isn't defined, which means that your toolchain doesn't define __MINGW32__ or _WIN32 for some reason: https://github.com/msys2/MINGW-packages/blob/master/mingw-w64-python2/0110-MINGW-translate-gcc-internal-defines-to-python-platf.patch

tomay3000 commented 5 years ago

I turns out that it compiles without issues in the default configuration: "the prebuilt dwarf2 gcc and crt". May be I was missing something in my custom "sjlj" configuration. I guess I am falling back to the EASY and ALREADY prebuilt default configuration.