ROCT-Thunk-Interface icon indicating copy to clipboard operation
ROCT-Thunk-Interface copied to clipboard

Doesn't build on musl systems

Open CamilleScholtz opened this issue 4 years ago • 4 comments

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"

CamilleScholtz avatar Dec 18 '20 22:12 CamilleScholtz

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.

fxkamd avatar Dec 18 '20 22:12 fxkamd

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]/

CamilleScholtz avatar Dec 19 '20 13:12 CamilleScholtz

Do you perhaps have a fix for 5.6?

Unfortunately I am getting errors on my system

notmentaloutlaw avatar Aug 11 '23 22:08 notmentaloutlaw

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

AngryLoki avatar Mar 09 '24 10:03 AngryLoki