Thanks for the report. I assume you're using glibc? Which glibc version?
Does the attached patch fix things for you?
diff --git a/lib/endian.in.h b/lib/endian.in.h
index e81aa7da8c..c55b5da6af 100644
--- a/lib/endian.in.h
+++ b/lib/endian.in.h
@@ -109,6 +109,15 @@ _GL_INLINE_HEADER_BEGIN
extern "C" {
#endif
+/* Forward declarations, in case byteswap.h -> stdint.h -> sys/types.h
+ -> endian.h -> byteswap.h, the last of which is blocked by the
+ include guard so these functions have not been declared yet. */
+#if defined _GL_BYTESWAP_H && !defined _GL_BYTESWAP_INLINE
+extern uint_least16_t bswap_16 (uint_least16_t);
+extern uint_least32_t bswap_32 (uint_least32_t);
+extern uint_least64_t bswap_64 (uint_least64_t);
+#endif
+
/* Big endian to host. */
_GL_ENDIAN_INLINE uint16_t