Based on my_error.cc from newer MySQL --- a/mysys/my_error.c +++ b/mysys/my_error.c @@ -110,7 +110,7 @@ (defined _XOPEN_SOURCE && (_XOPEN_SOURCE >= 600))) && \ ! defined _GNU_SOURCE strerror_r(nr, buf, len); /* I can build with or without GNU */ -#elif defined _GNU_SOURCE +#elif defined(__GLIBC__) && defined(_GNU_SOURCE) char *r= strerror_r(nr, buf, len); if (r != buf) /* Want to help, GNU? */ strmake(buf, r, len - 1); /* Then don't. */