diff --git a/getcifsacl.c b/getcifsacl.c
index f08cdea..5c46999 100644
--- a/getcifsacl.c
+++ b/getcifsacl.c
@@ -38,6 +38,11 @@
 #include "cifsacl.h"
 #include "idmap_plugin.h"
 
+#ifdef __linux__
+#include <linux/limits.h> /* for XATTR_SIZE_MAX */
+#include <endian.h> /* le16toh, le32toh etc */
+#endif
+
 static void *plugin_handle;
 static bool plugin_loaded;
 
diff --git a/setcifsacl.c b/setcifsacl.c
index ba34403..64e6eaa 100644
--- a/setcifsacl.c
+++ b/setcifsacl.c
@@ -39,6 +39,11 @@
 #include "cifsacl.h"
 #include "idmap_plugin.h"
 
+#ifdef __linux__
+#include <linux/limits.h> /* for XATTR_SIZE_MAX */
+#include <endian.h> /* le16toh, le32toh etc */
+#endif
+
 enum setcifsacl_actions {
 	ActUnknown = -1,
 	ActDelete,