Folkert van Heusden
Folkert van Heusden

Reputation: 534

GSOAP: undefined reference to e.g. soap_send___wsdd__Hello

I'm writing an application that is both onvif client and server. I've followed the documentation at https://www.genivia.com/doc/wsdd/html/wsdd_0.html and I'm using gsoap 2.8.124 (from ubuntu).

In the first step I generate the headers and such for the media, device-management and search services:

wsdl2h -P -x -c++17 -O4 -g -f onvif-wsdl/wsdl/ver20/media/wsdl/media.wsdl onvif-wsdl/wsdl/ver10/device/wsdl/devicemgmt.wsdl onvif-wsdl/wsdl/ver10/search.wsdl -o temp.h

echo '#import "from-gsoap/import/wsse.h"' > media.h
echo '#import "from-gsoap/import/wsdd.h"' >> media.h
cat temp.h >> media.h

Then I let soapcpp2 generate all the required files:

soapcpp2 -a -2 -j -c++17 -Ec -dgsoap/ -L -x media.h

My cmake file contains:

add_executable(onvif-test3-bc
    test3-bcast-listener.cpp
    from-gsoap/custom/struct_timeval.cpp
    from-gsoap/plugin/wsaapi.cpp
    from-gsoap/plugin/wsddapi.cpp
    gsoap/soapC.cpp
)

I let it also link to gsoapssl++.

This gives the following link errors:

/usr/bin/ld: CMakeFiles/onvif-test3-bc.dir/from-gsoap/plugin/wsddapi.cpp.o: in function `soap_wsdd_Hello':
onvif/from-gsoap/plugin/wsddapi.cpp:582: undefined reference to `soap_send___wsdd__Hello(soap*, char const*, char const*, wsdd__HelloType*)'
/usr/bin/ld: CMakeFiles/onvif-test3-bc.dir/from-gsoap/plugin/wsddapi.cpp.o: in function `soap_wsdd_Bye':
onvif/from-gsoap/plugin/wsddapi.cpp:651: undefined reference to `soap_send___wsdd__Bye(soap*, char const*, char const*, wsdd__ByeType*)'
/usr/bin/ld: CMakeFiles/onvif-test3-bc.dir/from-gsoap/plugin/wsddapi.cpp.o: in function `soap_wsdd_Probe':
onvif/from-gsoap/plugin/wsddapi.cpp:713: undefined reference to `soap_send___wsdd__Probe(soap*, char const*, char const*, wsdd__ProbeType*)'
/usr/bin/ld: onvif/from-gsoap/plugin/wsddapi.cpp:726: undefined reference to `soap_recv___wsdd__ProbeMatches(soap*, __wsdd__ProbeMatches*)'
/usr/bin/ld: CMakeFiles/onvif-test3-bc.dir/from-gsoap/plugin/wsddapi.cpp.o: in function `soap_wsdd_Resolve':
onvif/from-gsoap/plugin/wsddapi.cpp:806: undefined reference to `soap_send___wsdd__Resolve(soap*, char const*, char const*, wsdd__ResolveType*)'
/usr/bin/ld: onvif/from-gsoap/plugin/wsddapi.cpp:819: undefined reference to `soap_recv___wsdd__ResolveMatches(soap*, __wsdd__ResolveMatches*)'
/usr/bin/ld: CMakeFiles/onvif-test3-bc.dir/from-gsoap/plugin/wsddapi.cpp.o: in function `soap_wsdd_ProbeMatches':
onvif/from-gsoap/plugin/wsddapi.cpp:971: undefined reference to `soap_send___wsdd__ProbeMatches(soap*, char const*, char const*, wsdd__ProbeMatchesType*)'
/usr/bin/ld: CMakeFiles/onvif-test3-bc.dir/from-gsoap/plugin/wsddapi.cpp.o: in function `soap_wsdd_ResolveMatches':
onvif/from-gsoap/plugin/wsddapi.cpp:1039: undefined reference to `soap_send___wsdd__ResolveMatches(soap*, char const*, char const*, wsdd__ResolveMatchesType*)'
/usr/bin/ld: CMakeFiles/onvif-test3-bc.dir/from-gsoap/plugin/wsddapi.cpp.o: in function `__wsdd__Probe(soap*, wsdd__ProbeType*)':
onvif/from-gsoap/plugin/wsddapi.cpp:1444: undefined reference to `wsdd_event_Probe(soap*, char const*, char const*, char const*, char const*, char const*, wsdd__ProbeMatchesType*)'
/usr/bin/ld: onvif/from-gsoap/plugin/wsddapi.cpp:1479: undefined reference to `soap_send___wsdd__ProbeMatches(soap*, char const*, char const*, wsdd__ProbeMatchesType*)'
/usr/bin/ld: CMakeFiles/onvif-test3-bc.dir/from-gsoap/plugin/wsddapi.cpp.o: in function `__wsdd__Resolve(soap*, wsdd__ResolveType*)':
onvif/from-gsoap/plugin/wsddapi.cpp:1610: undefined reference to `soap_send___wsdd__ResolveMatches(soap*, char const*, char const*, wsdd__ResolveMatchesType*)'

Now I have probably forgotten to add some file to be linked, but if I grep for e.g. "soap_send___wsdd__Hello" in all code, then it is only declared in a gsoap/plugin/wsddapi.h but nowhere it is implemented. How can this be resolved?

Upvotes: 0

Views: 355

Answers (1)

Moster
Moster

Reputation: 31

I ran into the same issue. Using the option -j to generate the server objects and proxy removes the generation of soapClient/Server files. Those have the implementation of the unreferenced functions though.

The official genevia docs gave me hint. You need to additionally generate the client/server files for wsdd:

You must generate client-side operations that the WSDD library expects to be > linked with, by executing:

soapcpp2 -a -L -pwsdd -Iimport import/wsdd.h

This generated several files with a wsdd prefix (option -p). I needed to add wsddClient.cpp to my build to fix the unreferenced functions. As far as I can tell they are not even being used in the actual code when you use the C++ server objects.

source: https://www.genivia.com/doc/wsdd/html/wsdd_0.html [Miscellaneous]

Upvotes: 2

Related Questions