Open Alquemist opened 7 years ago
Happened to me as well when I try to compile in Windows today.
For the first part of errors, it can be solved by changing PyObject_Head;
to PyObject_Head
in pcm.h
.
However, in pcmconverter.c
, it looks like in line 120 an variable length array is used, which is not supported in MS Visual C++. It is a C99 feature supported by GCC but not MSVC. Seems like it has to be some code changes in order to be compiled by MSVC.
Reference: http://stackoverflow.com/questions/5246900/enabling-vlasvariable-length-arrays-in-ms-visual-c
I was able to get it built and installed today by making the semicolon change above, but had to leave out the encoders and decoders entirely. This is with VS 2017. The VLA issue turns out to be a major pain, as it looks like it's used throughout the encoders/decoders, and as @willtang says, even MSVC 2017 doesn't support that 8-plus-year-old language feature.
It looks like I have full metadata functionality, which ATM is my primary use case. It doesn't appear to me that any of the C code is actually getting compiled with my setup. What I did was just comment out these lines in setup.py, starting around line 1023:
ext_modules = [audiotools_pcm(),
audiotools_pcmconverter(),
audiotools_replaygain(),
#audiotools_decoders(system_libraries),
#audiotools_encoders(system_libraries),
audiotools_bitstream(),
audiotools_ogg(),
audiotools_accuraterip(),
audiotools_output(system_libraries)]
Then ignore the makefile, open up a VS cmd prompt as administrator, cd into the PAT working directory, and do this:
"c:\Program Files\Python36\python.exe" setup.py build
"c:\Program Files\Python36\python.exe" setup.py install
The metadata functionality of the libs work for me in my own program, but I haven't tried any of the PAT scripts.
FWIW....
It seems that the remaining errors are due to dynamic array allocating. I don't know whether it's legal in other compilers, but int pcm_data[some_variable]
is not legal in MSVC. This kind of errors occur in many places. After fixing `PyObject_Head;' and this problem, there remains few errors.
Is this package supported by Windows at all?
I'm trying to install it using ,"pip3 install git+url" but I get a lot of syntax errors on pcm.h file:
creating build\temp.win-amd64-3.5\Release\src C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\BIN\x86_amd64\cl.exe/c /nologo /Ox /W3 /GL /DNDEBUG /MD -DPCM_MODULE -I d:\programs\anaconda\include -I d:\programs\anaconda\include "-I C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\INCLUDE" "-I C:\Program Files (x86)\Windows Kits\10\include\10.0.10240.0\ucrt" "-I C:\Program Files (x86)\Windows Kits\8.1\include\shared" "-I C:\Program Files (x86)\Windows Kits\8.1\include\um" "-I C:\Program Files (x86)\Windows Kits\8.1\include\winrt" /Tcsrc/pcm.c /Fobuild\temp.win-amd64-3.5\Release\src/pcm.obj pcm.c c:\users\korisnik\appdata\local\temp\pip-16kjc4kl-build\src\pcm.h(33): error C2059: syntax error: ';' c:\users\korisnik\appdata\local\temp\pip-16kjc4kl-build\src\pcm.h(44): error C2059: syntax error: '}' c:\users\korisnik\appdata\local\temp\pip-16kjc4kl-build\src\pcm.h(48): error C2143: syntax error: missing ')' before '*'
. . . and so on, finally.
error count exceeds 100; stopping compilation error: command 'C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\BIN\x86_amd64\cl.exe' failed with exit status 2
BTW sourceforge package is missing setup.py