5

I am trying to compile this library ndn-cxx in my laptop. I already tried in another computer and it compiled successfully but now i am getting this error and i think its related somhow to openssl. I verify that i have openssl in my laptop using sudo apt-cache search libssl | grep SSL and the result is :

  • libssl-ocaml - OCaml bindings for OpenSSL (runtime)
  • libssl-ocaml-dev - OCaml bindings for OpenSSL
  • libssl0.9.8 - SSL shared libraries
  • libsslcommon2 - enterprise messaging system - common SSL libraries
  • libsslcommon2-dev - enterprise messaging system - common SSL development files

The error I am getting when trying to compile the library is :

../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]
   }
   ^
5
  • 1
    What operating system and gcc version are on the successful computer and the unsuccessful laptop? Commented Nov 11, 2016 at 18:54
  • HMAC_CTX is a public data structure. Ensure #include <openssl/hmac.h> is present in the problematic source file. If the include is present, then we need to know where your copy of OpenSSL is located, and how you configured your project. OpenSSL 0.9.8 is really old and its past EOL. But its <hmac.h> includes HMAC_CTX. Are you on an OS X machine? Commented Nov 11, 2016 at 18:57
  • @PaulH. I am using ubuntu 14.04 in both laptops and gcc version 4.8 and they are both located in the same place /usr/lib/x86_64-linux-gnu Commented Nov 11, 2016 at 23:46
  • @ilyaslahmer - Ubuntu 14 has OpenSSL 1.0.1, and its lib name is libssl.1.0.0 (IIRC). How is it you are using libssl0.9.8? Anyway, make sure the ssl-dev package is installed. That's OpenSSL header files. Commented Nov 12, 2016 at 3:48
  • Did you try running sudo apt-get install build-essential libcrypto++-dev libsqlite3-dev libboost-all-dev libssl-dev to make sure you have all the dependencies? Commented Nov 13, 2016 at 18:37

1 Answer 1

4

The file that causes the compilation error contains the line #if OPENSSL_VERSION_NUMBER < 0x1010000fL and uses the struct HMAC_CTX in that case. For newer versions of OpenSSL (>1.1.0), it uses HMAX_CTX *. My conclusion is that the waf build tool includes the wrong file to get the OPENSSL_VERSION_NUMBER and consequently compiles as if you are using an older version of OpenSSL, with the struct HMAC_CTX, which is no longer available as such in the newer versions.

You could do grep OPENSSL .waf-tools/openssl.py and analyse the printed lines to see where the different OpenSSL includes come from.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.