miurahr / pyppmd

pyppmd provides classes and functions for compressing and decompressing text data, using PPM (Prediction by partial matching) compression algorithm variation H and I.2. It provide an API similar to Python's zlib/bz2/lzma modules.
https://pyppmd.readthedocs.io/en/latest/
GNU Lesser General Public License v2.1
8 stars 3 forks source link

Build fails with MinGW/MSYS2 #68

Closed SirLynix closed 2 years ago

SirLynix commented 2 years ago

Describe the bug I'm trying to install aqtinstall package on MSYS2, which depends on pyppmd, and it fails at compilation.

To Reproduce Try to install pyppmd on MSYS2 with the MINGW64 shell.

Expected behavior That it builds.

Environment (please complete the following information):

Additional context Error log:

$ python -m pip install aqtinstall
Collecting aqtinstall
  Using cached aqtinstall-2.0.0-py2.py3-none-any.whl (48 kB)
Requirement already satisfied: semantic-version in c:/projets/softs/msys2/mingw64/lib/python3.9/site-packages (from aqtinstall) (2.8.5)
Requirement already satisfied: py7zr>=0.15.1 in c:/projets/softs/msys2/mingw64/lib/python3.9/site-packages (from aqtinstall) (0.16.1)
Requirement already satisfied: requests in c:/projets/softs/msys2/mingw64/lib/python3.9/site-packages (from aqtinstall) (2.26.0)
Requirement already satisfied: texttable in c:/projets/softs/msys2/mingw64/lib/python3.9/site-packages (from aqtinstall) (1.6.4)
Requirement already satisfied: patch>=1.16 in c:/projets/softs/msys2/mingw64/lib/python3.9/site-packages (from aqtinstall) (1.16)
Collecting bs4
  Using cached bs4-0.0.1-py3-none-any.whl
Requirement already satisfied: brotli>=1.0.9 in c:/projets/softs/msys2/mingw64/lib/python3.9/site-packages (from py7zr>=0.15.1->aqtinstall) (1.0.9)
Collecting pyppmd>=0.14.0
  Downloading pyppmd-0.17.1.tar.gz (462 kB)
     |################################| 462 kB 192 kB/s
  Installing build dependencies ... done
  Getting requirements to build wheel ... done
  Preparing metadata (pyproject.toml) ... done
Requirement already satisfied: pycryptodomex>=3.6.6 in c:/projets/softs/msys2/mingw64/lib/python3.9/site-packages (from py7zr>=0.15.1->aqtinstall) (3.10.1)
Requirement already satisfied: pyzstd<0.15.0,>=0.14.4 in c:/projets/softs/msys2/mingw64/lib/python3.9/site-packages (from py7zr>=0.15.1->aqtinstall) (0.14.4)
Requirement already satisfied: multivolumefile>=0.2.3 in c:/projets/softs/msys2/mingw64/lib/python3.9/site-packages (from py7zr>=0.15.1->aqtinstall) (0.2.3)
Requirement already satisfied: bcj-cffi<0.6.0,>=0.5.1 in c:/projets/softs/msys2/mingw64/lib/python3.9/site-packages (from py7zr>=0.15.1->aqtinstall) (0.5.1)
Collecting beautifulsoup4
  Using cached beautifulsoup4-4.10.0-py3-none-any.whl (97 kB)
Requirement already satisfied: idna<4,>=2.5 in c:/projets/softs/msys2/mingw64/lib/python3.9/site-packages (from requests->aqtinstall) (3.2)
Requirement already satisfied: charset-normalizer~=2.0.0 in c:/projets/softs/msys2/mingw64/lib/python3.9/site-packages (from requests->aqtinstall) (2.0.4)
Requirement already satisfied: urllib3<1.27,>=1.21.1 in c:/projets/softs/msys2/mingw64/lib/python3.9/site-packages (from requests->aqtinstall) (1.26.6)
Requirement already satisfied: certifi>=2017.4.17 in c:/projets/softs/msys2/mingw64/lib/python3.9/site-packages (from requests->aqtinstall) (2021.5.30)
Requirement already satisfied: cffi>=1.14.0 in c:/projets/softs/msys2/mingw64/lib/python3.9/site-packages (from bcj-cffi<0.6.0,>=0.5.1->py7zr>=0.15.1->aqtinstall) (1.14.6)
Collecting soupsieve>1.2
  Using cached soupsieve-2.2.1-py3-none-any.whl (33 kB)
Requirement already satisfied: pycparser in c:/projets/softs/msys2/mingw64/lib/python3.9/site-packages (from cffi>=1.14.0->bcj-cffi<0.6.0,>=0.5.1->py7zr>=0.15.1->aqtinstall) (2.20)
Building wheels for collected packages: pyppmd
  Building wheel for pyppmd (pyproject.toml) ... error
  ERROR: Command errored out with exit status 1:
   command: C:/Projets/Softs/msys2/mingw64/bin/python.exe C:/Projets/Softs/msys2/mingw64/lib/python3.9/site-packages/pip/_vendor/pep517/in_process/_in_process.py build_wheel C:/Users/Lynix/AppData/Local/Temp/tmph60mq72p
       cwd: C:/Users/Lynix/AppData/Local/Temp/pip-install-49z0wcvx/pyppmd_412da10fe35543508a445f0a0087f5e6
  Complete output (45 lines):
  running bdist_wheel
  running build
  running build_py
  creating build
  creating build/lib.mingw_x86_64-3.9
  creating build/lib.mingw_x86_64-3.9/pyppmd
  copying src/pyppmd/__init__.py -> build/lib.mingw_x86_64-3.9/pyppmd
  package init file 'src/pyppmd/c/__init__.py' not found (or not a regular file)
  creating build/lib.mingw_x86_64-3.9/pyppmd/c
  copying src/pyppmd/c/c_ppmd.py -> build/lib.mingw_x86_64-3.9/pyppmd/c
  copying src/pyppmd/__init__.pyi -> build/lib.mingw_x86_64-3.9/pyppmd
  copying src/pyppmd/py.typed -> build/lib.mingw_x86_64-3.9/pyppmd
  running build_ext
  dllwrap: ATTENTION: dllwrap est d▒pr▒ci▒, utilisez plut▒t gcc -shared ou ld -shared

  building 'pyppmd.c._ppmd' extension
  creating build/temp.mingw_x86_64-3.9
  creating build/temp.mingw_x86_64-3.9/lib
  creating build/temp.mingw_x86_64-3.9/lib2
  creating build/temp.mingw_x86_64-3.9/src
  creating build/temp.mingw_x86_64-3.9/src/ext
  gcc -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -march=x86-64 -mtune=generic -O2 -pipe -march=x86-64 -mtune=generic -O2 -pipe -Ilib -Ilib2 -IC:/Projets/Softs/msys2/mingw64/include/python3.9 -c lib/Ppmd7.c -o build/temp.mingw_x86_64-3.9/lib/Ppmd7.o
  gcc -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -march=x86-64 -mtune=generic -O2 -pipe -march=x86-64 -mtune=generic -O2 -pipe -Ilib -Ilib2 -IC:/Projets/Softs/msys2/mingw64/include/python3.9 -c lib/Ppmd7Dec.c -o build/temp.mingw_x86_64-3.9/lib/Ppmd7Dec.o
  gcc -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -march=x86-64 -mtune=generic -O2 -pipe -march=x86-64 -mtune=generic -O2 -pipe -Ilib -Ilib2 -IC:/Projets/Softs/msys2/mingw64/include/python3.9 -c lib/Ppmd7Enc.c -o build/temp.mingw_x86_64-3.9/lib/Ppmd7Enc.o
  gcc -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -march=x86-64 -mtune=generic -O2 -pipe -march=x86-64 -mtune=generic -O2 -pipe -Ilib -Ilib2 -IC:/Projets/Softs/msys2/mingw64/include/python3.9 -c lib/Ppmd8.c -o build/temp.mingw_x86_64-3.9/lib/Ppmd8.o
  gcc -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -march=x86-64 -mtune=generic -O2 -pipe -march=x86-64 -mtune=generic -O2 -pipe -Ilib -Ilib2 -IC:/Projets/Softs/msys2/mingw64/include/python3.9 -c lib/Ppmd8Dec.c -o build/temp.mingw_x86_64-3.9/lib/Ppmd8Dec.o
  gcc -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -march=x86-64 -mtune=generic -O2 -pipe -march=x86-64 -mtune=generic -O2 -pipe -Ilib -Ilib2 -IC:/Projets/Softs/msys2/mingw64/include/python3.9 -c lib/Ppmd8Enc.c -o build/temp.mingw_x86_64-3.9/lib/Ppmd8Enc.o
  gcc -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -march=x86-64 -mtune=generic -O2 -pipe -march=x86-64 -mtune=generic -O2 -pipe -Ilib -Ilib2 -IC:/Projets/Softs/msys2/mingw64/include/python3.9 -c lib2/Buffer.c -o build/temp.mingw_x86_64-3.9/lib2/Buffer.o
  gcc -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -march=x86-64 -mtune=generic -O2 -pipe -march=x86-64 -mtune=generic -O2 -pipe -Ilib -Ilib2 -IC:/Projets/Softs/msys2/mingw64/include/python3.9 -c lib2/ThreadDecoder.c -o build/temp.mingw_x86_64-3.9/lib2/ThreadDecoder.o
  lib2/ThreadDecoder.c:36:8: error: unknown type name 'DWORD'
     36 | static DWORD nsec_to_ms(unsigned long nsec) {
        |        ^~~~~
  lib2/ThreadDecoder.c: In function 'nsec_to_ms':
  lib2/ThreadDecoder.c:37:5: error: unknown type name 'DWORD'
     37 |     DWORD t;
        |     ^~~~~
  lib2/ThreadDecoder.c:40:16: error: 'INFINITE' undeclared (first use in this function)
     40 |         return INFINITE;
        |                ^~~~~~~~
  lib2/ThreadDecoder.c:40:16: note: each undeclared identifier is reported only once for each function it appears in
  lib2/ThreadDecoder.c: In function 'ppmd_timedwait':
  lib2/ThreadDecoder.c:54:7: warning: implicit declaration of function 'SleepConditionVariableCS' [-Wimplicit-function-declaration]
     54 |  if (!SleepConditionVariableCS(cond, mutex, nsec_to_ms(nsec))) return ETIMEDOUT;
        |       ^~~~~~~~~~~~~~~~~~~~~~~~
  error: command 'C:\\Projets\\Softs\\msys2\\mingw64\\bin/gcc.exe' failed with exit code 1
  ----------------------------------------
  ERROR: Failed building wheel for pyppmd
Failed to build pyppmd
ERROR: Could not build wheels for pyppmd, which is required to install pyproject.toml-based projects

It worked before and started to fail on my MSYS2 CI a few weeks ago.

miurahr commented 2 years ago

v0.17.3 release with the fix.

SirLynix commented 2 years ago

Thank you!