Oh no! Some styles failed to load. 😵 Please try reloading this page
Menu â–¾ â–´

#1249 Compilation on cygwin does not work. Undefined references

v1.0 (example)
closed
None
5
2019-07-04
2019-06-28
marlemion
No

I have created a cygport environment for compiling gsoap as a shared library. Compilation as a static library went fine. I have obtained patches etc here:

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

Only modification have been specifying LT_INIT in the configure.ac and adding -no-undefined to LD_FLAGS and -mcmodel=large to CFLAGS in Makefile.am.

However, compilation fails with:

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

Any hint? It would be very nice to have it working on cygwin.

4 Attachments

Discussion

  • marlemion

    marlemion - 2019-06-29

    In the meantime, I have payed around with -DSOAP_STD_EXPORTS and disable-namespaces, but with no success. However, I think the problem lies somewherer ther (dllexport and import in CYGWIN). Any idea?

     
  • marlemion

    marlemion - 2019-06-30

    I further looked into this. All the missing symbols are provided in the header file and are used in the c-file, but are nowhere defined. No wonder the linker does not know what they are.

    I managed at least to export soap_set_header by modifying c nd h files, but this is only possible as c gives an actual definition of it. The other symbols are used in the c file, but without any code attributed to them.

    Is this on purpose? My C knowledge is nearly non-existent, but this looks odd to me.

     
  • Robert van Engelen

    I've fixed the compilation failure related to gethostbyname_r and will release 2.8.87 with the patch. I can build applications on Cygwin using the source files and statically linked library. The issue with dynamically linked libraries isn't something I can figure out at this time, perhaps later.

     
  • Robert van Engelen

    • status: open --> closed
    • assigned_to: Robert van Engelen
     
  • Robert van Engelen

    I have closed this for now, since 2.8.87 is released with a gethostbyname_r check change. I can't include the patches for automake and shared libs.

     
  • marlemion

    marlemion - 2019-07-02

    Thank you. I would really appreciate if it were possible to build gsoap as shared library on cygwin. Reason is that I would like to use a project, which uses gsoap, on cygwin (kopano). This project compiles the static library libgsoap++ in. Now, on cygwin (and Windows in general, apparently), you cannot link a static library to a dll file. Kopano, on the other hand, would like to load such a dll (libkcclient) at runtime. Hence, without this library to be a dll, I cannot use Kopano. As libkcclient depends on another kopano library linked to libgsoap++ (libkcsoap), libtool and gcc shared do not allow for a shared library linked to libgsoap++ / libkcsoap. Hence, libkcclient is statically linked and not loadable at runtime.

    Therefore, please let me know if you need any support in this matter and I will help you as far as I can.

     
  • marlemion

    marlemion - 2019-07-03

    Thank you, but believe me - I know this site already and I tinker a LOT with dllexport and SOAP_STD_EXPORTS to get a dll out of it. Moreover, the site you linked seems to be adressing VisualStudio, not cygwin.

    When it comes to compiling kopano, SOAP_STD_EXPORTS will not have any positive effect (even checked it a few seconds ago). The problem ist the following:

    /bin/sh ./libtool --tag=CXX --mode=link g++ -Wall -Wmissing-declarations -std=gnu++17 -Wno-variadic-macros -O2 -fno-strict-aliasing -fvisibility=hidden -fvisibility-inlines-hidden -Wno-sign-compare -fvisibility=default -ggdb -O2 -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -fstack-protector-strong --param=ssp-buffer-size=4 -fdebug-prefix-map=/home//kopano/kopano-core.x86_64/build=/usr/src/debug/kopano-core -fdebug-prefix-map=/home/kopano/kopano-core.x86_64/src/kopanocore=/usr/src/debug/kopano-core -no-undefined -Wl,--version-script=provider/libkcsoap.sym -o libkcsoap.la -rpath /usr/lib provider/common/libkcsoap_la-soapctor.lo provider/soap/libkcsoap_la-soapC.lo provider/common/libkcsoap_la-pcuser.lo provider/common/libkcsoap_la-SOAPUtils.lo provider/common/libkcsoap_la-pcutil.lo libkcutil.la -lgsoapssl++
    libtool: link: rm -fr .libs/libkcsoap.a .libs/libkcsoap.la .libs/libkcsoap.lai

    Warning: linker path does not have real file for library -lgsoapssl++.
    I have the capability to make that library automatically link in when
    you link to this library. But I can only do this if you have a
    shared version of the library, which you do not appear to have
    because I did check the linker path looking for a file starting
    with libgsoapssl++ and none of the candidates passed a file format test
    using a file magic. Last file checked: /usr/lib/libgsoapssl++.a
    The inter-library dependencies that have been dropped here will be
    automatically added whenever a program is linked with this library
    or is declared to -dlopen it.

    Since this library must not contain undefined symbols,
    because either the platform does not support them or
    it was explicitly requested with -no-undefined,
    libtool will only create a static version of it.

    Once it compiled a library this way, all dependent libraries are compiled similarily.

     
  • marlemion

    marlemion - 2019-07-04

    Just to let you know that I got it working by directly compiling stdsoap2.cpp as a module into the libkcsoap library. At least it built a dll. Whether it is really working, I cannot tell right now.

     

Log in to post a comment.