0

I would like to compile gsoap on cygwin as a shared library. Compilation as static is working already. However, I would like to have it as a shared library in view of another project using it (kopano-core).

I am using cygports. The respective cygport file looks like this:

# package name
NAME="gsoap"
VERSION=2.8.84
RELEASE=1

# .hint generation
CATEGORY="Libs"
SUMMARY='Development toolkit for Web Services and XML data bindings for C & C++'
DESCRIPTION='The gSOAP toolkit is an extensive suite of portable C and C++ software to develop XML Web services with powerful type-safe XML data bindings. Easy-to-use code-generator tools allow you to directly integrate XML data in C and C++. Serializes native application data in XML. Includes WSDL/XSD schema binding and auto-coding tools, stub/skeleton compiler, Web server integration with Apache module and IIS extension, high-performance XML processing with schema validation, fast MIME/MTOM streaming, SOAP and REST Web API development, WS-* protocols (WS-Security, WS-Policy, WS-ReliableMessaging, etc), XML-RPC and JSON. Licensed under GPLv2.'

# source and patch files
SRC_URI="https://downloads.sourceforge.net/gsoap2/gsoap_${VERSION}.zip"
PATCH_URI="gethostbyname.patch automake.patch sharedlibs.patch"
SRC_DIR="gsoap-2.8"

export CPPFLAGS="${CPPFLAGS} -D_GNU_SOURCE -Wno-attributes"
export CFLAGS="${CFLAGS} -D_GNU_SOURCE -Wno-attributes"

CYGCONF_ARGS="--disable-static --disable-samples"

MAKEOPTS="-j1"

prepare() {
        cd "${S}"
        cmp gsoap/stdsoap2.cpp gsoap/stdsoap2.c
        ln -fs stdsoap2.cpp gsoap/stdsoap2.c
}

src_compile() {
        cd ${S}
        cygautoreconf
        cd ${B}
        mkdir -p gsoap
        cp "${S}"/gsoap/*.sym "${B}"/gsoap/
        cygconf
        cygmake
}

The patches are:

automake.patch

--- configure.ac
+++ configure.ac
@@ -4,8 +4,7 @@ AM_INIT_AUTOMAKE([foreign])
 AC_CONFIG_SRCDIR([gsoap/stdsoap2.cpp])
 AC_CANONICAL_HOST

-# AC_CONFIG_HEADERS([config.h])
-AM_CONFIG_HEADER(config.h)
+AC_CONFIG_HEADERS([config.h])

 # we use subdirs.
 AC_PROG_MAKE_SET

gethostbyname.patch

--- gsoap/stdsoap2.cpp  2019-06-23 23:02:53.184350000 +0200
+++ gsoap/stdsoap2.cpp  2019-06-23 23:03:14.586754700 +0200
@@ -5101,21 +5101,6 @@
     hostent = NULL;
     soap->errnum = h_errno;
   }
-#elif defined(__GLIBC__) && (!_GNU_SOURCE && !defined(_POSIX_C_SOURCE) && !defined (_XOPEN_SOURCE) && defined(HAVE_GETHOSTBYNAME_R)) || _POSIX_C_SOURCE >= 200112L || _XOPEN_SOURCE >= 600 || defined(__ANDROID__) || (defined(HAVE_GETHOSTBYNAME_R) && (defined(FREEBSD) || defined(__FreeBSD__)))
-  while ((r = gethostbyname_r(addr, hostent, tmpbuf, tmplen, &hostent, &soap->errnum)) < 0)
-  {
-    if (tmpbuf != soap->tmpbuf)
-      SOAP_FREE(soap, tmpbuf);
-    if (r != SOAP_ERANGE)
-    {
-      hostent = NULL;
-      break;
-    }
-    tmplen *= 2;
-    tmpbuf = (char*)SOAP_MALLOC(soap, tmplen);
-    if (!tmpbuf)
-      break;
-  }
 #elif defined(HAVE_GETHOSTBYNAME_R)
   hostent = gethostbyname_r(addr, hostent, tmpbuf, tmplen, &soap->errnum);
 #elif defined(VXWORKS)
--- gsoap/stdsoap2.c    2019-06-23 23:02:47.754685100 +0200
+++ gsoap/stdsoap2.c    2019-06-23 23:03:27.967663300 +0200
@@ -5101,21 +5101,6 @@
     hostent = NULL;
     soap->errnum = h_errno;
   }
-#elif defined(__GLIBC__) && (!_GNU_SOURCE && !defined(_POSIX_C_SOURCE) && !defined (_XOPEN_SOURCE) && defined(HAVE_GETHOSTBYNAME_R)) || _POSIX_C_SOURCE >= 200112L || _XOPEN_SOURCE >= 600 || defined(__ANDROID__) || (defined(HAVE_GETHOSTBYNAME_R) && (defined(FREEBSD) || defined(__FreeBSD__)))
-  while ((r = gethostbyname_r(addr, hostent, tmpbuf, tmplen, &hostent, &soap->errnum)) < 0)
-  {
-    if (tmpbuf != soap->tmpbuf)
-      SOAP_FREE(soap, tmpbuf);
-    if (r != SOAP_ERANGE)
-    {
-      hostent = NULL;
-      break;
-    }
-    tmplen *= 2;
-    tmpbuf = (char*)SOAP_MALLOC(soap, tmplen);
-    if (!tmpbuf)
-      break;
-  }
 #elif defined(HAVE_GETHOSTBYNAME_R)
   hostent = gethostbyname_r(addr, hostent, tmpbuf, tmplen, &soap->errnum);
 #elif defined(VXWORKS)
--- gsoap/src/symbol2.c 2019-06-23 23:20:34.866989800 +0200
+++ gsoap/src/symbol2.c 2019-06-23 23:19:29.828384800 +0200
@@ -37,7 +37,7 @@
 #include "soapcpp2.h"

 #ifdef HAVE_CONFIG_H
-#include "soapcpp2_yacc.h"
+#include "soapcpp2_yacc.tab.h"
 #else
 #include "soapcpp2_yacc.tab.h"
 #endif

sharedlibs.patch

--- configure.ac
+++ configure.ac
@@ -15,8 +15,8 @@ AM_PROG_CC_C_O
 AM_PROG_LEX
 AC_PROG_YACC
 AC_PROG_CPP
-AC_PROG_RANLIB
-#AM_PROG_LIBTOOL
+m4_ifdef([AM_PROG_AR], [AM_PROG_AR])
+LT_INIT([dlopen win32-dll disable-static])
 AC_PROG_LN_S
 AC_PROG_AWK
 AC_PROG_INSTALL
@@ -294,7 +294,7 @@ if test "x$with_openssl" = "xyes"; then
     WSDL2H_EXTRA_LIBS="${WSDL2H_EXTRA_LIBS} -lgnutls -lgcrypt -lgpg-error -lz"
     SAMPLE_INCLUDES=
     SAMPLE_SSL_LIBS="-lgnutls -lgcrypt -lgpg-error -lz"
-    WSDL2H_SOAP_CPP_LIB="libgsoapssl++.a"
+    WSDL2H_SOAP_CPP_LIB="libgsoapssl++.la"
   else
     AC_MSG_RESULT(no)
     WSDL2H_EXTRA_FLAGS="-DWITH_OPENSSL -DWITH_GZIP"
@@ -302,7 +302,7 @@ if test "x$with_openssl" = "xyes"; then
     WSDL2H_EXTRA_LIBS="${WSDL2H_EXTRA_LIBS} -lssl -lcrypto -lz"
     SAMPLE_INCLUDES=
     SAMPLE_SSL_LIBS="-lssl -lcrypto -lz"
-    WSDL2H_SOAP_CPP_LIB="libgsoapssl++.a"
+    WSDL2H_SOAP_CPP_LIB="libgsoapssl++.la"
   fi
   if test -n "$ZLIB"; then
     WSDL2H_EXTRA_FLAGS="-I${ZLIB}/include ${WSDL2H_EXTRA_FLAGS}"
@@ -321,7 +321,7 @@ else
   WSDL2H_EXTRA_FLAGS=
   SAMPLE_SSL_LIBS=
   SAMPLE_INCLUDES=
-  WSDL2H_SOAP_CPP_LIB="libgsoap++.a"
+  WSDL2H_SOAP_CPP_LIB="libgsoap++.la"
 fi
 AM_CONDITIONAL(WITH_OPENSSL, test "x$with_openssl" = "xyes" -a "x$with_gnutls" != "xyes")
 AC_SUBST(WITH_OPENSSL)
--- gsoap/Makefile.am
+++ gsoap/Makefile.am
@@ -34,20 +34,34 @@ stdsoap2_ssl_cpp.cpp: stdsoap2.cpp
 dom_cpp.cpp: dom.cpp
        $(LN_S) -f $(top_srcdir)/gsoap/dom.cpp dom_cpp.cpp

-lib_LIBRARIES = libgsoap.a libgsoap++.a libgsoapck.a libgsoapck++.a libgsoapssl.a libgsoapssl++.a
+lib_LTLIBRARIES = libgsoap.la libgsoap++.la libgsoapck.la libgsoapck++.la libgsoapssl.la libgsoapssl++.la

-libgsoap_a_SOURCES = stdsoap2.c dom.c
-libgsoap_a_CFLAGS = $(SOAPCPP2_DEBUG) $(SOAPCPP2_NONAMESPACES) $(SOAPCPP2_NO_C_LOCALE) $(SOAPCPP2_IPV6) $(SOAPCPP2_IPV6_V6ONLY) -D$(platform)
-libgsoap___a_SOURCES = stdsoap2_cpp.cpp dom_cpp.cpp
-libgsoap___a_CXXFLAGS = $(SOAPCPP2_DEBUG) $(SOAPCPP2_NONAMESPACES) $(SOAPCPP2_NO_C_LOCALE) $(SOAPCPP2_IPV6) $(SOAPCPP2_IPV6_V6ONLY) -D$(platform)
-libgsoapck_a_SOURCES = stdsoap2_ck.c dom.c
-libgsoapck_a_CFLAGS = $(SOAPCPP2_DEBUG) $(SOAPCPP2_NONAMESPACES) $(SOAPCPP2_NO_C_LOCALE) $(SOAPCPP2_IPV6) $(SOAPCPP2_IPV6_V6ONLY) -D$(platform) -DWITH_COOKIES
-libgsoapck___a_SOURCES = stdsoap2_ck_cpp.cpp dom_cpp.cpp
-libgsoapck___a_CXXFLAGS = $(SOAPCPP2_DEBUG) $(SOAPCPP2_NONAMESPACES) $(SOAPCPP2_NO_C_LOCALE) $(SOAPCPP2_IPV6) $(SOAPCPP2_IPV6_V6ONLY) -D$(platform) -DWITH_COOKIES
-libgsoapssl_a_SOURCES = stdsoap2_ssl.c dom.c
-libgsoapssl_a_CFLAGS = $(SOAPCPP2_DEBUG) $(SOAPCPP2_NONAMESPACES) $(SOAPCPP2_NO_C_LOCALE) $(SOAPCPP2_IPV6) $(SOAPCPP2_IPV6_V6ONLY) -D$(platform) $(WSDL2H_EXTRA_FLAGS) -DWITH_DOM -DWITH_COOKIES
-libgsoapssl___a_SOURCES = stdsoap2_ssl_cpp.cpp dom_cpp.cpp
-libgsoapssl___a_CXXFLAGS = $(SOAPCPP2_DEBUG) $(SOAPCPP2_NONAMESPACES) $(SOAPCPP2_NO_C_LOCALE) $(SOAPCPP2_IPV6) $(SOAPCPP2_IPV6_V6ONLY) -D$(platform) $(WSDL2H_EXTRA_FLAGS) -DWITH_DOM -DWITH_COOKIES
+libgsoap_la_SOURCES = stdsoap2.c dom.c
+libgsoap_la_CFLAGS = $(SOAPCPP2_DEBUG) $(SOAPCPP2_NONAMESPACES) $(SOAPCPP2_NO_C_LOCALE) $(SOAPCPP2_IPV6) $(SOAPCPP2_IPV6_V6ONLY) -D$(platform)
+libgsoap___la_SOURCES = stdsoap2_cpp.cpp dom_cpp.cpp
+libgsoap___la_CXXFLAGS = $(SOAPCPP2_DEBUG) $(SOAPCPP2_NONAMESPACES) $(SOAPCPP2_NO_C_LOCALE) $(SOAPCPP2_IPV6) $(SOAPCPP2_IPV6_V6ONLY) -D$(platform)
+libgsoapck_la_SOURCES = stdsoap2_ck.c dom.c
+libgsoapck_la_CFLAGS = $(SOAPCPP2_DEBUG) $(SOAPCPP2_NONAMESPACES) $(SOAPCPP2_NO_C_LOCALE) $(SOAPCPP2_IPV6) $(SOAPCPP2_IPV6_V6ONLY) -D$(platform) -DWITH_COOKIES
+libgsoapck___la_SOURCES = stdsoap2_ck_cpp.cpp dom_cpp.cpp
+libgsoapck___la_CXXFLAGS = $(SOAPCPP2_DEBUG) $(SOAPCPP2_NONAMESPACES) $(SOAPCPP2_NO_C_LOCALE) $(SOAPCPP2_IPV6) $(SOAPCPP2_IPV6_V6ONLY) -D$(platform) -DWITH_COOKIES
+libgsoapssl_la_SOURCES = stdsoap2_ssl.c dom.c
+libgsoapssl_la_CFLAGS = $(SOAPCPP2_DEBUG) $(SOAPCPP2_NONAMESPACES) $(SOAPCPP2_NO_C_LOCALE) $(SOAPCPP2_IPV6) $(SOAPCPP2_IPV6_V6ONLY) -D$(platform) $(WSDL2H_EXTRA_FLAGS) -DWITH_DOM -DWITH_COOKIES
+libgsoapssl___la_SOURCES = stdsoap2_ssl_cpp.cpp dom_cpp.cpp
+libgsoapssl___la_CXXFLAGS = $(SOAPCPP2_DEBUG) $(SOAPCPP2_NONAMESPACES) $(SOAPCPP2_NO_C_LOCALE) $(SOAPCPP2_IPV6) $(SOAPCPP2_IPV6_V6ONLY) -D$(platform) $(WSDL2H_EXTRA_FLAGS) -DWITH_DOM -DWITH_COOKIES
+libgsoap_la_LDFLAGS = -release ${PACKAGE_VERSION} -Wl,--version-script=gsoap.sym -no-undefined -module
+libgsoap___la_LDFLAGS = -release ${PACKAGE_VERSION} -Wl,--version-script=gsoap++.sym -no-undefined -module
+libgsoapck_la_LDFLAGS = -release ${PACKAGE_VERSION} -Wl,--version-script=gsoapck.sym -no-undefined -module
+libgsoapck___la_LDFLAGS = -release ${PACKAGE_VERSION} -Wl,--version-script=gsoapck++.sym -no-undefined -module
+libgsoapssl_la_LDFLAGS = -release ${PACKAGE_VERSION} -Wl,--version-script=gsoapssl.sym -no-undfined -module
+libgsoapssl_la_LIBADD = ${SAMPLE_SSL_LIBS}
+libgsoapssl___la_LDFLAGS = -release ${PACKAGE_VERSION} -Wl,--version-script=gsoapssl++.sym -no-undefined -module
+libgsoapssl___la_LIBADD = ${libgsoapssl_la_LIBADD}
+EXTRA_libgsoap_la_DEPENDENCIES = gsoap.sym
+EXTRA_libgsoap___la_DEPENDENCIES = gsoap++.sym
+EXTRA_libgsoapck_la_DEPENDENCIES = gsoapck.sym
+EXTRA_libgsoapck___la_DEPENDENCIES = gsoapck++.sym
+EXTRA_libgsoapssl_la_DEPENDENCIES = gsoapssl.sym
+EXTRA_libgsoapssl___la_DEPENDENCIES = gsoapssl++.sym

 BUILT_SOURCES = stdsoap2_cpp.cpp dom_cpp.cpp stdsoap2_ck.c stdsoap2_ck_cpp.cpp stdsoap2_ssl.c stdsoap2_ssl_cpp.cpp

--- /dev/null
+++ gsoap/gsoap++.sym
@@ -0,0 +1 @@
+GSOAPXX { global: *; };
--- /dev/null
+++ gsoap/gsoap.sym
@@ -0,0 +1 @@
+GSOAP { global: *; };
--- /dev/null
+++ gsoap/gsoapck++.sym
@@ -0,0 +1 @@
+GSOAPCKXX { global: *; };
--- /dev/null
+++ gsoap/gsoapck.sym
@@ -0,0 +1 @@
+GSOAPCK { global: *; };
--- /dev/null
+++ gsoap/gsoapckssl++.sym
@@ -0,0 +1 @@
+GSOAPCKSSLXX { global: *; };
--- /dev/null
+++ gsoap/gsoapckssl.sym
@@ -0,0 +1 @@
+GSOAPCKSSL { global: *; };
--- /dev/null
+++ gsoap/gsoapssl++.sym
@@ -0,0 +1 @@
+GSOAPSSLXX { global: *; };
--- /dev/null
+++ gsoap/gsoapssl.sym
@@ -0,0 +1 @@
+GSOAPSSL { global: *; };

The idea is based on the opensuse package:

https://build.opensuse.org/package/show/openSUSE:Factory/gsoap

This package also compiles to a (so) shared library.

In addition to the changes taken from this package, I have added: -no-defined -module

to the respective LDFLAGS sections in the patch. Cygwin gcc needs this.

Furthermore, I have amended LT_INIT in configure.ac to match Cygwin.

When I ty to compile the package (cygport gsoap.cygport fetch && cygport gsoap.cygport all), it fails with this message:

make  all-recursive
make[1]: Entering directory '/home/gsoap-shared/gsoap-2.8.84-1.x86_64/build'
Making all in .
make[2]: Entering directory '/home/gsoap-shared/gsoap-2.8.84-1.x86_64/build'
make[2]: Leaving directory '/home/gsoap-shared/gsoap-2.8.84-1.x86_64/build'
Making all in gsoap
make[2]: Entering directory '/home/gsoap-shared/gsoap-2.8.84-1.x86_64/build/gsoap'
ln -s -f /home/gsoap-shared/gsoap-2.8.84-1.x86_64/src/gsoap-2.8/gsoap/stdsoap2.cpp stdsoap2_cpp.cpp
ln -s -f /home/gsoap-shared/gsoap-2.8.84-1.x86_64/src/gsoap-2.8/gsoap/dom.cpp dom_cpp.cpp
ln -s -f /home/gsoap-shared/gsoap-2.8.84-1.x86_64/src/gsoap-2.8/gsoap/stdsoap2.cpp stdsoap2_ck.c
ln -s -f /home/gsoap-shared/gsoap-2.8.84-1.x86_64/src/gsoap-2.8/gsoap/stdsoap2.cpp stdsoap2_ck_cpp.cpp
ln -s -f /home/gsoap-shared/gsoap-2.8.84-1.x86_64/src/gsoap-2.8/gsoap/stdsoap2.cpp stdsoap2_ssl.c
ln -s -f /home/gsoap-shared/gsoap-2.8.84-1.x86_64/src/gsoap-2.8/gsoap/stdsoap2.cpp stdsoap2_ssl_cpp.cpp
make  all-recursive
make[3]: Entering directory '/home/gsoap-shared/gsoap-2.8.84-1.x86_64/build/gsoap'
Making all in .
make[4]: Entering directory '/home/gsoap-shared/gsoap-2.8.84-1.x86_64/build/gsoap'
/bin/sh ../libtool  --tag=CC   --mode=compile gcc -DHAVE_CONFIG_H -I. -I/home/gsoap-shared/gsoap-2.8.84-1.x86_64/src/gsoap-2.8/gsoap -I..   -D_GNU_SOURCE -Wno-attributes      -DCYGWIN -ggdb -O2 -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -fstack-protector-strong --param=ssp-buffer-size=4 -D_GNU_SOURCE -Wno-attributes -fdebug-prefix-map=/home/gsoap-shared/gsoap-2.8.84-1.x86_64/build=/usr/src/debug/gsoap-2.8.84-1 -fdebug-prefix-map=/home/gsoap-shared/gsoap-2.8.84-1.x86_64/src/gsoap-2.8=/usr/src/debug/gsoap-2.8.84-1 -MT libgsoap_la-stdsoap2.lo -MD -MP -MF .deps/libgsoap_la-stdsoap2.Tpo -c -o libgsoap_la-stdsoap2.lo `test -f 'stdsoap2.c' || echo '/home/gsoap-shared/gsoap-2.8.84-1.x86_64/src/gsoap-2.8/gsoap/'`stdsoap2.c
libtool: compile:  gcc -DHAVE_CONFIG_H -I. -I/home/gsoap-shared/gsoap-2.8.84-1.x86_64/src/gsoap-2.8/gsoap -I.. -D_GNU_SOURCE -Wno-attributes -DCYGWIN -ggdb -O2 -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -fstack-protector-strong --param=ssp-buffer-size=4 -D_GNU_SOURCE -Wno-attributes -fdebug-prefix-map=/home/gsoap-shared/gsoap-2.8.84-1.x86_64/build=/usr/src/debug/gsoap-2.8.84-1 -fdebug-prefix-map=/home/gsoap-shared/gsoap-2.8.84-1.x86_64/src/gsoap-2.8=/usr/src/debug/gsoap-2.8.84-1 -MT libgsoap_la-stdsoap2.lo -MD -MP -MF .deps/libgsoap_la-stdsoap2.Tpo -c /home/gsoap-shared/gsoap-2.8.84-1.x86_64/src/gsoap-2.8/gsoap/stdsoap2.c  -DDLL_EXPORT -DPIC -o .libs/libgsoap_la-stdsoap2.o
/home/gsoap-shared/gsoap-2.8.84-1.x86_64/src/gsoap-2.8/gsoap/stdsoap2.c: In function 'tcp_gethostbyname':
/home/gsoap-shared/gsoap-2.8.84-1.x86_64/src/gsoap-2.8/gsoap/stdsoap2.c:5074:10: warning: unused variable 'tmplen' [-Wunused-variable]
   size_t tmplen = sizeof(soap->tmpbuf);
          ^~~~~~
/home/gsoap-shared/gsoap-2.8.84-1.x86_64/src/gsoap-2.8/gsoap/stdsoap2.c:5073:9: warning: unused variable 'tmpbuf' [-Wunused-variable]
   char *tmpbuf = soap->tmpbuf;
         ^~~~~~
/home/gsoap-shared/gsoap-2.8.84-1.x86_64/src/gsoap-2.8/gsoap/stdsoap2.c:5072:7: warning: unused variable 'r' [-Wunused-variable]
   int r;
       ^
/home/gsoap-shared/gsoap-2.8.84-1.x86_64/src/gsoap-2.8/gsoap/stdsoap2.c: In function 'soap_strerror':
/home/gsoap-shared/gsoap-2.8.84-1.x86_64/src/gsoap-2.8/gsoap/stdsoap2.c:22334:9: warning: assignment makes integer from pointer without a cast [-Wint-conversion]
     err = strerror_r(err, soap->msgbuf, sizeof(soap->msgbuf)); /* XSI-compliant */
         ^
mv -f .deps/libgsoap_la-stdsoap2.Tpo .deps/libgsoap_la-stdsoap2.Plo
/bin/sh ../libtool  --tag=CC   --mode=compile gcc -DHAVE_CONFIG_H -I. -I/home/gsoap-shared/gsoap-2.8.84-1.x86_64/src/gsoap-2.8/gsoap -I..   -D_GNU_SOURCE -Wno-attributes      -DCYGWIN -ggdb -O2 -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -fstack-protector-strong --param=ssp-buffer-size=4 -D_GNU_SOURCE -Wno-attributes -fdebug-prefix-map=/home/gsoap-shared/gsoap-2.8.84-1.x86_64/build=/usr/src/debug/gsoap-2.8.84-1 -fdebug-prefix-map=/home/gsoap-shared/gsoap-2.8.84-1.x86_64/src/gsoap-2.8=/usr/src/debug/gsoap-2.8.84-1 -MT libgsoap_la-dom.lo -MD -MP -MF .deps/libgsoap_la-dom.Tpo -c -o libgsoap_la-dom.lo `test -f 'dom.c' || echo '/home/gsoap-shared/gsoap-2.8.84-1.x86_64/src/gsoap-2.8/gsoap/'`dom.c
libtool: compile:  gcc -DHAVE_CONFIG_H -I. -I/home/gsoap-shared/gsoap-2.8.84-1.x86_64/src/gsoap-2.8/gsoap -I.. -D_GNU_SOURCE -Wno-attributes -DCYGWIN -ggdb -O2 -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -fstack-protector-strong --param=ssp-buffer-size=4 -D_GNU_SOURCE -Wno-attributes -fdebug-prefix-map=/home/gsoap-shared/gsoap-2.8.84-1.x86_64/build=/usr/src/debug/gsoap-2.8.84-1 -fdebug-prefix-map=/home/gsoap-shared/gsoap-2.8.84-1.x86_64/src/gsoap-2.8=/usr/src/debug/gsoap-2.8.84-1 -MT libgsoap_la-dom.lo -MD -MP -MF .deps/libgsoap_la-dom.Tpo -c /home/gsoap-shared/gsoap-2.8.84-1.x86_64/src/gsoap-2.8/gsoap/dom.c  -DDLL_EXPORT -DPIC -o .libs/libgsoap_la-dom.o
mv -f .deps/libgsoap_la-dom.Tpo .deps/libgsoap_la-dom.Plo
/bin/sh ../libtool  --tag=CC   --mode=link gcc      -DCYGWIN -ggdb -O2 -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -fstack-protector-strong --param=ssp-buffer-size=4 -D_GNU_SOURCE -Wno-attributes -fdebug-prefix-map=/home/gsoap-shared/gsoap-2.8.84-1.x86_64/build=/usr/src/debug/gsoap-2.8.84-1 -fdebug-prefix-map=/home/gsoap-shared/gsoap-2.8.84-1.x86_64/src/gsoap-2.8=/usr/src/debug/gsoap-2.8.84-1 -release 2.8.84 -Wl,--version-script=gsoap.sym -no-undefined -module  -o libgsoap.la -rpath /usr/lib libgsoap_la-stdsoap2.lo libgsoap_la-dom.lo
libtool: link: gcc -shared  .libs/libgsoap_la-stdsoap2.o .libs/libgsoap_la-dom.o    -ggdb -O2 -fstack-protector-strong -Wl,--version-script=gsoap.sym   -o .libs/cyggsoap-2-8-84.dll -Wl,--enable-auto-image-base -Xlinker --out-implib -Xlinker .libs/libgsoap.dll.a
.libs/libgsoap_la-stdsoap2.o: In function `soap_set_error':
/usr/src/debug/gsoap-2.8.84-1/gsoap/stdsoap2.c:22420: undefined reference to `soap_faultcode'
/usr/src/debug/gsoap-2.8.84-1/gsoap/stdsoap2.c:22420:(.text+0x648): relocation truncated to fit: R_X86_64_PC32 against undefined symbol `soap_faultcode'
/usr/src/debug/gsoap-2.8.84-1/gsoap/stdsoap2.c:22422: undefined reference to `soap_faultsubcode'
/usr/src/debug/gsoap-2.8.84-1/gsoap/stdsoap2.c:22422:(.text+0x658): relocation truncated to fit: R_X86_64_PC32 against undefined symbol `soap_faultsubcode'
/usr/src/debug/gsoap-2.8.84-1/gsoap/stdsoap2.c:22423: undefined reference to `soap_faultstring'
/usr/src/debug/gsoap-2.8.84-1/gsoap/stdsoap2.c:22423:(.text+0x663): relocation truncated to fit: R_X86_64_PC32 against undefined symbol `soap_faultstring'
/usr/src/debug/gsoap-2.8.84-1/gsoap/stdsoap2.c:22426: undefined reference to `soap_faultdetail'
/usr/src/debug/gsoap-2.8.84-1/gsoap/stdsoap2.c:22426:(.text+0x694): relocation truncated to fit: R_X86_64_PC32 against undefined symbol `soap_faultdetail'
.libs/libgsoap_la-stdsoap2.o: In function `soap_recv_header':
/usr/src/debug/gsoap-2.8.84-1/gsoap/stdsoap2.c:21004: undefined reference to `soap_getheader'
/usr/src/debug/gsoap-2.8.84-1/gsoap/stdsoap2.c:21004:(.text+0x19ef9): relocation truncated to fit: R_X86_64_PC32 against undefined symbol `soap_getheader'
.libs/libgsoap_la-stdsoap2.o: In function `http_response':
/usr/src/debug/gsoap-2.8.84-1/gsoap/stdsoap2.c:8196: undefined reference to `soap_faultcode'
/usr/src/debug/gsoap-2.8.84-1/gsoap/stdsoap2.c:8196:(.text+0x1b524): relocation truncated to fit: R_X86_64_PC32 against undefined symbol `soap_faultcode'
.libs/libgsoap_la-stdsoap2.o: In function `soap_set_fault':
/usr/src/debug/gsoap-2.8.84-1/gsoap/stdsoap2.c:21820: undefined reference to `soap_faultcode'
/usr/src/debug/gsoap-2.8.84-1/gsoap/stdsoap2.c:21820:(.text+0x1bb69): relocation truncated to fit: R_X86_64_PC32 against undefined symbol `soap_faultcode'
/usr/src/debug/gsoap-2.8.84-1/gsoap/stdsoap2.c:21821: undefined reference to `soap_faultstring'
/usr/src/debug/gsoap-2.8.84-1/gsoap/stdsoap2.c:21821:(.text+0x1bb74): relocation truncated to fit: R_X86_64_PC32 against undefined symbol `soap_faultstring'
/usr/src/debug/gsoap-2.8.84-1/gsoap/stdsoap2.c:21930: undefined reference to `soap_faultsubcode'
/usr/src/debug/gsoap-2.8.84-1/gsoap/stdsoap2.c:21930:(.text+0x1c225): relocation truncated to fit: R_X86_64_PC32 against undefined symbol `soap_faultsubcode'
/usr/src/debug/gsoap-2.8.84-1/gsoap/stdsoap2.c:21935: undefined reference to `soap_faultsubcode'
/usr/src/debug/gsoap-2.8.84-1/gsoap/stdsoap2.c:21935:(.text+0x1c260): relocation truncated to fit: R_X86_64_PC32 against undefined symbol `soap_faultsubcode'
.libs/libgsoap_la-stdsoap2.o: In function `soap_recv_fault':
/usr/src/debug/gsoap-2.8.84-1/gsoap/stdsoap2.c:22210: undefined reference to `soap_getfault'
/usr/src/debug/gsoap-2.8.84-1/gsoap/stdsoap2.c:22210:(.text+0x1c520): additional relocation overflows omitted from the output
/usr/src/debug/gsoap-2.8.84-1/gsoap/stdsoap2.c:22210: undefined reference to `soap_getfault'
/usr/src/debug/gsoap-2.8.84-1/gsoap/stdsoap2.c:22224: undefined reference to `soap_faultcode'
/usr/src/debug/gsoap-2.8.84-1/gsoap/stdsoap2.c:22233: undefined reference to `soap_faultcode'
/usr/src/debug/gsoap-2.8.84-1/gsoap/stdsoap2.c:22192: undefined reference to `soap_faultstring'
/usr/src/debug/gsoap-2.8.84-1/gsoap/stdsoap2.c:22193: undefined reference to `soap_faultdetail'
.libs/libgsoap_la-stdsoap2.o: In function `soap_send_fault':
/usr/src/debug/gsoap-2.8.84-1/gsoap/stdsoap2.c:22118: undefined reference to `soap_serializeheader'
/usr/src/debug/gsoap-2.8.84-1/gsoap/stdsoap2.c:22119: undefined reference to `soap_serializefault'
/usr/src/debug/gsoap-2.8.84-1/gsoap/stdsoap2.c:22124: undefined reference to `soap_putheader'
/usr/src/debug/gsoap-2.8.84-1/gsoap/stdsoap2.c:22126: undefined reference to `soap_putfault'
/usr/src/debug/gsoap-2.8.84-1/gsoap/stdsoap2.c:22134: undefined reference to `soap_putheader'
/usr/src/debug/gsoap-2.8.84-1/gsoap/stdsoap2.c:22136: undefined reference to `soap_putfault'
/usr/src/debug/gsoap-2.8.84-1/gsoap/stdsoap2.c:22144: undefined reference to `soap_faultstring'
/usr/src/debug/gsoap-2.8.84-1/gsoap/stdsoap2.c:22145: undefined reference to `soap_faultdetail'
.libs/libgsoap_la-stdsoap2.o: In function `soap_print_fault':
/usr/src/debug/gsoap-2.8.84-1/gsoap/stdsoap2.c:22524: undefined reference to `soap_faultcode'
/usr/src/debug/gsoap-2.8.84-1/gsoap/stdsoap2.c:22532: undefined reference to `soap_fault_string'
/usr/src/debug/gsoap-2.8.84-1/gsoap/stdsoap2.c:22533: undefined reference to `soap_fault_detail'
/usr/src/debug/gsoap-2.8.84-1/gsoap/stdsoap2.c:22531: undefined reference to `soap_fault_subcode'
/usr/src/debug/gsoap-2.8.84-1/gsoap/stdsoap2.c:22528: undefined reference to `soap_faultcode'
.libs/libgsoap_la-stdsoap2.o: In function `soap_sprint_fault':
/usr/src/debug/gsoap-2.8.84-1/gsoap/stdsoap2.c:22599: undefined reference to `soap_faultcode'
/usr/src/debug/gsoap-2.8.84-1/gsoap/stdsoap2.c:22609: undefined reference to `soap_fault_string'
/usr/src/debug/gsoap-2.8.84-1/gsoap/stdsoap2.c:22612: undefined reference to `soap_fault_detail'
/usr/src/debug/gsoap-2.8.84-1/gsoap/stdsoap2.c:22606: undefined reference to `soap_fault_subcode'
/usr/src/debug/gsoap-2.8.84-1/gsoap/stdsoap2.c:22603: undefined reference to `soap_faultcode'
.libs/libgsoap_la-stdsoap2.o:stdsoap2.c:(.rdata$.refptr.namespaces[.refptr.namespaces]+0x0): undefined reference to `namespaces'
.libs/libgsoap_la-dom.o: In function `out_element':
/usr/src/debug/gsoap-2.8.84-1/gsoap/dom.c:274: undefined reference to `soap_putelement'
/usr/src/debug/gsoap-2.8.84-1/gsoap/dom.c:274: undefined reference to `soap_putelement'
.libs/libgsoap_la-dom.o: In function `soap_in_xsd__anyType':
/usr/src/debug/gsoap-2.8.84-1/gsoap/dom.c:652: undefined reference to `soap_getelement'
.libs/libgsoap_la-dom.o: In function `soap_dup_xsd__anyType':
/usr/src/debug/gsoap-2.8.84-1/gsoap/dom.c:826: undefined reference to `soap_dupelement'
.libs/libgsoap_la-dom.o: In function `soap_del_xsd__anyType':
/usr/src/debug/gsoap-2.8.84-1/gsoap/dom.c:869: undefined reference to `soap_delelement'
.libs/libgsoap_la-dom.o: In function `soap_serialize_xsd__anyType':
/usr/src/debug/gsoap-2.8.84-1/gsoap/dom.c:157: undefined reference to `soap_markelement'
collect2: error: ld returned 1 exit status
make[4]: *** [Makefile:574: libgsoap.la] Error 1
make[4]: Leaving directory '/home/gsoap-shared/gsoap-2.8.84-1.x86_64/build/gsoap'
make[3]: *** [Makefile:797: all-recursive] Error 1
make[3]: Leaving directory '/home/gsoap-shared/gsoap-2.8.84-1.x86_64/build/gsoap'
make[2]: *** [Makefile:501: all] Error 2
make[2]: Leaving directory '/home/gsoap-shared/gsoap-2.8.84-1.x86_64/build/gsoap'
make[1]: *** [Makefile:503: all-recursive] Error 1
make[1]: Leaving directory '/home/gsoap-shared/gsoap-2.8.84-1.x86_64/build'
make: *** [Makefile:402: all] Error 2

However, the symbols seem to be there:

objdump.exe -x gsoap/.libs/libgsoap_la-stdsoap2.o | grep soap_faultcode
[449](sec  0)(fl 0x00)(ty  20)(scl   2) (nx 0) 0x0000000000000000 soap_faultcode
0000000000000648 R_X86_64_PC32     soap_faultcode
000000000001b524 R_X86_64_PC32     soap_faultcode
000000000001bb69 R_X86_64_PC32     soap_faultcode
000000000001c5b5 R_X86_64_PC32     soap_faultcode
000000000001c5f4 R_X86_64_PC32     soap_faultcode
000000000001e5d1 R_X86_64_PC32     soap_faultcode
000000000001e69c R_X86_64_PC32     soap_faultcode
000000000001e723 R_X86_64_PC32     soap_faultcode
000000000001e7fc R_X86_64_PC32     soap_faultcode

Any idea what went wrong?

I would expect the package to built. However, there seems to be something messed up.

I have tinkered a bit more and found out about the -mcmodel=large compiler option. However, this gives me:

make  all-recursive
make[1]: Entering directory '/home/gsoap-shared/gsoap-2.8.84-1.x86_64/build/gsoap'
Making all in .
make[2]: Entering directory '/home/gsoap-shared/gsoap-2.8.84-1.x86_64/build/gsoap'
/bin/sh ../libtool  --tag=CC   --mode=link gcc      -mcmodel=large -maddress-mode=long -DCYGWIN -ggdb -O2 -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -fstack-protector-strong --param=ssp-buffer-size=4 -D_GNU_SOURCE -Wno-attributes -fdebug-prefix-map=/home/gsoap-shared/gsoap-2.8.84-1.x86_64/build=/usr/src/debug/gsoap-2.8.84-1 -fdebug-prefix-map=/home/gsoap-shared/gsoap-2.8.84-1.x86_64/src/gsoap-2.8=/usr/src/debug/gsoap-2.8.84-1 -release 2.8.84 -Wl,--version-script=gsoap.sym -no-undefined     -o libgsoap.la -rpath /usr/lib libgsoap_la-stdsoap2.lo libgsoap_la-dom.lo
libtool: link: rm -fr  .libs/libgsoap.dll.a
libtool: link: gcc -shared  .libs/libgsoap_la-stdsoap2.o .libs/libgsoap_la-dom.o    -mcmodel=large -maddress-mode=long -ggdb -O2 -fstack-protector-strong -Wl,--version-script=gsoap.sym   -o .libs/cyggsoap-2-8-84.dll -Wl,--enable-auto-image-base -Xlinker --out-implib -Xlinker .libs/libgsoap.dll.a
.libs/libgsoap_la-stdsoap2.o:stdsoap2.c:(.rdata$.refptr.soap_fault_detail[.refptr.soap_fault_detail]+0x0): undefined reference to `soap_fault_detail'
.libs/libgsoap_la-stdsoap2.o:stdsoap2.c:(.rdata$.refptr.soap_fault_string[.refptr.soap_fault_string]+0x0): undefined reference to `soap_fault_string'
.libs/libgsoap_la-stdsoap2.o:stdsoap2.c:(.rdata$.refptr.soap_fault_subcode[.refptr.soap_fault_subcode]+0x0): undefined reference to `soap_fault_subcode'
.libs/libgsoap_la-stdsoap2.o:stdsoap2.c:(.rdata$.refptr.soap_putfault[.refptr.soap_putfault]+0x0): undefined reference to `soap_putfault'
.libs/libgsoap_la-stdsoap2.o:stdsoap2.c:(.rdata$.refptr.soap_putheader[.refptr.soap_putheader]+0x0): undefined reference to `soap_putheader'
.libs/libgsoap_la-stdsoap2.o:stdsoap2.c:(.rdata$.refptr.soap_serializefault[.refptr.soap_serializefault]+0x0): undefined reference to `soap_serializefault'
.libs/libgsoap_la-stdsoap2.o:stdsoap2.c:(.rdata$.refptr.soap_serializeheader[.refptr.soap_serializeheader]+0x0): undefined reference to `soap_serializeheader'
.libs/libgsoap_la-stdsoap2.o:stdsoap2.c:(.rdata$.refptr.soap_getfault[.refptr.soap_getfault]+0x0): undefined reference to `soap_getfault'
.libs/libgsoap_la-stdsoap2.o:stdsoap2.c:(.rdata$.refptr.soap_getheader[.refptr.soap_getheader]+0x0): undefined reference to `soap_getheader'
.libs/libgsoap_la-stdsoap2.o:stdsoap2.c:(.rdata$.refptr.namespaces[.refptr.namespaces]+0x0): undefined reference to `namespaces'
.libs/libgsoap_la-stdsoap2.o:stdsoap2.c:(.rdata$.refptr.soap_faultdetail[.refptr.soap_faultdetail]+0x0): undefined reference to `soap_faultdetail'
.libs/libgsoap_la-stdsoap2.o:stdsoap2.c:(.rdata$.refptr.soap_faultstring[.refptr.soap_faultstring]+0x0): undefined reference to `soap_faultstring'
.libs/libgsoap_la-stdsoap2.o:stdsoap2.c:(.rdata$.refptr.soap_faultsubcode[.refptr.soap_faultsubcode]+0x0): undefined reference to `soap_faultsubcode'
.libs/libgsoap_la-stdsoap2.o:stdsoap2.c:(.rdata$.refptr.soap_faultcode[.refptr.soap_faultcode]+0x0): undefined reference to `soap_faultcode'
.libs/libgsoap_la-dom.o:dom.c:(.rdata$.refptr.soap_delelement[.refptr.soap_delelement]+0x0): undefined reference to `soap_delelement'
.libs/libgsoap_la-dom.o:dom.c:(.rdata$.refptr.soap_dupelement[.refptr.soap_dupelement]+0x0): undefined reference to `soap_dupelement'
.libs/libgsoap_la-dom.o:dom.c:(.rdata$.refptr.soap_getelement[.refptr.soap_getelement]+0x0): undefined reference to `soap_getelement'
.libs/libgsoap_la-dom.o:dom.c:(.rdata$.refptr.soap_putelement[.refptr.soap_putelement]+0x0): undefined reference to `soap_putelement'
.libs/libgsoap_la-dom.o:dom.c:(.rdata$.refptr.soap_markelement[.refptr.soap_markelement]+0x0): undefined reference to `soap_markelement'
collect2: error: ld returned 1 exit status
make[2]: *** [Makefile:574: libgsoap.la] Error 1
make[2]: Leaving directory '/home/gsoap-shared/gsoap-2.8.84-1.x86_64/build/gsoap'
make[1]: *** [Makefile:797: all-recursive] Error 1
make[1]: Leaving directory '/home/gsoap-shared/gsoap-2.8.84-1.x86_64/build/gsoap'
make: *** [Makefile:501: all] Error 2
0
0

For the gethostbyname_r patch, I recommend downloading 2.8.86 and apply this change (2x):

#elif (!defined(__GLIBC__) || (!_GNU_SOURCE && !defined(_POSIX_C_SOURCE) && !defined(_XOPEN_SOURCE)) || _POSIX_C_SOURCE >= 200112L || _XOPEN_SOURCE >= 600 || defined(__ANDROID__) || defined(FREEBSD) || defined(__FreeBSD__)) && defined(HAVE_GETHOSTBYNAME_R)

and this (2x):

#if (!defined(__GLIBC__) || (!_GNU_SOURCE && !defined(_POSIX_C_SOURCE) && !defined(_XOPEN_SOURCE)) || _POSIX_C_SOURCE >= 200112L || _XOPEN_SOURCE >= 600 || defined(__ANDROID__) || defined(FREEBSD) || defined(__FreeBSD__)) && defined(HAVE_GETHOSTBYNAME_R)

Both applied (i.e. 4 changes) in tcp_connect().

The soap_faultcode and other functions are not defined in stdsoap2.c but are referenced in stdsoap2.c and should be linked with the soapcpp2-generated code e.g. soapC.c that define these functions. These functions depend on the way SOAP_ENV__Fault struct is declared (in the .h file for soapcpp2) and therefore these functions cannot be integrated and fixed in the stdsoap2.c library since the struct may change per application (e.g. SOAP_ENV_Detail may have additional struct members).

1
  • Hi! Thanks a lot for your comment and the hint to the new version. About the second paragraph: does that mean that I would have to define these functions somehow to get to a working shared library? Why would it work on other distributions then apart from Cygwin? Thank you! – marlemion Jul 1 '19 at 9:00

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.