Index: spa/plugins/support/cpu-riscv.c
--- spa/plugins/support/cpu-riscv.c.orig
+++ spa/plugins/support/cpu-riscv.c
@@ -13,7 +13,14 @@ riscv_init(struct impl *impl)
 	uint32_t flags = 0;
 
 #ifdef HAVE_SYS_AUXV_H
+#if defined(__FreeBSD__) || defined(__OpenBSD__)
+	unsigned long hwcap;
+
+	if (elf_aux_info(AT_HWCAP, &hwcap, sizeof(hwcap)) != 0)
+		hwcap = 0;
+#else
 	const unsigned long hwcap = getauxval(AT_HWCAP);
+#endif
 	if (hwcap & HWCAP_RV('V'))
 		flags |= SPA_CPU_FLAG_RISCV_V;
 #endif
