--- a/src/xshmfence_futex.h
+++ b/src/xshmfence_futex.h
@@ -47,6 +47,10 @@ static inline int futex_wait(int32_t *ad
 
 #else
 
+#if !defined(__NR_futex) && defined(__riscv) && __riscv_xlen == 32
+# define __NR_futex __NR_futex_time64
+#endif
+
 #include <stdint.h>
 #include <values.h>
 #include <linux/futex.h>
