我正在尝试编译此库ndn-cxx 在我的笔记本电脑我已经尝试过另一台计算机并且编译成功,但现在我收到此错误,我认为它的相关somhow要openssl。我使用 sudo apt-cache search libssl |验证我的笔记本电脑中有openssl grep SSL ,结果是:
我在尝试编译库时遇到的错误是:
../src/security/transform/hmac-filter.cpp:49:12: error: field ‘m_context’ has incomplete type
HMAC_CTX m_context;
^
../src/security/transform/hmac-filter.cpp: In constructor
‘ndn::security::transform::HmacFilter::Impl::Impl()’:
../src/security/transform/hmac-filter.cpp:35:20: error: ‘m_context’ was not declared in this scope
HMAC_CTX_init(&m_context);
^
../src/security/transform/hmac-filter.cpp:35:29: error: ‘HMAC_CTX_init’ was not declared in this scope
HMAC_CTX_init(&m_context);
^
../src/security/transform/hmac-filter.cpp: In destructor ‘ndn::security::transform::HmacFilter::Impl::~Impl()’:
../src/security/transform/hmac-filter.cpp:40:23: error: ‘m_context’ was not declared in this scope
HMAC_CTX_cleanup(&m_context);
^
../src/security/transform/hmac-filter.cpp:40:32: error: ‘HMAC_CTX_cleanup’ was not declared in this scope
HMAC_CTX_cleanup(&m_context);
^
../src/security/transform/hmac-filter.cpp: In member function ‘ndn::security::transform::HmacFilter::Impl::operator HMAC_CTX*()’:
../src/security/transform/hmac-filter.cpp:45:13: error: ‘m_context’ was not declared in this scope
return &m_context;
^
../src/security/transform/hmac-filter.cpp:46:3: warning: control reaches end of non-void function [-Wreturn-type]
}
^
答案 0 :(得分:3)
file that causes the compilation error包含行#if OPENSSL_VERSION_NUMBER < 0x1010000fL
,在这种情况下使用结构HMAC_CTX
。对于较新版本的OpenSSL(&gt; 1.1.0),它使用HMAX_CTX *
。我的结论是waf
构建工具包含了错误的文件以获取OPENSSL_VERSION_NUMBER
并因此编译,就好像您使用的是旧版本的OpenSSL,结构为HMAC_CTX
,这是否定的在较新版本中可用的时间更长。
您可以执行grep OPENSSL .waf-tools/openssl.py
并分析打印的行,以查看不同的OpenSSL包含的来源。