0

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.

Emre
  • 15
  • 6

2 Answers2

1

The general advice is: whenever possible, stick with the defaults (apt-get install libmongoc-1.0-0).

Not sure what / how you're trying to build, but according to [OpenSSL]: SSL_get1_peer_certificate (emphasis is mine):

SSL_get0_peer_certificate() and SSL_get1_peer_certificate() were added in 3.0.0. SSL_get_peer_certificate() was deprecated in 3.0.0.

Same thing about OSSL_HTTP_parse_url.

So, you need (newer) OpenSSL 3.0 (don't know why this isn't specified in the installation URL).
Most likely you'd have to build it yourself ([OpenSSL.Wiki]: Compilation and Installation) - make sure to set --prefix=%OPENSSL30_INSTALL_DIR% and pass it (%OPENSSL30_INSTALL_DIR%) to (libmongoc's) configure tool.

CristiFati
  • 38,250
  • 9
  • 50
  • 87
  • I thought about that too but then why it works just fine on an Ubuntu 20.04 docker container where I applied same commands. – Emre Oct 15 '21 at 13:03
  • Should be a version mismatch. Either the container has *OpenSSL 3.0*, or you're building an older *libmongoc* version (compatible with *OpenSSL 1.1.1\**). – CristiFati Oct 17 '21 at 17:11
0

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.

Emre
  • 15
  • 6