public inbox for cygwin@cygwin.com
 help / color / mirror / Atom feed
* Compile gsoap as shared library - undefined references
@ 2019-07-01  9:10 Wilhelm Eger
  2019-07-01 12:47 ` Marco Atzeri
  0 siblings, 1 reply; 4+ messages in thread
From: Wilhelm Eger @ 2019-07-01  9:10 UTC (permalink / raw)
  To: cygwin

[-- Attachment #1: Type: text/plain, Size: 18591 bytes --]

Hello there!

This is my first post to the cygwin mailing list. Hence, I hope, this
is the right place to post my problem. It seems to be a mixture of
packaging / compiling / linking / porting problem. However, I was
thinking that starting in this list is more appropriate than in e.g.
the packagers list.

I would like to compile gsoap as a shared library to use it in another
project (kopano-core). Please note that static linking works fine.
However, I would like to achieve a shared library of gsoap. gsoap
itself provides only static compilation. However, the major
distributions deliver it as shared library. That's where I have
started:

gSoap: https://sourceforge.net/projects/gsoap2/
OpenSuse Patches for shared library:
https://build.opensuse.org/package/show/home:mrbadguy/gsoap

Please find my respective patches plus cygport package attached to this mail.

Unfortunately, the package does not build. In fact, it fails at
linking the shared library due to undefined references. Please not
that I have updated the OpenSuse patches by adding '-no-undefined' to
the libtool chain. Further, I have added 'mcmodel=large' to the CFLAGS
to work around relocation problems.

Still, undefined references are found:

make  all-recursive
make[1]: Entering directory
'/home/eger/gsoap-shared/gsoap-2.8.84-1.x86_64/build'
Making all in .
make[2]: Entering directory
'/home/eger/gsoap-shared/gsoap-2.8.84-1.x86_64/build'
make[2]: Leaving directory '/home/eger/gsoap-shared/gsoap-2.8.84-1.x86_64/build'
Making all in gsoap
make[2]: Entering directory
'/home/eger/gsoap-shared/gsoap-2.8.84-1.x86_64/build/gsoap'
ln -s -f /home/eger/gsoap-shared/gsoap-2.8.84-1.x86_64/src/gsoap-2.8/gsoap/stdsoap2.cpp
stdsoap2_cpp.cpp
ln -s -f /home/eger/gsoap-shared/gsoap-2.8.84-1.x86_64/src/gsoap-2.8/gsoap/dom.cpp
dom_cpp.cpp
ln -s -f /home/eger/gsoap-shared/gsoap-2.8.84-1.x86_64/src/gsoap-2.8/gsoap/stdsoap2.cpp
stdsoap2_ck.c
ln -s -f /home/eger/gsoap-shared/gsoap-2.8.84-1.x86_64/src/gsoap-2.8/gsoap/stdsoap2.cpp
stdsoap2_ck_cpp.cpp
ln -s -f /home/eger/gsoap-shared/gsoap-2.8.84-1.x86_64/src/gsoap-2.8/gsoap/stdsoap2.cpp
stdsoap2_ssl.c
ln -s -f /home/eger/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/eger/gsoap-shared/gsoap-2.8.84-1.x86_64/build/gsoap'
Making all in .
make[4]: Entering directory
'/home/eger/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/eger/gsoap-shared/gsoap-2.8.84-1.x86_64/src/gsoap-2.8/gsoap
-I..   -D_GNU_SOURCE -Wno-attributes      -mcmodel=large -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/eger/gsoap-shared/gsoap-2.8.84-1.x86_64/build=/usr/src/debug/gsoap-2.8.84-1
-fdebug-prefix-map=/home/eger/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/eger/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/eger/gsoap-shared/gsoap-2.8.84-1.x86_64/src/gsoap-2.8/gsoap
-I.. -D_GNU_SOURCE -Wno-attributes -mcmodel=large -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/eger/gsoap-shared/gsoap-2.8.84-1.x86_64/build=/usr/src/debug/gsoap-2.8.84-1
-fdebug-prefix-map=/home/eger/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/eger/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/eger/gsoap-shared/gsoap-2.8.84-1.x86_64/src/gsoap-2.8/gsoap/stdsoap2.c:
In function 'tcp_gethostbyname':
/home/eger/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/eger/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/eger/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/eger/gsoap-shared/gsoap-2.8.84-1.x86_64/src/gsoap-2.8/gsoap/stdsoap2.c:
In function 'soap_strerror':
/home/eger/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/eger/gsoap-shared/gsoap-2.8.84-1.x86_64/src/gsoap-2.8/gsoap
-I..   -D_GNU_SOURCE -Wno-attributes      -mcmodel=large -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/eger/gsoap-shared/gsoap-2.8.84-1.x86_64/build=/usr/src/debug/gsoap-2.8.84-1
-fdebug-prefix-map=/home/eger/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/eger/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/eger/gsoap-shared/gsoap-2.8.84-1.x86_64/src/gsoap-2.8/gsoap
-I.. -D_GNU_SOURCE -Wno-attributes -mcmodel=large -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/eger/gsoap-shared/gsoap-2.8.84-1.x86_64/build=/usr/src/debug/gsoap-2.8.84-1
-fdebug-prefix-map=/home/eger/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/eger/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      -mcmodel=large
-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/eger/gsoap-shared/gsoap-2.8.84-1.x86_64/build=/usr/src/debug/gsoap-2.8.84-1
-fdebug-prefix-map=/home/eger/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: gcc -shared  .libs/libgsoap_la-stdsoap2.o
.libs/libgsoap_la-dom.o    -mcmodel=large -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[4]: *** [Makefile:574: libgsoap.la] Error 1
make[4]: Leaving directory
'/home/eger/gsoap-shared/gsoap-2.8.84-1.x86_64/build/gsoap'
make[3]: *** [Makefile:797: all-recursive] Error 1
make[3]: Leaving directory
'/home/eger/gsoap-shared/gsoap-2.8.84-1.x86_64/build/gsoap'
make[2]: *** [Makefile:501: all] Error 2
make[2]: Leaving directory
'/home/eger/gsoap-shared/gsoap-2.8.84-1.x86_64/build/gsoap'
make[1]: *** [Makefile:503: all-recursive] Error 1
make[1]: Leaving directory '/home/eger/gsoap-shared/gsoap-2.8.84-1.x86_64/build'
make: *** [Makefile:402: all] Error 2

It seems to be a problem with exporting/importing of symbols. There is
already a passage for ___dllexport in the stdsoap.h file, which looks
like:

#ifdef _WIN32
# ifndef WIN32
#  define WIN32
# endif
#endif

/* for legacy purposes we use WIN32 macro, even when WIN64 is supported */
#ifdef _WIN64
# ifndef WIN32
#  define WIN32
# endif
#endif

#ifdef WIN32
# ifdef SOAP_STD_EXPORTS        /* dllexport the API functions and classes */
#  ifndef SOAP_STD_API
#   define SOAP_STD_API __declspec(dllexport)
#  endif
#  ifndef SOAP_CMAC
#   define SOAP_CMAC SOAP_STD_API       /* export soap struct and
generated classes */
#  endif
#  ifndef SOAP_FMAC1
#   define SOAP_FMAC1 SOAP_STD_API      /* export stdsoap2.cpp API */
#  endif
#  ifndef SOAP_FMAC3
#   define SOAP_FMAC3 SOAP_STD_API      /* export soapC.cpp serializers API */
#  endif
#  ifndef SOAP_FMAC5
#   define SOAP_FMAC5 SOAP_STD_API      /* export soapClient.cpp and
soapServer.cpp API */
#  endif
# endif
#endif

I have played with this code adding defs for CYGWIN, but it did not
help. I have even removed the whole block, but that did not help
either. I have tried adding -Wl,--export-all-symbols to the gcc
-shared command - no luck.

Then I started looking in the code. The respectively undefined
references are to be found at the end of the stdsoap.h file:

SOAP_FMAC3 void SOAP_FMAC4 soap_header(struct soap*);
SOAP_FMAC3 void SOAP_FMAC4 soap_fault(struct soap*);
SOAP_FMAC3 const char ** SOAP_FMAC4 soap_faultcode(struct soap*);
SOAP_FMAC3 const char ** SOAP_FMAC4 soap_faultsubcode(struct soap*);
SOAP_FMAC3 const char ** SOAP_FMAC4 soap_faultstring(struct soap*);
SOAP_FMAC3 const char ** SOAP_FMAC4 soap_faultdetail(struct soap*);
SOAP_FMAC3 const char * SOAP_FMAC4 soap_fault_subcode(struct soap*);
SOAP_FMAC3 const char * SOAP_FMAC4 soap_fault_string(struct soap*);
SOAP_FMAC3 const char * SOAP_FMAC4 soap_fault_detail(struct soap*);
SOAP_FMAC3 void SOAP_FMAC4 soap_serializefault(struct soap*);
SOAP_FMAC3 void SOAP_FMAC4 soap_serializeheader(struct soap*);
SOAP_FMAC3 int SOAP_FMAC4 soap_getheader(struct soap*);
SOAP_FMAC3 int SOAP_FMAC4 soap_putheader(struct soap*);
SOAP_FMAC3 int SOAP_FMAC4 soap_getfault(struct soap*);
SOAP_FMAC3 int SOAP_FMAC4 soap_putfault(struct soap*);

If the definition as given further up works, SOAP_FMAC3 is
__declspec(dllexport). Hence, they should be exported. I have tried by
adding explicitly 'extern' in front of these definitions (and also in
front of the general definition higher up), even more error messages.
I have tried to remove them, but they are referred to in stdsoap.c

However, unluckily, they are referred to without being defined. This
seems to be the major problem to me right now.

nm also reports them as being undefined (besides others):

 nm --undefined libgsoap_la-stdsoap2.o
                 U ___chkstk_ms
                 U __chk_fail
                 U __errno
                 U __imp_h_errno
                 U __locale_mb_cur_max
                 U __stack_chk_fail
                 U __stack_chk_guard
                 U accept
                 U bind
                 U close
                 U connect
                 U difftime
                 U fcntl
                 U fprintf
                 U free
                 U freelocale
                 U fwrite
                 U gethostbyname
                 U getsockopt
                 U gettimeofday
                 U gmtime_r
                 U inet_addr
                 U inet_pton
                 U listen
                 U malloc
                 U mbtowc
                 U memcpy
                 U memmove
                 U mktime
                 U namespaces
                 U newlocale
                 U poll
                 U random
                 U read
                 U recv
                 U recvfrom
                 U select
                 U send
                 U sendto
                 U setsockopt
                 U shutdown
                 U snprintf
                 U soap_fault_detail
                 U soap_fault_string
                 U soap_fault_subcode
                 U soap_faultcode
                 U soap_faultdetail
                 U soap_faultstring
                 U soap_faultsubcode
                 U soap_getfault
                 U soap_getheader
                 U soap_putfault
                 U soap_putheader
                 U soap_serializefault
                 U soap_serializeheader
                 U socket
                 U strchr
                 U strcmp
                 U strerror_r
                 U strftime
                 U strlcat
                 U strlcpy
                 U strlen
                 U strncmp
                 U strncpy
                 U strrchr
                 U strstr
                 U strtod
                 U strtol
                 U strtoll
                 U strtoul
                 U strtoull
                 U time
                 U timegm
                 U uselocale
                 U wctomb
                 U write

nm --undefined libgsoap_la-dom.o
                 U __stack_chk_fail
                 U __stack_chk_guard
                 U free
                 U malloc
                 U snprintf
                 U soap_attribute
                 U soap_begin_count
                 U soap_begin_recv
                 U soap_closesock
                 U soap_connect_command
                 U soap_current_namespace_att
                 U soap_current_namespace_tag
                 U soap_delelement
                 U soap_double_nan
                 U soap_double2s
                 U soap_dupelement
                 U soap_element
                 U soap_element_begin_in
                 U soap_element_end_in
                 U soap_element_end_out
                 U soap_element_start_end_out
                 U soap_end_count
                 U soap_end_recv
                 U soap_end_send
                 U soap_getelement
                 U soap_http_get_body
                 U soap_LONG642s
                 U soap_lookup_ns
                 U soap_malloc
                 U soap_markelement
                 U soap_peek_element
                 U soap_push_namespace
                 U soap_putelement
                 U soap_s2double
                 U soap_s2int
                 U soap_s2long
                 U soap_s2LONG64
                 U soap_send
                 U soap_set_attr
                 U soap_strdup
                 U soap_string_in
                 U soap_string_out
                 U soap_strtrim
                 U soap_wchar2s
                 U strchr
                 U strcmp
                 U strlen
                 U strncmp
                 U strncpy

However, they are not to be found.

Hence, I am currently stuck on this problem (since a few days already
now). I have opened a ticket on the respective sourceforge site
(without no reaction yet): https://sourceforge.net/p/gsoap2/bugs/1249/
I have also asked on stackoverflow:
https://stackoverflow.com/questions/56811125/compiling-gsoap-on-cygwin-as-shared-library-undefined-reference-relocation-tr

There was already one reaction letting me know:

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).

Hence, I appreciated very much any intput in this matter. Maybe we
even get so far that we can implement gsoap as a shared library
package! Thanks in advance!

Wilhelm

[-- Attachment #2: sharedlibs.patch --]
[-- Type: application/octet-stream, Size: 6126 bytes --]

--- 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
+AM_DISABLE_STATIC
+AM_PROG_LIBTOOL
 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) -mcmodel=large -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) -mcmodel=large -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) -mcmodel=large -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) -mcmodel=large -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) -mcmodel=large -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) -mcmodel=large -D$(platform) $(WSDL2H_EXTRA_FLAGS) -DWITH_DOM -DWITH_COOKIES
+libgsoap_la_LDFLAGS = -release ${PACKAGE_VERSION} -Wl,--version-script=gsoap.sym -no-undefined   
+libgsoap___la_LDFLAGS = -release ${PACKAGE_VERSION} -Wl,--version-script=gsoap++.sym -no-undefined  
+libgsoapck_la_LDFLAGS = -release ${PACKAGE_VERSION} -Wl,--version-script=gsoapck.sym -no-undefined  
+libgsoapck___la_LDFLAGS = -release ${PACKAGE_VERSION} -Wl,--version-script=gsoapck++.sym -no-undefined  
+libgsoapssl_la_LDFLAGS = -release ${PACKAGE_VERSION} -Wl,--version-script=gsoapssl.sym -no-undfined  
+libgsoapssl_la_LIBADD = ${SAMPLE_SSL_LIBS}
+libgsoapssl___la_LDFLAGS = -release ${PACKAGE_VERSION} -Wl,--version-script=gsoapssl++.sym -no-undefined  
+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: *; }; 


[-- Attachment #3: automake.patch --]
[-- Type: application/octet-stream, Size: 272 bytes --]

--- 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 


[-- Attachment #4: gsoap.cygport --]
[-- Type: application/octet-stream, Size: 1418 bytes --]

# 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
}


[-- Attachment #5: gethostbyname.patch --]
[-- Type: application/octet-stream, Size: 2228 bytes --]

--- 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

[-- Attachment #6: Type: text/plain, Size: 219 bytes --]


--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Compile gsoap as shared library - undefined references
  2019-07-01  9:10 Compile gsoap as shared library - undefined references Wilhelm Eger
@ 2019-07-01 12:47 ` Marco Atzeri
  2019-07-01 13:38   ` Wilhelm Eger
  0 siblings, 1 reply; 4+ messages in thread
From: Marco Atzeri @ 2019-07-01 12:47 UTC (permalink / raw)
  To: cygwin

Am 01.07.2019 um 11:09 schrieb Wilhelm Eger:
> Hello there!
>
> This is my first post to the cygwin mailing list. Hence, I hope, this
> is the right place to post my problem. It seems to be a mixture of
> packaging / compiling / linking / porting problem. However, I was
> thinking that starting in this list is more appropriate than in e.g.
> the packagers list.
>
> I would like to compile gsoap as a shared library to use it in another
> project (kopano-core). Please note that static linking works fine.
> However, I would like to achieve a shared library of gsoap. gsoap
> itself provides only static compilation. However, the major
> distributions deliver it as shared library. That's where I have
> started:
>
> gSoap: https://sourceforge.net/projects/gsoap2/
> OpenSuse Patches for shared library:
> https://build.opensuse.org/package/show/home:mrbadguy/gsoap
>
> Please find my respective patches plus cygport package attached to this mail.
>
> Unfortunately, the package does not build. In fact, it fails at
> linking the shared library due to undefined references. Please not
> that I have updated the OpenSuse patches by adding '-no-undefined' to
> the libtool chain. Further, I have added 'mcmodel=large' to the CFLAGS
> to work around relocation problems.
>
> Still, undefined references are found:

> /bin/sh ../libtool  --tag=CC   --mode=link gcc      -mcmodel=large
> -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/eger/gsoap-shared/gsoap-2.8.84-1.x86_64/build=/usr/src/debug/gsoap-2.8.84-1
> -fdebug-prefix-map=/home/eger/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: gcc -shared  .libs/libgsoap_la-stdsoap2.o
> .libs/libgsoap_la-dom.o    -mcmodel=large -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'

which library provide soap_fault_detail ?

Maybe the package will build multiple dlls and you need to add
the dependencies ?

Marco


---
Diese E-Mail wurde von Avast Antivirus-Software auf Viren geprüft.
https://www.avast.com/antivirus


--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Compile gsoap as shared library - undefined references
  2019-07-01 12:47 ` Marco Atzeri
@ 2019-07-01 13:38   ` Wilhelm Eger
  2019-07-01 14:01     ` Marco Atzeri
  0 siblings, 1 reply; 4+ messages in thread
From: Wilhelm Eger @ 2019-07-01 13:38 UTC (permalink / raw)
  To: cygwin

Hi Marco,

I think this is the actual problem. This might answer your question
(posted on stackoverflow for the same question):

> 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).

Hence, this seems to be valied for all undefined references.

However, I have tried compiling the package modified as set out above
(without further adaption to cygwin) on archlinux and it compiles
fine!

Compilation on archlinux:

make  all-recursive
make[1]: Entering directory '/home/office2pdf/test/gsoap-2.8'
Making all in .
make[2]: Entering directory '/home/office2pdf/test/gsoap-2.8'
make[2]: Leaving directory '/home/office2pdf/test/gsoap-2.8'
Making all in gsoap
make[2]: Entering directory '/home/office2pdf/test/gsoap-2.8/gsoap'
ln -s -f ../gsoap/stdsoap2.cpp stdsoap2_cpp.cpp
ln -s -f ../gsoap/dom.cpp dom_cpp.cpp
ln -s -f ../gsoap/stdsoap2.cpp stdsoap2_ck.c
ln -s -f ../gsoap/stdsoap2.cpp stdsoap2_ck_cpp.cpp
ln -s -f ../gsoap/stdsoap2.cpp stdsoap2_ssl.c
ln -s -f ../gsoap/stdsoap2.cpp stdsoap2_ssl_cpp.cpp
make  all-recursive
make[3]: Entering directory '/home/office2pdf/test/gsoap-2.8/gsoap'
Making all in .
make[4]: Entering directory '/home/office2pdf/test/gsoap-2.8/gsoap'
/bin/sh ../libtool  --tag=CC   --mode=compile gcc -DHAVE_CONFIG_H -I.
-I..       -DWITH_IPV6  -DLINUX -g -O2 -MT libgsoap_la-stdsoap2.lo -MD
-MP -MF .deps/libgsoap_la-stdsoap2.Tpo -c -o libgsoap_la-stdsoap2.lo
`test -f 'stdsoap2.c' || echo './'`stdsoap2.c
libtool: compile:  gcc -DHAVE_CONFIG_H -I. -I.. -DWITH_IPV6 -DLINUX -g
-O2 -MT libgsoap_la-stdsoap2.lo -MD -MP -MF
.deps/libgsoap_la-stdsoap2.Tpo -c stdsoap2.c  -fPIC -DPIC -o
.libs/libgsoap_la-stdsoap2.o
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..       -DWITH_IPV6  -DLINUX -g -O2 -MT libgsoap_la-dom.lo -MD -MP
-MF .deps/libgsoap_la-dom.Tpo -c -o libgsoap_la-dom.lo `test -f
'dom.c' || echo './'`dom.c
libtool: compile:  gcc -DHAVE_CONFIG_H -I. -I.. -DWITH_IPV6 -DLINUX -g
-O2 -MT libgsoap_la-dom.lo -MD -MP -MF .deps/libgsoap_la-dom.Tpo -c
dom.c  -fPIC -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    -DWITH_IPV6  -DLINUX
-g -O2 -release 2.8.84 -Wl,--version-script=gsoap.sym  -o libgsoap.la
-rpath /usr/local/lib libgsoap_la-stdsoap2.lo libgsoap_la-dom.lo
libtool: link: gcc -shared  -fPIC -DPIC  .libs/libgsoap_la-stdsoap2.o
.libs/libgsoap_la-dom.o    -g -O2 -Wl,--version-script=gsoap.sym
-Wl,-soname -Wl,libgsoap-2.8.84.so -o .libs/libgsoap-2.8.84.so
libtool: link: (cd ".libs" && rm -f "libgsoap.so" && ln -s
"libgsoap-2.8.84.so" "libgsoap.so")
libtool: link: ( cd ".libs" && rm -f "libgsoap.la" && ln -s
"../libgsoap.la" "libgsoap.la" )
[...]

nm --undefined gsoap/.libs/libgsoap.so  | grep soap
                 U soap_delelement
                 U soap_dupelement
                 U soap_fault_detail
                 U soap_fault_string
                 U soap_fault_subcode
                 U soap_faultcode
                 U soap_faultdetail
                 U soap_faultstring
                 U soap_faultsubcode
                 U soap_getelement
                 U soap_getfault
                 U soap_getheader
                 U soap_markelement
                 U soap_putelement
                 U soap_putfault
                 U soap_putheader
                 U soap_serializefault
                 U soap_serializeheader

Why does the code compile on linux, but not on cygwin and how to make
this happen on cygwin?


Am Mo., 1. Juli 2019 um 14:47 Uhr schrieb Marco Atzeri <marco.atzeri@gmail.com>:
>
> Am 01.07.2019 um 11:09 schrieb Wilhelm Eger:
> > Hello there!
> >
> > This is my first post to the cygwin mailing list. Hence, I hope, this
> > is the right place to post my problem. It seems to be a mixture of
> > packaging / compiling / linking / porting problem. However, I was
> > thinking that starting in this list is more appropriate than in e.g.
> > the packagers list.
> >
> > I would like to compile gsoap as a shared library to use it in another
> > project (kopano-core). Please note that static linking works fine.
> > However, I would like to achieve a shared library of gsoap. gsoap
> > itself provides only static compilation. However, the major
> > distributions deliver it as shared library. That's where I have
> > started:
> >
> > gSoap: https://sourceforge.net/projects/gsoap2/
> > OpenSuse Patches for shared library:
> > https://build.opensuse.org/package/show/home:mrbadguy/gsoap
> >
> > Please find my respective patches plus cygport package attached to this mail.
> >
> > Unfortunately, the package does not build. In fact, it fails at
> > linking the shared library due to undefined references. Please not
> > that I have updated the OpenSuse patches by adding '-no-undefined' to
> > the libtool chain. Further, I have added 'mcmodel=large' to the CFLAGS
> > to work around relocation problems.
> >
> > Still, undefined references are found:
>
> > /bin/sh ../libtool  --tag=CC   --mode=link gcc      -mcmodel=large
> > -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/eger/gsoap-shared/gsoap-2.8.84-1.x86_64/build=/usr/src/debug/gsoap-2.8.84-1
> > -fdebug-prefix-map=/home/eger/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: gcc -shared  .libs/libgsoap_la-stdsoap2.o
> > .libs/libgsoap_la-dom.o    -mcmodel=large -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'
>
> which library provide soap_fault_detail ?
>
> Maybe the package will build multiple dlls and you need to add
> the dependencies ?
>
> Marco
>
>
> ---
> Diese E-Mail wurde von Avast Antivirus-Software auf Viren geprüft.
> https://www.avast.com/antivirus
>
>
> --
> Problem reports:       http://cygwin.com/problems.html
> FAQ:                   http://cygwin.com/faq/
> Documentation:         http://cygwin.com/docs.html
> Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
>

--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Compile gsoap as shared library - undefined references
  2019-07-01 13:38   ` Wilhelm Eger
@ 2019-07-01 14:01     ` Marco Atzeri
  0 siblings, 0 replies; 4+ messages in thread
From: Marco Atzeri @ 2019-07-01 14:01 UTC (permalink / raw)
  To: cygwin

Am 01.07.2019 um 15:38 schrieb Wilhelm Eger:
> Hi Marco,
>
> I think this is the actual problem. This might answer your question
> (posted on stackoverflow for the same question):
>
>> 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).
>
> Hence, this seems to be valied for all undefined references.
>
> However, I have tried compiling the package modified as set out above
> (without further adaption to cygwin) on archlinux and it compiles
> fine!
>
> Compilation on archlinux:
>
> make  all-recursive
> make[1]: Entering directory '/home/office2pdf/test/gsoap-2.8'
> Making all in .
> make[2]: Entering directory '/home/office2pdf/test/gsoap-2.8'
> make[2]: Leaving directory '/home/office2pdf/test/gsoap-2.8'
> Making all in gsoap
> make[2]: Entering directory '/home/office2pdf/test/gsoap-2.8/gsoap'
> ln -s -f ../gsoap/stdsoap2.cpp stdsoap2_cpp.cpp
> ln -s -f ../gsoap/dom.cpp dom_cpp.cpp
> ln -s -f ../gsoap/stdsoap2.cpp stdsoap2_ck.c
> ln -s -f ../gsoap/stdsoap2.cpp stdsoap2_ck_cpp.cpp
> ln -s -f ../gsoap/stdsoap2.cpp stdsoap2_ssl.c
> ln -s -f ../gsoap/stdsoap2.cpp stdsoap2_ssl_cpp.cpp
> make  all-recursive
> make[3]: Entering directory '/home/office2pdf/test/gsoap-2.8/gsoap'
> Making all in .
> make[4]: Entering directory '/home/office2pdf/test/gsoap-2.8/gsoap'
> /bin/sh ../libtool  --tag=CC   --mode=compile gcc -DHAVE_CONFIG_H -I.
> -I..       -DWITH_IPV6  -DLINUX -g -O2 -MT libgsoap_la-stdsoap2.lo -MD
> -MP -MF .deps/libgsoap_la-stdsoap2.Tpo -c -o libgsoap_la-stdsoap2.lo
> `test -f 'stdsoap2.c' || echo './'`stdsoap2.c
> libtool: compile:  gcc -DHAVE_CONFIG_H -I. -I.. -DWITH_IPV6 -DLINUX -g
> -O2 -MT libgsoap_la-stdsoap2.lo -MD -MP -MF
> .deps/libgsoap_la-stdsoap2.Tpo -c stdsoap2.c  -fPIC -DPIC -o
> .libs/libgsoap_la-stdsoap2.o
> 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..       -DWITH_IPV6  -DLINUX -g -O2 -MT libgsoap_la-dom.lo -MD -MP
> -MF .deps/libgsoap_la-dom.Tpo -c -o libgsoap_la-dom.lo `test -f
> 'dom.c' || echo './'`dom.c
> libtool: compile:  gcc -DHAVE_CONFIG_H -I. -I.. -DWITH_IPV6 -DLINUX -g
> -O2 -MT libgsoap_la-dom.lo -MD -MP -MF .deps/libgsoap_la-dom.Tpo -c
> dom.c  -fPIC -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    -DWITH_IPV6  -DLINUX
> -g -O2 -release 2.8.84 -Wl,--version-script=gsoap.sym  -o libgsoap.la
> -rpath /usr/local/lib libgsoap_la-stdsoap2.lo libgsoap_la-dom.lo
> libtool: link: gcc -shared  -fPIC -DPIC  .libs/libgsoap_la-stdsoap2.o
> .libs/libgsoap_la-dom.o    -g -O2 -Wl,--version-script=gsoap.sym
> -Wl,-soname -Wl,libgsoap-2.8.84.so -o .libs/libgsoap-2.8.84.so
> libtool: link: (cd ".libs" && rm -f "libgsoap.so" && ln -s
> "libgsoap-2.8.84.so" "libgsoap.so")
> libtool: link: ( cd ".libs" && rm -f "libgsoap.la" && ln -s
> "../libgsoap.la" "libgsoap.la" )
> [...]
>
> nm --undefined gsoap/.libs/libgsoap.so  | grep soap
>                   U soap_delelement
>                   U soap_dupelement
>                   U soap_fault_detail
>                   U soap_fault_string
>                   U soap_fault_subcode
>                   U soap_faultcode
>                   U soap_faultdetail
>                   U soap_faultstring
>                   U soap_faultsubcode
>                   U soap_getelement
>                   U soap_getfault
>                   U soap_getheader
>                   U soap_markelement
>                   U soap_putelement
>                   U soap_putfault
>                   U soap_putheader
>                   U soap_serializefault
>                   U soap_serializeheader
>
> Why does the code compile on linux, but not on cygwin and how to make
> this happen on cygwin?
>
>

post bottom and trim in this mailing list, please.

Windows and some other platforms do NOT allow undefined at link time,
linux and some other Unix (not all) are ignoring the issue.

IMHO this source package is bad defined and need modifications, so you
need to work with upstream developers.



---
Diese E-Mail wurde von Avast Antivirus-Software auf Viren geprüft.
https://www.avast.com/antivirus


--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2019-07-01 14:01 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-07-01  9:10 Compile gsoap as shared library - undefined references Wilhelm Eger
2019-07-01 12:47 ` Marco Atzeri
2019-07-01 13:38   ` Wilhelm Eger
2019-07-01 14:01     ` Marco Atzeri

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).