Windows compilation failure on pip install due to invalid command flags

Viewed 1237

I was trying to install the lz4 package on my Windows machine from PyPi using pip. This package doesn't have any wheels uploaded so it was going to need to compile the source locally. I have the Visual C++ for Python compiler installed.

I ran:

pip install lz4

This gave me a compilation error:

C:\Users\Nick\AppData\Local\Programs\Common\Microsoft\Visual C++ for Python\9.0\VC\Bin\cl.exe /c /nologo /Ox /MD /W3 /GS- /DNDEBUG -Ic:\Python27\include -Ic:\Python27\PC /Tcsrc/lz4.c /Fobuild\temp.win32-2.7\Release\src/lz4.obj -std=c99 -O3 -Wall -W -Wundef -DLZ4_VERSION="r119"
cl : Command line error D8004 : '/W' requires an argument

On downloading the tar file from PyPi I could see that the -W and -Wundef compiler arguments were being set explicitly, but these are not legal flags for the MSVC compiler.

    ext_modules=[
    Extension('lz4', [
        'src/lz4.c',
        'src/lz4hc.c',
        'src/python-lz4.c'
    ], extra_compile_args=[
        "-std=c99",
        "-O3",
        "-Wall",
        "-W",
        "-Wundef",
        "-DLZ4_VERSION=\"r119\"",
    ])

I removed these from my local copy of the source and ran setup against the modified code.

python setup.py install

I still had a problem with stdint.h being missing, discussed elsewhere, but after solving that the install succeeded.

My questions are:

  • Am I missing something here, is there something wrong with my set-up that meant the build was failing?
  • Is there a way to specify command arguments in setup.py in a platform specific way?
  • I can see on the lz4 PyPi page that the build is passing. What does this actually mean?
0 Answers
Related