With thanks to alpine.
https://git.alpinelinux.org/cgit/aports/tree/community/gsoap/musl-fixes.patch

The first patch I think should not be necessary, but is because the same source
file defines _GNU_SOURCE if gnu-linux and !defined(_GNU_SOURCE) (go read the
code, it's the first two places _GNU_SOURCE is used in gsoap/stdsoap2.cpp).
I don't know why, but it seems wrong to me.
EDIT: Turns out (I was told this) that gcc will define _GNU_SOURCE
automatically for C++ files. The first patch is definitely necessary.

--- ./gsoap/stdsoap2.cpp.orig
+++ ./gsoap/stdsoap2.cpp
@@ -18691,7 +18691,7 @@
   {
 #ifndef WIN32
 # ifdef HAVE_STRERROR_R
-#  if defined(_GNU_SOURCE) && !defined(__ANDROID__)
+#  if defined(_GNU_SOURCE) && !defined(__ANDROID__) && defined(__GLIBC__)
     return strerror_r(err, soap->msgbuf, sizeof(soap->msgbuf)); /* GNU-specific */
 #  else
     strerror_r(err, soap->msgbuf, sizeof(soap->msgbuf)); /* XSI-compliant */
--- ./gsoap/stdsoap2.h.orig
+++ ./gsoap/stdsoap2.h
@@ -943,7 +943,7 @@
 # endif
 #elif defined(SOCKLEN_T)
 # define SOAP_SOCKLEN_T SOCKLEN_T
-#elif defined(__socklen_t_defined) || defined(_SOCKLEN_T) || defined(CYGWIN) || defined(FREEBSD) || defined(__FreeBSD__) || defined(OPENBSD) || defined(__QNX__) || defined(QNX) || defined(OS390) || defined(__ANDROID__) || defined(_XOPEN_SOURCE)
+#elif defined(__socklen_t_defined) || defined(_SOCKLEN_T) || defined(CYGWIN) || defined(FREEBSD) || defined(__FreeBSD__) || defined(OPENBSD) || defined(__QNX__) || defined(QNX) || defined(OS390) || defined(__ANDROID__) || defined(_XOPEN_SOURCE) || defined (LINUX)
 # define SOAP_SOCKLEN_T socklen_t
 #elif defined(IRIX) || defined(WIN32) || defined(__APPLE__) || defined(SUN_OS) || defined(OPENSERVER) || defined(TRU64) || defined(VXWORKS)
 # define SOAP_SOCKLEN_T int
