fancycode / pylzma

Python bindings for the LZMA library
http://www.joachim-bauch.de/projects/pylzma/
GNU Lesser General Public License v2.1
234 stars 72 forks source link

mingw32 build environment interprets PYLZMA_VERSION as float #23

Closed strahl closed 9 years ago

strahl commented 9 years ago

Using WinPython 2.7.6.4 32 bit and mingw32 I get the following error:

c:\temp\pylzma-0.4.6>python setup.py build
running build
running build_py
creating build
creating build\lib.win32-2.7
copying py7zlib.py -> build\lib.win32-2.7
running build_ext
adding support for multithreaded compression
building 'pylzma' extension
creating build\temp.win32-2.7
creating build\temp.win32-2.7\Release
creating build\temp.win32-2.7\Release\src
creating build\temp.win32-2.7\Release\src\pylzma
creating build\temp.win32-2.7\Release\src\sdk
creating build\temp.win32-2.7\Release\src\7zip
creating build\temp.win32-2.7\Release\src\7zip\c
creating build\temp.win32-2.7\Release\src\compat
C:\sstrahl\Programme\WinPython-32bit-2.7.6.4\python-2.7.6\..\tools\mingw32\bin\gcc.exe -mdll -O -Wall -DWITH_COMPAT=1 -DPYLZMA_VERSION="0.4.6" -DCOMPRESS_MF_MT=1 -Isrc/sdk -IC:\sstrahl\Programme\WinPython-32bit-2.7.6.4\python-2.7.6\include -IC:\sstrahl\Programme\WinPython-32bit-2.7.6.4\python-2.7.6\PC -c src/pylzma/pylzma.c -o build\temp.win32-2.7\Release\src\pylzma\pylzma.o
src/pylzma/pylzma.c: In function 'initpylzma':
src/pylzma/pylzma.c:284:50: error: too many decimal points in number
error: command 'gcc' failed with exit status 1

When I change line 284 in pylzma.c from

PyModule_AddStringConstant(m, "__version__", PYLZMA_VERSION);

to

PyModule_AddStringConstant(m, "__version__", "PYLZMA_VERSION");

he does compile successfully. I am not an expert on the different build environment and therefore not sure if adding the " might be the needed fix as this could result in other problems like some pre-processors doing then two string castings like ""0.4.6""?

SquallATF commented 9 years ago

should change line 147 in setup.py from

    macros.append(('PYLZMA_VERSION', '"'+version+'"'))

to

    macros.append(('PYLZMA_VERSION', '\\"'+version+'\\"'))
GaryHendrick commented 9 years ago

I've just confirmed that sqallATF's suggested fix works in my own environment: Python 2.7.8 (default, Jun 30 2014, 16:03:49) [MSC v.1500 32 bit (Intel)] on win32

fancycode commented 9 years ago

Unfortunately I don't have a Windows machine available for testing, could you please check if the latest push fixed this issue for you?

strahl commented 9 years ago

Hi @fancycode, I just checked out the lastest git commit

/c/temp/pylzma$ git log | head -n 3
commit c1c603073ada3ab9a92d99027e170c1393f8dae9
Author: Joachim Bauch <mail@joachim-bauch.de>
Date:   Sat Apr 25 15:28:12 2015 +0200

And it works - thanks for fixing it! :+1:

c:\temp\pylzma>python setup.py build
running build
running build_py
creating build
creating build\lib.win32-2.7
copying py7zlib.py -> build\lib.win32-2.7
running build_ext
adding support for multithreaded compression
building 'pylzma' extension
creating build\temp.win32-2.7
creating build\temp.win32-2.7\Release
creating build\temp.win32-2.7\Release\src
creating build\temp.win32-2.7\Release\src\pylzma
creating build\temp.win32-2.7\Release\src\sdk
creating build\temp.win32-2.7\Release\src\7zip
creating build\temp.win32-2.7\Release\src\7zip\c
creating build\temp.win32-2.7\Release\src\compat
C:\sstrahl\Programme\WinPython-32bit-2.7.6.4\python-2.7.6\..\tools\mingw32\bin\gcc.exe -mdll -O -Wall -DWITH_COMPAT=1 -DPYLZMA_VERSION=
None -DCOMPRESS_MF_MT=1 -Isrc/sdk -IC:\sstrahl\Programme\WinPython-32bit-2.7.6.4\python-2.7.6\include -IC:\sstrahl\Programme\WinPython-
32bit-2.7.6.4\python-2.7.6\PC -c src/pylzma/pylzma.c -o build\temp.win32-2.7\Release\src\pylzma\pylzma.o
C:\sstrahl\Programme\WinPython-32bit-2.7.6.4\python-2.7.6\..\tools\mingw32\bin\gcc.exe -mdll -O -Wall -DWITH_COMPAT=1 -DPYLZMA_VERSION=
None -DCOMPRESS_MF_MT=1 -Isrc/sdk -IC:\sstrahl\Programme\WinPython-32bit-2.7.6.4\python-2.7.6\include -IC:\sstrahl\Programme\WinPython-
32bit-2.7.6.4\python-2.7.6\PC -c src/pylzma/pylzma_decompressobj.c -o build\temp.win32-2.7\Release\src\pylzma\pylzma_decompressobj.o
C:\sstrahl\Programme\WinPython-32bit-2.7.6.4\python-2.7.6\..\tools\mingw32\bin\gcc.exe -mdll -O -Wall -DWITH_COMPAT=1 -DPYLZMA_VERSION=
None -DCOMPRESS_MF_MT=1 -Isrc/sdk -IC:\sstrahl\Programme\WinPython-32bit-2.7.6.4\python-2.7.6\include -IC:\sstrahl\Programme\WinPython-
32bit-2.7.6.4\python-2.7.6\PC -c src/pylzma/pylzma_compressfile.c -o build\temp.win32-2.7\Release\src\pylzma\pylzma_compressfile.o
C:\sstrahl\Programme\WinPython-32bit-2.7.6.4\python-2.7.6\..\tools\mingw32\bin\gcc.exe -mdll -O -Wall -DWITH_COMPAT=1 -DPYLZMA_VERSION=
None -DCOMPRESS_MF_MT=1 -Isrc/sdk -IC:\sstrahl\Programme\WinPython-32bit-2.7.6.4\python-2.7.6\include -IC:\sstrahl\Programme\WinPython-
32bit-2.7.6.4\python-2.7.6\PC -c src/pylzma/pylzma_decompress.c -o build\temp.win32-2.7\Release\src\pylzma\pylzma_decompress.o
C:\sstrahl\Programme\WinPython-32bit-2.7.6.4\python-2.7.6\..\tools\mingw32\bin\gcc.exe -mdll -O -Wall -DWITH_COMPAT=1 -DPYLZMA_VERSION=
None -DCOMPRESS_MF_MT=1 -Isrc/sdk -IC:\sstrahl\Programme\WinPython-32bit-2.7.6.4\python-2.7.6\include -IC:\sstrahl\Programme\WinPython-
32bit-2.7.6.4\python-2.7.6\PC -c src/pylzma/pylzma_compress.c -o build\temp.win32-2.7\Release\src\pylzma\pylzma_compress.o
C:\sstrahl\Programme\WinPython-32bit-2.7.6.4\python-2.7.6\..\tools\mingw32\bin\gcc.exe -mdll -O -Wall -DWITH_COMPAT=1 -DPYLZMA_VERSION=
None -DCOMPRESS_MF_MT=1 -Isrc/sdk -IC:\sstrahl\Programme\WinPython-32bit-2.7.6.4\python-2.7.6\include -IC:\sstrahl\Programme\WinPython-
32bit-2.7.6.4\python-2.7.6\PC -c src/pylzma/pylzma_streams.c -o build\temp.win32-2.7\Release\src\pylzma\pylzma_streams.o
C:\sstrahl\Programme\WinPython-32bit-2.7.6.4\python-2.7.6\..\tools\mingw32\bin\gcc.exe -mdll -O -Wall -DWITH_COMPAT=1 -DPYLZMA_VERSION=
None -DCOMPRESS_MF_MT=1 -Isrc/sdk -IC:\sstrahl\Programme\WinPython-32bit-2.7.6.4\python-2.7.6\include -IC:\sstrahl\Programme\WinPython-
32bit-2.7.6.4\python-2.7.6\PC -c src/pylzma/pylzma_aes.c -o build\temp.win32-2.7\Release\src\pylzma\pylzma_aes.o
C:\sstrahl\Programme\WinPython-32bit-2.7.6.4\python-2.7.6\..\tools\mingw32\bin\gcc.exe -mdll -O -Wall -DWITH_COMPAT=1 -DPYLZMA_VERSION=
None -DCOMPRESS_MF_MT=1 -Isrc/sdk -IC:\sstrahl\Programme\WinPython-32bit-2.7.6.4\python-2.7.6\include -IC:\sstrahl\Programme\WinPython-
32bit-2.7.6.4\python-2.7.6\PC -c src/pylzma/pylzma_decompress_compat.c -o build\temp.win32-2.7\Release\src\pylzma\pylzma_decompress_com
pat.o
C:\sstrahl\Programme\WinPython-32bit-2.7.6.4\python-2.7.6\..\tools\mingw32\bin\gcc.exe -mdll -O -Wall -DWITH_COMPAT=1 -DPYLZMA_VERSION=
None -DCOMPRESS_MF_MT=1 -Isrc/sdk -IC:\sstrahl\Programme\WinPython-32bit-2.7.6.4\python-2.7.6\include -IC:\sstrahl\Programme\WinPython-
32bit-2.7.6.4\python-2.7.6\PC -c src/pylzma/pylzma_decompressobj_compat.c -o build\temp.win32-2.7\Release\src\pylzma\pylzma_decompresso
bj_compat.o
C:\sstrahl\Programme\WinPython-32bit-2.7.6.4\python-2.7.6\..\tools\mingw32\bin\gcc.exe -mdll -O -Wall -DWITH_COMPAT=1 -DPYLZMA_VERSION=
None -DCOMPRESS_MF_MT=1 -Isrc/sdk -IC:\sstrahl\Programme\WinPython-32bit-2.7.6.4\python-2.7.6\include -IC:\sstrahl\Programme\WinPython-
32bit-2.7.6.4\python-2.7.6\PC -c src\sdk\LzFind.c -o build\temp.win32-2.7\Release\src\sdk\lzfind.o
C:\sstrahl\Programme\WinPython-32bit-2.7.6.4\python-2.7.6\..\tools\mingw32\bin\gcc.exe -mdll -O -Wall -DWITH_COMPAT=1 -DPYLZMA_VERSION=
None -DCOMPRESS_MF_MT=1 -Isrc/sdk -IC:\sstrahl\Programme\WinPython-32bit-2.7.6.4\python-2.7.6\include -IC:\sstrahl\Programme\WinPython-
32bit-2.7.6.4\python-2.7.6\PC -c src\sdk\LzmaDec.c -o build\temp.win32-2.7\Release\src\sdk\lzmadec.o
C:\sstrahl\Programme\WinPython-32bit-2.7.6.4\python-2.7.6\..\tools\mingw32\bin\gcc.exe -mdll -O -Wall -DWITH_COMPAT=1 -DPYLZMA_VERSION=
None -DCOMPRESS_MF_MT=1 -Isrc/sdk -IC:\sstrahl\Programme\WinPython-32bit-2.7.6.4\python-2.7.6\include -IC:\sstrahl\Programme\WinPython-
32bit-2.7.6.4\python-2.7.6\PC -c src\sdk\LzmaEnc.c -o build\temp.win32-2.7\Release\src\sdk\lzmaenc.o
src\sdk\LzmaEnc.c: In function 'LzmaEnc_Encode':
src\sdk\LzmaEnc.c:2181:8: warning: variable 'allocaDummy' set but not used [-Wunused-but-set-variable]
C:\sstrahl\Programme\WinPython-32bit-2.7.6.4\python-2.7.6\..\tools\mingw32\bin\gcc.exe -mdll -O -Wall -DWITH_COMPAT=1 -DPYLZMA_VERSION=
None -DCOMPRESS_MF_MT=1 -Isrc/sdk -IC:\sstrahl\Programme\WinPython-32bit-2.7.6.4\python-2.7.6\include -IC:\sstrahl\Programme\WinPython-
32bit-2.7.6.4\python-2.7.6\PC -c src\7zip\C\CpuArch.c -o build\temp.win32-2.7\Release\src\7zip\c\cpuarch.o
C:\sstrahl\Programme\WinPython-32bit-2.7.6.4\python-2.7.6\..\tools\mingw32\bin\gcc.exe -mdll -O -Wall -DWITH_COMPAT=1 -DPYLZMA_VERSION=
None -DCOMPRESS_MF_MT=1 -Isrc/sdk -IC:\sstrahl\Programme\WinPython-32bit-2.7.6.4\python-2.7.6\include -IC:\sstrahl\Programme\WinPython-
32bit-2.7.6.4\python-2.7.6\PC -c src\7zip\C\Aes.c -o build\temp.win32-2.7\Release\src\7zip\c\aes.o
C:\sstrahl\Programme\WinPython-32bit-2.7.6.4\python-2.7.6\..\tools\mingw32\bin\gcc.exe -mdll -O -Wall -DWITH_COMPAT=1 -DPYLZMA_VERSION=
None -DCOMPRESS_MF_MT=1 -Isrc/sdk -IC:\sstrahl\Programme\WinPython-32bit-2.7.6.4\python-2.7.6\include -IC:\sstrahl\Programme\WinPython-
32bit-2.7.6.4\python-2.7.6\PC -c src\7zip\C\AesOpt.c -o build\temp.win32-2.7\Release\src\7zip\c\aesopt.o
C:\sstrahl\Programme\WinPython-32bit-2.7.6.4\python-2.7.6\..\tools\mingw32\bin\gcc.exe -mdll -O -Wall -DWITH_COMPAT=1 -DPYLZMA_VERSION=
None -DCOMPRESS_MF_MT=1 -Isrc/sdk -IC:\sstrahl\Programme\WinPython-32bit-2.7.6.4\python-2.7.6\include -IC:\sstrahl\Programme\WinPython-
32bit-2.7.6.4\python-2.7.6\PC -c src\7zip\C\Sha256.c -o build\temp.win32-2.7\Release\src\7zip\c\sha256.o
C:\sstrahl\Programme\WinPython-32bit-2.7.6.4\python-2.7.6\..\tools\mingw32\bin\gcc.exe -mdll -O -Wall -DWITH_COMPAT=1 -DPYLZMA_VERSION=
None -DCOMPRESS_MF_MT=1 -Isrc/sdk -IC:\sstrahl\Programme\WinPython-32bit-2.7.6.4\python-2.7.6\include -IC:\sstrahl\Programme\WinPython-
32bit-2.7.6.4\python-2.7.6\PC -c src\7zip\C\Bra.c -o build\temp.win32-2.7\Release\src\7zip\c\bra.o
C:\sstrahl\Programme\WinPython-32bit-2.7.6.4\python-2.7.6\..\tools\mingw32\bin\gcc.exe -mdll -O -Wall -DWITH_COMPAT=1 -DPYLZMA_VERSION=
None -DCOMPRESS_MF_MT=1 -Isrc/sdk -IC:\sstrahl\Programme\WinPython-32bit-2.7.6.4\python-2.7.6\include -IC:\sstrahl\Programme\WinPython-
32bit-2.7.6.4\python-2.7.6\PC -c src\7zip\C\Bra86.c -o build\temp.win32-2.7\Release\src\7zip\c\bra86.o
C:\sstrahl\Programme\WinPython-32bit-2.7.6.4\python-2.7.6\..\tools\mingw32\bin\gcc.exe -mdll -O -Wall -DWITH_COMPAT=1 -DPYLZMA_VERSION=
None -DCOMPRESS_MF_MT=1 -Isrc/sdk -IC:\sstrahl\Programme\WinPython-32bit-2.7.6.4\python-2.7.6\include -IC:\sstrahl\Programme\WinPython-
32bit-2.7.6.4\python-2.7.6\PC -c src\7zip\C\BraIA64.c -o build\temp.win32-2.7\Release\src\7zip\c\braia64.o
C:\sstrahl\Programme\WinPython-32bit-2.7.6.4\python-2.7.6\..\tools\mingw32\bin\gcc.exe -mdll -O -Wall -DWITH_COMPAT=1 -DPYLZMA_VERSION=
None -DCOMPRESS_MF_MT=1 -Isrc/sdk -IC:\sstrahl\Programme\WinPython-32bit-2.7.6.4\python-2.7.6\include -IC:\sstrahl\Programme\WinPython-
32bit-2.7.6.4\python-2.7.6\PC -c src\compat\LzmaCompatDecode.c -o build\temp.win32-2.7\Release\src\compat\lzmacompatdecode.o
C:\sstrahl\Programme\WinPython-32bit-2.7.6.4\python-2.7.6\..\tools\mingw32\bin\gcc.exe -mdll -O -Wall -DWITH_COMPAT=1 -DPYLZMA_VERSION=
None -DCOMPRESS_MF_MT=1 -Isrc/sdk -IC:\sstrahl\Programme\WinPython-32bit-2.7.6.4\python-2.7.6\include -IC:\sstrahl\Programme\WinPython-
32bit-2.7.6.4\python-2.7.6\PC -c src/sdk/LzFindMt.c -o build\temp.win32-2.7\Release\src\sdk\lzfindmt.o
src/sdk/LzFindMt.c: In function 'BtThreadFunc2':
src/sdk/LzFindMt.c:457:8: warning: variable 'allocaDummy' set but not used [-Wunused-but-set-variable]
src/sdk/LzFindMt.c: At top level:
src/sdk/LzFindMt.c:146:1: warning: 'GetHeads5' defined but not used [-Wunused-function]
C:\sstrahl\Programme\WinPython-32bit-2.7.6.4\python-2.7.6\..\tools\mingw32\bin\gcc.exe -mdll -O -Wall -DWITH_COMPAT=1 -DPYLZMA_VERSION=
None -DCOMPRESS_MF_MT=1 -Isrc/sdk -IC:\sstrahl\Programme\WinPython-32bit-2.7.6.4\python-2.7.6\include -IC:\sstrahl\Programme\WinPython-
32bit-2.7.6.4\python-2.7.6\PC -c src/sdk/Threads.c -o build\temp.win32-2.7\Release\src\sdk\threads.o
writing build\temp.win32-2.7\Release\src\pylzma\pylzma.def
C:\sstrahl\Programme\WinPython-32bit-2.7.6.4\python-2.7.6\..\tools\mingw32\bin\gcc.exe -shared -s build\temp.win32-2.7\Release\src\pylz
ma\pylzma.o build\temp.win32-2.7\Release\src\pylzma\pylzma_decompressobj.o build\temp.win32-2.7\Release\src\pylzma\pylzma_compressfile.
o build\temp.win32-2.7\Release\src\pylzma\pylzma_decompress.o build\temp.win32-2.7\Release\src\pylzma\pylzma_compress.o build\temp.win3
2-2.7\Release\src\pylzma\pylzma_streams.o build\temp.win32-2.7\Release\src\pylzma\pylzma_aes.o build\temp.win32-2.7\Release\src\pylzma\
pylzma_decompress_compat.o build\temp.win32-2.7\Release\src\pylzma\pylzma_decompressobj_compat.o build\temp.win32-2.7\Release\src\sdk\l
zfind.o build\temp.win32-2.7\Release\src\sdk\lzmadec.o build\temp.win32-2.7\Release\src\sdk\lzmaenc.o build\temp.win32-2.7\Release\src\
7zip\c\cpuarch.o build\temp.win32-2.7\Release\src\7zip\c\aes.o build\temp.win32-2.7\Release\src\7zip\c\aesopt.o build\temp.win32-2.7\Re
lease\src\7zip\c\sha256.o build\temp.win32-2.7\Release\src\7zip\c\bra.o build\temp.win32-2.7\Release\src\7zip\c\bra86.o build\temp.win3
2-2.7\Release\src\7zip\c\braia64.o build\temp.win32-2.7\Release\src\compat\lzmacompatdecode.o build\temp.win32-2.7\Release\src\sdk\lzfi
ndmt.o build\temp.win32-2.7\Release\src\sdk\threads.o build\temp.win32-2.7\Release\src\pylzma\pylzma.def -LC:\sstrahl\Programme\WinPyth
on-32bit-2.7.6.4\python-2.7.6\libs -LC:\sstrahl\Programme\WinPython-32bit-2.7.6.4\python-2.7.6\PCbuild -luser32 -loleaut32 -lpython27 -
lmsvcr90 -o build\lib.win32-2.7\pylzma.pyd
c:\temp\pylzma>