rhasspy / webrtc-noise-gain

Tiny wrapper around webrtc-audio-processing for noise suppression/auto gain only
MIT License
10 stars 17 forks source link

Fails to build wheel on Alpine / Python 3.12.2 #19

Closed syphernl closed 3 months ago

syphernl commented 3 months ago

I am running Alpine 3.19 which ships with Python 3.11. Due to the HomeAssistant requirement of Python 3.12 for the upcoming 2024.4 version I have created a virtualenv using pyenv which uses Python 3.12.2.

However, trying to install this dependency fails:

      In file included from /home/hass/src/webrtc_noise_gain-1.2.3/webrtc-audio-processing/webrtc-audio-processing-1/rtc_base/system/file_wrapper.cc:11:
      /home/hass/src/webrtc_noise_gain-1.2.3/webrtc-audio-processing/webrtc-audio-processing-1/rtc_base/system/file_wrapper.h:86:21: error: 'int64_t' has not been declared                       
         86 |   bool SeekRelative(int64_t offset);
            |                     ^~~~~~~        
      /home/hass/src/webrtc_noise_gain-1.2.3/webrtc-audio-processing/webrtc-audio-processing-1/rtc_base/system/file_wrapper.h:88:15: error: 'int64_t' has not been declared
         88 |   bool SeekTo(int64_t position);              
            |               ^~~~~~~                                                                                                                                                                                                                            
      /home/hass/src/webrtc_noise_gain-1.2.3/webrtc-audio-processing/webrtc-audio-processing-1/rtc_base/system/file_wrapper.cc:82:6: error: no declaration matches 'bool webrtc::FileWrapper::SeekRelative(int64_t)'
         82 | bool FileWrapper::SeekRelative(int64_t offset) {                                                                 
            |      ^~~~~~~~~~~                                
      /home/hass/src/webrtc_noise_gain-1.2.3/webrtc-audio-processing/webrtc-audio-processing-1/rtc_base/system/file_wrapper.h:86:8: note: candidate is: 'bool webrtc::FileWrapper::SeekRelative(int)'
         86 |   bool SeekRelative(int64_t offset);                                                                             
            |        ^~~~~~~~~~~~                                                                                              
      /home/hass/src/webrtc_noise_gain-1.2.3/webrtc-audio-processing/webrtc-audio-processing-1/rtc_base/system/file_wrapper.h:31:7: note: 'class webrtc::FileWrapper' defined here
         31 | class FileWrapper final {                                                                                                                                                                                                                        
            |       ^~~~~~~~~~~                                                                                                
      /home/hass/src/webrtc_noise_gain-1.2.3/webrtc-audio-processing/webrtc-audio-processing-1/rtc_base/system/file_wrapper.cc:87:6: error: no declaration matches 'bool webrtc::FileWrapper::SeekTo(int64_t)'
         87 | bool FileWrapper::SeekTo(int64_t position) {                                                                     
            |      ^~~~~~~~~~~                                                                                                                                                                                                                                 
      /home/hass/src/webrtc_noise_gain-1.2.3/webrtc-audio-processing/webrtc-audio-processing-1/rtc_base/system/file_wrapper.h:88:8: note: candidate is: 'bool webrtc::FileWrapper::SeekTo(int)'
         88 |   bool SeekTo(int64_t position);                                                                                                                                                                                                                 
            |        ^~~~~~
      /home/hass/src/webrtc_noise_gain-1.2.3/webrtc-audio-processing/webrtc-audio-processing-1/rtc_base/system/file_wrapper.h:31:7: note: 'class webrtc::FileWrapper' defined here
         31 | class FileWrapper final {
            |       ^~~~~~~~~~~
      Traceback (most recent call last):
        File "/tmp/pip-build-env-fodt2yd6/overlay/lib/python3.12/site-packages/setuptools/_distutils/unixccompiler.py", line 185, in _compile
          self.spawn(compiler_so + cc_args + [src, '-o', obj] + extra_postargs)
        File "/tmp/pip-build-env-fodt2yd6/overlay/lib/python3.12/site-packages/setuptools/_distutils/ccompiler.py", line 1041, in spawn
          spawn(cmd, dry_run=self.dry_run, **kwargs)
        File "/tmp/pip-build-env-fodt2yd6/overlay/lib/python3.12/site-packages/setuptools/_distutils/spawn.py", line 70, in spawn
          raise DistutilsExecError(
      setuptools._distutils.errors.DistutilsExecError: command '/usr/bin/gcc' failed with exit code 1

      During handling of the above exception, another exception occurred:

      Traceback (most recent call last):
        File "/opt/pyenv/versions/3.12.2/envs/hass/lib/python3.12/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 353, in <module>
          main()
        File "/opt/pyenv/versions/3.12.2/envs/hass/lib/python3.12/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 335, in main
          json_out['return_val'] = hook(**hook_input['kwargs'])
                                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
        File "/opt/pyenv/versions/3.12.2/envs/hass/lib/python3.12/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 251, in build_wheel
          return _build_backend().build_wheel(wheel_directory, config_settings,
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
        File "/tmp/pip-build-env-fodt2yd6/overlay/lib/python3.12/site-packages/setuptools/build_meta.py", line 410, in build_wheel
          return self._build_with_temp_dir(
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^
        File "/tmp/pip-build-env-fodt2yd6/overlay/lib/python3.12/site-packages/setuptools/build_meta.py", line 395, in _build_with_temp_dir
          self.run_setup()
        File "/tmp/pip-build-env-fodt2yd6/overlay/lib/python3.12/site-packages/setuptools/build_meta.py", line 487, in run_setup
          super().run_setup(setup_script=setup_script)
        File "/tmp/pip-build-env-fodt2yd6/overlay/lib/python3.12/site-packages/setuptools/build_meta.py", line 311, in run_setup
          exec(code, locals())
        File "<string>", line 565, in <module>
        File "/tmp/pip-build-env-fodt2yd6/overlay/lib/python3.12/site-packages/setuptools/__init__.py", line 104, in setup
          return distutils.core.setup(**attrs)
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
        File "/tmp/pip-build-env-fodt2yd6/overlay/lib/python3.12/site-packages/setuptools/_distutils/core.py", line 185, in setup
          return run_commands(dist)
                 ^^^^^^^^^^^^^^^^^^
        File "/tmp/pip-build-env-fodt2yd6/overlay/lib/python3.12/site-packages/setuptools/_distutils/core.py", line 201, in run_commands
          dist.run_commands()
        File "/tmp/pip-build-env-fodt2yd6/overlay/lib/python3.12/site-packages/setuptools/_distutils/dist.py", line 969, in run_commands
          self.run_command(cmd)
        File "/tmp/pip-build-env-fodt2yd6/overlay/lib/python3.12/site-packages/setuptools/dist.py", line 967, in run_command
          super().run_command(command)
        File "/tmp/pip-build-env-fodt2yd6/overlay/lib/python3.12/site-packages/setuptools/_distutils/dist.py", line 988, in run_command
          cmd_obj.run()
        File "/tmp/pip-build-env-fodt2yd6/normal/lib/python3.12/site-packages/wheel/bdist_wheel.py", line 368, in run
          self.run_command("build")
        File "/tmp/pip-build-env-fodt2yd6/overlay/lib/python3.12/site-packages/setuptools/_distutils/cmd.py", line 318, in run_command
          self.distribution.run_command(command)
        File "/tmp/pip-build-env-fodt2yd6/overlay/lib/python3.12/site-packages/setuptools/dist.py", line 967, in run_command
          super().run_command(command)
        File "/tmp/pip-build-env-fodt2yd6/overlay/lib/python3.12/site-packages/setuptools/_distutils/dist.py", line 988, in run_command
          cmd_obj.run()
        File "/tmp/pip-build-env-fodt2yd6/overlay/lib/python3.12/site-packages/setuptools/_distutils/command/build.py", line 131, in run
          self.run_command(cmd_name)
        File "/tmp/pip-build-env-fodt2yd6/overlay/lib/python3.12/site-packages/setuptools/_distutils/cmd.py", line 318, in run_command
          self.distribution.run_command(command)
        File "/tmp/pip-build-env-fodt2yd6/overlay/lib/python3.12/site-packages/setuptools/dist.py", line 967, in run_command
          super().run_command(command)
        File "/tmp/pip-build-env-fodt2yd6/overlay/lib/python3.12/site-packages/setuptools/_distutils/dist.py", line 988, in run_command
          cmd_obj.run()
        File "/tmp/pip-build-env-fodt2yd6/overlay/lib/python3.12/site-packages/setuptools/command/build_ext.py", line 91, in run
          _build_ext.run(self)
        File "/tmp/pip-build-env-fodt2yd6/overlay/lib/python3.12/site-packages/setuptools/_distutils/command/build_ext.py", line 345, in run
          self.build_extensions()
        File "<string>", line 513, in build_extensions
        File "/tmp/pip-build-env-fodt2yd6/overlay/lib/python3.12/site-packages/pybind11/setup_helpers.py", line 287, in build_extensions
          super().build_extensions()
        File "/tmp/pip-build-env-fodt2yd6/overlay/lib/python3.12/site-packages/setuptools/_distutils/command/build_ext.py", line 467, in build_extensions
          self._build_extensions_serial()
        File "/tmp/pip-build-env-fodt2yd6/overlay/lib/python3.12/site-packages/setuptools/_distutils/command/build_ext.py", line 493, in _build_extensions_serial
          self.build_extension(ext)
        File "/tmp/pip-build-env-fodt2yd6/overlay/lib/python3.12/site-packages/setuptools/command/build_ext.py", line 252, in build_extension
          _build_ext.build_extension(self, ext)
        File "/tmp/pip-build-env-fodt2yd6/overlay/lib/python3.12/site-packages/setuptools/_distutils/command/build_ext.py", line 548, in build_extension
          objects = self.compiler.compile(
                    ^^^^^^^^^^^^^^^^^^^^^^
        File "/tmp/pip-build-env-fodt2yd6/overlay/lib/python3.12/site-packages/setuptools/_distutils/ccompiler.py", line 600, in compile
          self._compile(obj, src, ext, cc_args, extra_postargs, pp_opts)
        File "<string>", line 500, in _compile
        File "/tmp/pip-build-env-fodt2yd6/overlay/lib/python3.12/site-packages/setuptools/_distutils/unixccompiler.py", line 187, in _compile
          raise CompileError(msg)
      setuptools._distutils.errors.CompileError: command '/usr/bin/gcc' failed with exit code 1
      [end of output]

  note: This error originates from a subprocess, and is likely not a problem with pip.
  ERROR: Failed building wheel for webrtc_noise_gain

I've tried to apply the fixes/workarounds I found in the other open issues about issues compiling on various platforms.

Installed dev deps:

syphernl commented 3 months ago

Fixed, with the changes done in https://github.com/rhasspy/webrtc-noise-gain/pull/8

These haven't been included in a release yet.