Skip to content
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

[Windows MSYS2 MINGW64] Cannot install and build with Pip #2466

Open
Tatsh opened this issue Oct 24, 2024 · 0 comments
Open

[Windows MSYS2 MINGW64] Cannot install and build with Pip #2466

Tatsh opened this issue Oct 24, 2024 · 0 comments

Comments

@Tatsh
Copy link

Tatsh commented Oct 24, 2024

Summary

  • OS: Windows 10
  • Architecture: 64bit
  • Psutil version: n/a
  • Python version: Python 3.11.10
  • Type: installation

Description

Using latest MSYS2 MINGW64 and GCC within, it is not possible to build this project when installing with Pip. I am working on a project and it is expected that poetry install works. As such I either need a wheel or I have to build the project. There is no 3.11 wheel.

  gcc -DNDEBUG -g -fwrapv -O3 -Wall -march=nocona -msahf -mtune=generic -O2 -pipe -Wp,-D_FORTIFY_SOURCE=2 -fstack-protector-strong -Wp,-D__USE_MINGW_ANSI_STDIO=1 -O3 -march=nocona -msahf -mtune=generic -O2 -pipe -Wp,-D_FORTIFY_SOURCE=2 -fstack-protector-strong -Wp,-D__USE_MINGW_ANSI_STDIO=1 -O3 -Wno-error=incompatible-pointer-types -DPSUTIL_SIZEOF_PID_T=4 -DPSUTIL_VERSION=610 -DPy_LIMITED_API=0x03070000 -DPSUTIL_WINDOWS=1 -D_WIN32_WINNT=0x01000 -D_AVAIL_WINVER_=0x01000 -D_CRT_SECURE_NO_WARNINGS -DPSAPI_VERSION=1 -IC:/msys64/tmp/tmps3xtuh07/.venv/include -IC:/msys64/mingw64/include/python3.11 -c psutil/_psutil_com
mon.c -o build/temp.mingw_x86_64-cpython-311/psutil/_psutil_common.o
  In file included from psutil/_psutil_common.h:143,
                   from psutil/_psutil_common.c:10:
  psutil/arch/windows/ntextapi.h:59:14: error: redeclaration of 'enum _KWAIT_REASON'
     59 | typedef enum _KWAIT_REASON {
        |              ^~~~~~~~~~~~~
  In file included from psutil/arch/windows/ntextapi.h:10:
  C:/msys64/mingw64/include/winternl.h:693:16: note: originally defined here
    693 |   typedef enum _KWAIT_REASON {
        |                ^~~~~~~~~~~~~

If I work around this by making changes to winternl.h, multiple definition errors occur. Workaround is to do the following around lines 693 to 716:

 693 /*  typedef enum _KWAIT_REASON {
 694     Executive = 0,
 695     FreePage, PageIn, PoolAllocation, DelayExecution,
 696     Suspended, UserRequest, WrExecutive, WrFreePage, WrPageIn,
 697     WrPoolAllocation, WrDelayExecution, WrSuspended,
 698     WrUserRequest, WrEventPair, WrQueue, WrLpcReceive,
 699     WrLpcReply, WrVirtualMemory, WrPageOut, WrRendezvous,
 700     Spare2, Spare3, Spare4, Spare5, Spare6, WrKernel,
 701     MaximumWaitReason
 702   } KWAIT_REASON;*/
 703
 704   typedef struct _SYSTEM_THREADS
 705   {
 706     LARGE_INTEGER KernelTime;
 707     LARGE_INTEGER UserTime;
 708     LARGE_INTEGER CreateTime;
 709     ULONG WaitTime;
 710     PVOID StartAddress;
 711     CLIENT_ID ClientId;
 712     KPRIORITY Priority;
 713     KPRIORITY BasePriority;
 714     ULONG ContextSwitchCount;
 715     THREAD_STATE State;
 716     int WaitReason;

Log:

  gcc -shared -Wl,--enable-auto-image-base -Wno-error=incompatible-pointer-types -s build/temp.mingw_x86_64-cpython-311/psutil/_psutil_common.o build/temp.mingw_x86_64-cpython-311/psutil/_psutil_windows.o build/temp.mingw_x86_64-cpython-311/psutil/arch/windows/cpu.o build/temp.mingw_x86_64-cpython-311/psutil/arch/windows/disk.o build/temp.mingw_x86_64-cpython-311/psutil/arch/windows/mem.o build/temp.mingw_x86_64-cpython-311/psutil/arch/windows/net.o build/temp.mingw_x86_64-cpython-311/psutil/arch/windows/proc.o build/temp.mingw_x86_64-cpython-311/psutil/arch/windows/proc_handles.o build/temp.mingw_x86_64-cpython-311/psutil/arch/windows/proc_info.o build/temp.mingw_x86_64-cpython-311/psutil/arch/windows/proc_utils.o build/temp.mingw_x86_64-cpython-311/psutil/arch/windows/security.o build/temp.mingw_x86_64-cpython-311/psutil/arch/windows/sensors.o build/temp
.mingw_x86_64-cpython-311/psutil/arch/windows/services.o build/temp.mingw_x86_64-cpython-311/psutil/arch/windows/socks.o build/temp.mingw_x86_64-cpython-311/psutil/arch/windows/sys.o build/temp.mingw_x86_64-cpython-311/psutil/arch/windows/wmi.o build/temp.mingw_x86_64-cpython-311/psutil/_psutil_windows.def -LC:/msys64/mingw64/lib -lpsapi -lkernel32 -ladvapi32 -lshell32
-lnetapi32 -lws2_32 -lPowrProf -lpdh -lpython3.11 -o build/lib.mingw_x86_64-cpython-311/psutil/_psutil_windows.pyd
  C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/14.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: build/temp.mingw_x86
_64-cpython-311/psutil/_psutil_windows.o:C:\msys64\tmp\tmphs0qtsgs\psutil-6.1.0/psutil/arch/windows/ntextapi.h:701: multiple definition of `_RtlNtStatusToDosErrorNoTeb'; build/temp.mingw_x86_64-cpython-311/psutil/_psutil_common.o:C:\msys64\tmp\tmph
s0qtsgs\psutil-6.1.0/psutil/arch/windows/ntextapi.h:701: first defined here
  C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/14.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: build/temp.mingw_x86_64-cpython-311/psutil/_psutil_windows.o:C:\msys64\tmp\tmphs0qtsgs\psutil-6.1.0/psutil/arch/windows/ntextapi.h:690: multiple
 definition of `_NtQueryVirtualMemory'; build/temp.mingw_x86_64-cpython-311/psutil/_psutil_common.o:C:\msys64\tmp\tmphs0qtsgs\psutil-6.1.0/psutil/arch/windows/ntextapi.h:690: first defined here
  C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/14.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: build/temp.mingw_x86_64-cpython-311/psutil/_psutil_windows.o:C:\msys64\tmp\tmphs0qtsgs\psutil-6.1.0/psutil/arch/windows/ntextapi.h:684: multiple definition of `_NtSuspendProcess'; build/temp.mingw_x86_64-cpython-311/psutil/_psutil_common.o:C:\msys64\tmp\tmphs0qtsgs\psutil-6.1.0/psutil/arch/windows/ntextapi.h:684: first defined here

And many more of this kind of error.

@Tatsh Tatsh added the bug label Oct 24, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant