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

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

本文关键字:声明 范围内 data ASN1 求解 gsoap-onvif #error 编译 STRING      更新时间:2023-10-16

我正在尝试在这里编译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/

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

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

这是我成功使用的一个补丁,它基于使用以下源代码的较新的 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 %sn", host, tmp));
              }

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

这个编辑是在函数tcp_connect()中对stdsoap2.c和stdsoap2.cpp进行的,这是相当长的。

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

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

Python 2.x的替代方案是:

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

这是 libssl1.0 库问题

转到此链接,从用户名saberprashant中找到答案,然后按照他的步骤进行操作。问题可能会得到解决。