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

Error building on Windows pcm.h syntax error #71

Open
Alquemist opened this issue Feb 13, 2017 · 3 comments
Open

Error building on Windows pcm.h syntax error #71

Alquemist opened this issue Feb 13, 2017 · 3 comments

Comments

@Alquemist
Copy link

Alquemist commented Feb 13, 2017

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

@willtang
Copy link

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

@gvansickle
Copy link

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....

@cmpute
Copy link

cmpute commented Sep 4, 2018

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants