Search code examples
mongodbcmakeopensslmongo-c-driver

MongoDB C driver gives strange error about OpenSSL while installing


While I'm trying to install MongoDB C driver via CMake, at compilation process it gives error that says;

  • libmongoc-1.0.so.0.0.0: undefined reference to "OSSL_HTTP_parse_url"
  • libmongoc-1.0.so.0.0.0: undefined reference to "SSL_get1_peer_certificate"

I'm on Ubuntu 20.04 and my OpenSSL version is OpenSSL 1.1.1f which Ubuntu says latest. I followed directions on MongoDB's official C driver setup. If somehow my OpenSSL packages broken, how can I fix it?

When I try it with an Ubuntu 20.04 image from Docker and running it on a container, I can compile it fine with the same OpenSSL package.


Solution

  • I don't know why exactly but executing cmake configuration part that is on the website (cmake -DENABLE_AUTOMATIC_INIT_AND_CLEANUP=OFF ..) with sudo solved this. Maybe it made CMake to find the right version of OpenSSL. I didn't perform any update on OpenSSL.