ROCT-Thunk-Interface
ROCT-Thunk-Interface copied to clipboard
Doesn't build on musl systems
the following patch fixes this:
diff --git a/src/libhsakmt.h b/src/libhsakmt.h
index 1cae43a..37d72b3 100644
--- a/src/libhsakmt.h
+++ b/src/libhsakmt.h
@@ -32,6 +32,10 @@
#include <stdint.h>
#include <limits.h>
+#ifdef PAGE_SIZE
+#undef PAGE_SIZE
+#endif
+
extern int kfd_fd;
extern unsigned long kfd_open_count;
extern bool hsakmt_forked;
diff --git a/src/topology.c b/src/topology.c
index 36ef987..d0b487e 100644
--- a/src/topology.c
+++ b/src/topology.c
@@ -34,6 +34,7 @@
#include <errno.h>
#include <sys/sysinfo.h>
+#include <sys/param.h>
#include "libhsakmt.h"
#include "fmm.h"
Excuse my ignorance. What's a musl system?
If there is a conflict between our global variable PAGE_SIZE and a macro defined in a header file, it may be cleaner to rename our variable to something like g_page_size.
musl is an alternative to glibc: https://musl.libc.org/
I don't know much about C and especially not these kind of global variables, that's why I made this an issue instead of PR.
Some more info about PAGE_SIZE in musl:
- https://musl.openwall.narkive.com/tO8vrHdP/why-musl-define-page-size
- https://patchwork.kernel.org/project/kvm/patch/[email protected]/
Do you perhaps have a fix for 5.6?
Unfortunately I am getting errors on my system
PAGE_SIZE is a reserved symbolic name of <limits.h>[1], so it is not an issue that can be fixed on musl side.
There is an open bug in Gentoo[2] on ROCT-Thunk-Interface (one of multiple).
[1] https://pubs.opengroup.org/onlinepubs/7908799/xsh/limits.h.html [2] https://bugs.gentoo.org/830944