diff --git a/libc/string/strerror_r.c b/libc/string/strerror_r.c
index 907dcf079a9a39c977ef52523c4fb564676f5217..06058472a29d43459e69a15a038f8a6a53909d07 100644
--- a/libc/string/strerror_r.c
+++ b/libc/string/strerror_r.c
@@ -1,6 +1,17 @@
-#include <string.h>
+
+#include <sys/types.h>
 #include <errno.h>
 
+/*
+ * Glibc provides two incompatible versions of strerror_r and uses
+ * redirection magic for the XPG compliants ones in <string.h>,
+ * so we must avoid including that header as long as we use the glibc
+ * headers instead of the musl ones.
+ */
+extern char *strerror (int);
+extern size_t strlen (const char *);
+extern void *memcpy (void *__restrict, const void *__restrict, size_t);
+
 int strerror_r(int err, char *buf, size_t buflen)
 {
 	char *msg = strerror(err);