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

PyAlsaAudio refuses to compile with errors #96

Open
DanRPI opened this issue Jan 2, 2021 · 3 comments
Open

PyAlsaAudio refuses to compile with errors #96

DanRPI opened this issue Jan 2, 2021 · 3 comments

Comments

@DanRPI
Copy link

DanRPI commented Jan 2, 2021

i tried to install pyalsaaudio with pip3 (to get another script running)
(as root on a RPI1, Raspbian GNU/Linux 8 (jessie) 4.19.118+ #1311 Mon Apr 27 14:16:15 BST 2020 armv6l GNU/Linux)

pip3 install pyalsaaudio

Downloading/unpacking pyalsaaudio
  Downloading pyalsaaudio-0.9.0.tar.gz (370kB): 370kB downloaded
  Running setup.py (path:/tmp/pip-build-qunox10l/pyalsaaudio/setup.py) egg_info for package pyalsaaudio

    warning: no files found matching '*.gif' under directory 'doc'
    warning: no files found matching '*.json' under directory 'doc'
Installing collected packages: pyalsaaudio
  Running setup.py install for pyalsaaudio
    building 'alsaaudio' extension
    arm-linux-gnueabihf-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -g -fstack-protector-strong -Wformat -Werror=format-security -D_FORTIFY_SOURCE=2 -fPIC -I/usr/include/python3.4m -c alsaaudio.c -o build/temp.linux-armv6l-3.4/alsaaudio.o
    alsaaudio.c: In function 'alsapcm_getformats':
    alsaaudio.c:663:2: error: 'for' loop initial declarations are only allowed in C99 or C11 mode
      for (size_t i = 0; i < ARRAY_SIZE(ALSAFormats); ++i) {
      ^
    alsaaudio.c:663:2: note: use option -std=c99, -std=gnu99, -std=c11 or -std=gnu11 to compile your code
    alsaaudio.c: In function 'alsapcm_getrates':
    alsaaudio.c:754:3: error: 'for' loop initial declarations are only allowed in C99 or C11 mode
       for (size_t i=0; i<ARRAY_SIZE(ALSARates); i++) {
       ^
    alsaaudio.c: In function 'alsapcm_getchannels':
    alsaaudio.c:805:2: error: 'for' loop initial declarations are only allowed in C99 or C11 mode
      for (unsigned ch=min;ch<=max;++ch) {
      ^
    error: command 'arm-linux-gnueabihf-gcc' failed with exit status 1
    Complete output from command /usr/bin/python3 -c "import setuptools, tokenize;__file__='/tmp/pip-build-qunox10l/pyalsaaudio/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /tmp/pip-bx90n2rn-record/install-record.txt --single-version-externally-managed --compile:
    running install

running build

running build_ext

building 'alsaaudio' extension

creating build

creating build/temp.linux-armv6l-3.4

arm-linux-gnueabihf-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -g -fstack-protector-strong -Wformat -Werror=format-security -D_FORTIFY_SOURCE=2 -fPIC -I/usr/include/python3.4m -c alsaaudio.c -o build/temp.linux-armv6l-3.4/alsaaudio.o

alsaaudio.c: In function 'alsapcm_getformats':

alsaaudio.c:663:2: error: 'for' loop initial declarations are only allowed in C99 or C11 mode

  for (size_t i = 0; i < ARRAY_SIZE(ALSAFormats); ++i) {

  ^

alsaaudio.c:663:2: note: use option -std=c99, -std=gnu99, -std=c11 or -std=gnu11 to compile your code

alsaaudio.c: In function 'alsapcm_getrates':

alsaaudio.c:754:3: error: 'for' loop initial declarations are only allowed in C99 or C11 mode

   for (size_t i=0; i<ARRAY_SIZE(ALSARates); i++) {

   ^

alsaaudio.c: In function 'alsapcm_getchannels':

alsaaudio.c:805:2: error: 'for' loop initial declarations are only allowed in C99 or C11 mode

  for (unsigned ch=min;ch<=max;++ch) {

  ^

error: command 'arm-linux-gnueabihf-gcc' failed with exit status 1

----------------------------------------
Cleaning up...
Command /usr/bin/python3 -c "import setuptools, tokenize;__file__='/tmp/pip-build-qunox10l/pyalsaaudio/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /tmp/pip-bx90n2rn-record/install-record.txt --single-version-externally-managed --compile failed with error code 1 in /tmp/pip-build-qunox10l/pyalsaaudio
Storing debug log for failure in /root/.pip/pip.log

i did the same for pyaudio which worked after i installed libportaudio2 and portaudio19-dev
so it doesn't seem to be due to pip3 or phyton itself (which i both installed to get...........)
i really don't like this system bloating loops one has to make to get things working...
in 2k one could start a desktop computer with a 350MB Linux, now one needs 2gig for a stripped version minibian for a single platine rsc computer...

@DanRPI
Copy link
Author

DanRPI commented Jan 3, 2021

got it working
a "md m4" is missing in the autoconfig

@DanRPI
Copy link
Author

DanRPI commented Feb 17, 2021

a little more detail as requested, from memory, it was some weeks ago, and in plain speak, i'm not that expert...

  • during the depacking script of the modules i noticed an error reading the like "folder m4 is missing ... extracting to" and a while after these files were missing in the compile run.
  • so i simply made this folder at the expected location,
  • and in the next run the files went there while extraction and were finally found in the compile run...

@jiansongyang
Copy link

jiansongyang commented Mar 11, 2021

As a work around it may help to specify c99 as the C++ specification. So, in the file setup.py:

ext_modules=[Extension('alsaaudio',['alsaaudio.c'],
                               libraries=['asound'],
                               extra_compile_args=["-std=c99",]
        )]

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

2 participants