ROCm / ROCT-Thunk-Interface

ROCm's Thunk Interface
Other
83 stars 71 forks source link

Doesn't build on musl systems #65

Closed CamilleScholtz closed 6 months ago

CamilleScholtz commented 3 years ago

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"
fxkamd commented 3 years ago

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.

CamilleScholtz commented 3 years ago

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:

notmentaloutlaw commented 1 year ago

Do you perhaps have a fix for 5.6?

Unfortunately I am getting errors on my system

AngryLoki commented 8 months ago

PAGE_SIZE is a reserved symbolic name of [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