New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Compilation on MINGW64 fails (CODESET,wcstok,...) #81982
Comments
Compilation on MINGW64 fails (CODESET,wcstok,...) $ gcc -v
Using built-in specs.
COLLECT_GCC=C:\msys64\mingw64\bin\gcc.exe
COLLECT_LTO_WRAPPER=C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/9.1.0/lto-wrapper.exe
Target: x86_64-w64-mingw32
gcc version 9.1.0 (Rev3, Built by MSYS2 project) Result of make: Python/initconfig.c: In function 'config_get_locale_encoding': |
(code from Python-3.8.0b3, but Python-3.7.2 had similar issues) |
Guessing it needs an extra header file that is implicitly included in the Windows headers? |
I wasn't aware that CPython builds for MSYS2 out of the box, since it's a POSIX-on-Windows platform like Cygwin. Apparently there are patches that enable it to build, since MSYS2 has Python available. For Windows, WCSTOK expands to wcstok_s, which takes a context pointer that allows concurrently parsing multiple strings in a single thread. The old function lacks this parameter and instead uses a per-thread static buffer. They're declared as follows:
Otherwise the WCSTOK macro expands to wcstok, which assumes that POSIX systems use the standard definition [1]:
Apparently the version of wcstok declared in your build environment takes only two arguments, like the old insecure function in Windows:
[1] http://pubs.opengroup.org/onlinepubs/9699919799/functions/wcstok.html |
MSYS2 consists of a cygwin like environment and a mingw one. OP is trying to build with mingw. MSYS2 contains a somewhat heavily patched Python in both environments so it's expected that building plain CPython doesn't work. There are plans to upstream smaller non-MSYS2 specific patches but nothing has come of it so far. |
fyi 1 : this issue pops up in multiple places, cfr : the selection of the wcstok function is based on MS_WINDOWS being fyi 2 : I've been able to cross compile 3.8 with mingw64 (gcc 7.3), but with a custom meson script instead of autoconf |
Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
GitHub fields:
bugs.python.org fields:
The text was updated successfully, but these errors were encountered: