title: Undefined reference to symbol X509_free
body: <p>I'm trying to use the mongodb legacy C++ driver.  (Here "legacy" means the production version, fwiw.)  On an ubuntu 15.04 host using clang++ 3.6 and boost 1.55 (from the ubuntu package repositories) and using mongo-cxx-driver pulled form git, I compiled the driver and then attempted to compile the test program.</p>
  
  <pre><code>$ clang++ -std=c++14 mongo.cc -pthread -lmongoclient -lboost_thread \
    -lboost_system -lboost_regex -lssl -o mo
  </code></pre>
  
  <p>I see this error:</p>
  
  <pre><code>clang++ -std=c++14 mongo.cc -pthread -lmongoclient -lboost_thread -lboost_system -lboost_regex -lssl -lcrypt -o mo
  /usr/bin/ld: /usr/local/lib/libmongoclient.a(ssl_manager.o): undefined reference to symbol 'X509_free@@OPENSSL_1.0.0'
  /lib/x86_64-linux-gnu/libcrypto.so.1.0.0: error adding symbols: DSO missing from command line
  clang: error: linker command failed with exit code 1 (use -v to see invocation)
  </code></pre>
  
  <p>Clearly I'm missing <code>X509_free()</code>, but it appears that should be in libssl (which is openSSL1.0.0, says dpkg and the library symlink itself).</p>
  
  <p>Many thanks for any tips.</p>
  
  <p>I don't think it's important here, but this is mongo.cc:</p>
  
  <pre><code>#include &lt;cstdlib&gt;
  #include &lt;iostream&gt;
  #include "mongo/client/dbclient.h" // for the driver
  
  void run() {
    mongo::DBClientConnection c;
    c.connect("localhost");
  }
  
  int main() {
      mongo::client::initialize();
      try {
          run();
          std::cout &lt;&lt; "connected ok" &lt;&lt; std::endl;
      } catch( const mongo::DBException &amp;e ) {
          std::cout &lt;&lt; "caught " &lt;&lt; e.what() &lt;&lt; std::endl;
      }
      return EXIT_SUCCESS;
  }
  </code></pre>