I am trying to use the outdated C ++ mongodb driver. (Here, "legacy" means the production version, fwiw.) On the ubuntu host 15.04 using clang ++ 3.6 and raising 1.55 (from the ubuntu package repositories) and using the mongo-cxx driver pulled out the git form, I compiled the driver, and then tried to compile a test program .
$ clang++ -std=c++14 mongo.cc -pthread -lmongoclient -lboost_thread \
-lboost_system -lboost_regex -lssl -o mo
I see this error:
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)
Obviously I'm missing X509_free()
, but it seems like it should be in libssl (which is openSSL1.0.0, says dpkg and the symbolic library itself).
Thanks so much for any advice.
I don't think this is important here, but this is mongo.cc:
#include <cstdlib>
#include <iostream>
#include "mongo/client/dbclient.h"
void run() {
mongo::DBClientConnection c;
c.connect("localhost");
}
int main() {
mongo::client::initialize();
try {
run();
std::cout << "connected ok" << std::endl;
} catch( const mongo::DBException &e ) {
std::cout << "caught " << e.what() << std::endl;
}
return EXIT_SUCCESS;
}
source
share