简体   繁体   中英

Compile gsoap-onvif solve #error: ‘M_ASN1_STRING_data’ was not declared in this scope

I'm trying to compile the gsoap-onvif project here: https://github.com/xris-hu/gsoap-onvif

I call the make file and it throws some errors. Working on ubuntu 18.10 i solved some of them installing the dependencies: g++, gsoap, libssl-dev. Unfortunately I have an error which I cannot understand:

admin@UbuntuOS:~/Desktop/gsoap-onvif-master$ make
g++ -c -Wall -g -w -fPIC -DWITH_NONAMESPACES -fno-use-cxa-atexit -fexceptions -DWITH_DOM  -DWITH_OPENSSL -DSOAP_DEBUG   -I./include -I. stdsoap2.cpp -o stdsoap2.o
stdsoap2.cpp: In function ‘int tcp_connect(soap*, const char*, const char*, int)’:
stdsoap2.cpp:4406:52: error: ‘M_ASN1_STRING_data’ was not declared in this scope
             { if (!soap_tag_cmp(host, (const char*)M_ASN1_STRING_data(name)))
                                                    ^~~~~~~~~~~~~~~~~~
stdsoap2.cpp:4406:52: note: suggested alternative: ‘ASN1_STRING_data’
             { if (!soap_tag_cmp(host, (const char*)M_ASN1_STRING_data(name)))
                                                    ^~~~~~~~~~~~~~~~~~
                                                    ASN1_STRING_data
make: *** [Makefile:22: stdsoap2.o] Error 1

Someone know how to solve this issue?

UPDATE: the version of gSOAP used in this project is pretty old and may not work with newer versions of OpenSSL. The project could be dead... Anyone knows an alternative?

ALTERNATIVE: Here is the best solution I found: https://github.com/suresecure/onvifcpplib This lib is used also in https://sourceforge.net/projects/onvifmanager/

It seams it is a OpenSSL/gsoap isseus, try to update the software with a new version of stdsoap2.cpp.

https://github.com/Sufi-Al-Hussaini/onvif-gsoap-by-example/issues/1

In Python a very nice solution is the following project on GitHub:

https://github.com/FalkTannhaeuser/python-onvif-zeep

an alternative for python 2.x is:

https://github.com/quatanium/python-onvif .

Here is a patch that I've successfully used, which is based on newer gSOAP 2.8 versions that use the following source code:

#if OPENSSL_VERSION_NUMBER < 0x10100000L
              const char *tmp = (const char*)ASN1_STRING_data(name);
#else
              const char *tmp = (const char*)ASN1_STRING_get0_data(name);
#endif
              if (!soap_tag_cmp(host, tmp))
              {
                ok = 1;
                DBGLOG(TEST, SOAP_MESSAGE(fdebug, "SSL: host name %s match with certificate subject %s\n", host, tmp));
              }

This patch works with older gSOAP versions.

This edit is made to stdsoap2.c and stdsoap2.cpp in function tcp_connect() , which is pretty long.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM