编译gsoap-onvif解决#error:在此范围内未声明“ M_ASN1_STRING_data”

时间:2019-03-28 10:02:23

标签: c++ openssl gsoap onvif

我正在尝试在这里编译gsoap-onvif项目:https://github.com/xris-hu/gsoap-onvif

我调用了make文件,它引发了一些错误。在ubuntu 18.10上工作时,我解决了其中一些安装依赖项的问题:g ++,gsoap,libssl-dev。 不幸的是,我有一个我无法理解的错误:

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

有人知道如何解决这个问题吗?

更新:此项目中使用的gSOAP版本相当旧,可能无法与OpenSSL的较新版本一起使用。 该项目可能已经死了……有人知道替代方案吗?

替代方案:这是我找到的最佳解决方案:https://github.com/suresecure/onvifcpplib https://sourceforge.net/projects/onvifmanager/

也使用此库

3 个答案:

答案 0 :(得分:1)

它似乎是OpenSSL / gsoap isseus,请尝试使用新版本的stdsoap2.cpp更新软件。

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

答案 1 :(得分:1)

在Python中,一个非常好的解决方案是GitHub上的以下项目:

  

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

python 2.x的替代方法是:

  

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

答案 2 :(得分:0)

这是我已成功使用的补丁,它基于使用以下源代码的较新gSOAP 2.8版本:

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

此修补程序适用于较早的gSOAP版本。

此编辑是在功能tcp_connect()中对stdsoap2.c和stdsoap2.cpp进行的,它很长。