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

RISC-V support: What's needed? #18

Open
IngwiePhoenix opened this issue Feb 19, 2024 · 3 comments · May be fixed by #27
Open

RISC-V support: What's needed? #18

IngwiePhoenix opened this issue Feb 19, 2024 · 3 comments · May be fixed by #27

Comments

@IngwiePhoenix
Copy link

Hello there!

So, first off:

(homeassistant) root@riscboi /n/s/homeassistant [0|1]# pip install -U webrtc-noise-gain
Collecting webrtc-noise-gain
  Using cached webrtc_noise_gain-1.2.3.tar.gz (3.1 MB)
  Installing build dependencies ... done
  Getting requirements to build wheel ... error
  error: subprocess-exited-with-error

  × Getting requirements to build wheel did not run successfully.
  │ exit code: 1
  ╰─> [20 lines of output]
      Traceback (most recent call last):
        File "/nvme/srv/homeassistant/lib/python3.12/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 353, in <module>
          main()
        File "/nvme/srv/homeassistant/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 "/nvme/srv/homeassistant/lib/python3.12/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 118, in get_requires_for_build_wheel
          return hook(config_settings)
                 ^^^^^^^^^^^^^^^^^^^^^
        File "/tmp/pip-build-env-2scqyq2w/overlay/lib/python3.12/site-packages/setuptools/build_meta.py", line 325, in get_requires_for_build_wheel
          return self._get_build_requires(config_settings, requirements=['wheel'])
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
        File "/tmp/pip-build-env-2scqyq2w/overlay/lib/python3.12/site-packages/setuptools/build_meta.py", line 295, in _get_build_requires
          self.run_setup()
        File "/tmp/pip-build-env-2scqyq2w/overlay/lib/python3.12/site-packages/setuptools/build_meta.py", line 480, in run_setup
          super().run_setup(setup_script=setup_script)
        File "/tmp/pip-build-env-2scqyq2w/overlay/lib/python3.12/site-packages/setuptools/build_meta.py", line 311, in run_setup
          exec(code, locals())
        File "<string>", line 482, in <module>
      ValueError: Unsupported machine: riscv64
      [end of output]

  note: This error originates from a subprocess, and is likely not a problem with pip.
error: subprocess-exited-with-error

× Getting requirements to build wheel did not run successfully.
│ exit code: 1
╰─> See above for output.

note: This error originates from a subprocess, and is likely not a problem with pip.

I looked at the setup.py for a while and took note of which -Defines and .c/.cc sources are added to the build. Well, is there a way to help to make RISC-V work?

I run a relatively "standard" Debian Unstable (Trixie) so all the default tools are here (gcc, alsa, ffmpeg, ...). Since this seems to be the last package holding back Home Assistant's assist_pipeline, I would love to get this sorted. :)

Kind regards,
Ingwie

@gdt
Copy link
Contributor

gdt commented Apr 16, 2024

You're going to have to do two things. One is to add a block to setup.py to switch on risc-v. If it's BE, then you have even more work to do as there seems to be a "all the world is LE" define -- which is obviously not true, but perhaps webrtc-noise-gain has that assumption.

The other thing, which might be hard and might not be, is to make webrtc-noise-gain work on risc-v. I am unclear on status, but have a vague memory that it's not really maintained upstream and is thus vendored here. But don't trust me on that; figure it out :-)

(I'm simply a user here, reading setup.py because this was not portable to BSDs, and hoping to run NetBSD on risc-v some year.)

@martinwozenilek
Copy link

At least for Gentoo it seems we have now a solution. Andrew created a patch for risc64 for the ebuild:

http://forum.rvspace.org/t/webrtc-noise-gain-for-risc-v/4443/2?u=martin.wozenilek

I've tested this with the VisionFive2-Gentoo-HomeAssistant system and it looks okay.

@apcameron
Copy link

Here is the patch that you can try

diff '--color=auto' -Naur a/setup.py b/setup.py
--- a/setup.py	2024-07-10 20:25:14.667065285 +0100
+++ b/setup.py	2024-07-10 20:24:41.386342397 +0100
@@ -478,6 +478,12 @@
         "-DWEBRTC_ARCH_32_BITS",
         "-DPFFFT_SIMD_DISABLE",
     ]
+elif machine in ("riscv64", "risc"):
+    # Riscv)
+    machine_cflags += [
+        "-DWEBRTC_ARCH_RISCV",
+        "-DWEBRTC_ARCH_64_BITS",
+    ]
 else:
     raise ValueError(f"Unsupported machine: {machine}")

eshattow added a commit to eshattow/webrtc-noise-gain that referenced this issue Nov 30, 2024
@eshattow eshattow linked a pull request Nov 30, 2024 that will close this issue
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

Successfully merging a pull request may close this issue.

4 participants