Patchelf and libcurl: "no version information available"

At work we use MongoDB, and it’s been cumbersome to upgrade it since it’s a non-free package and therefore not built by Hydra, and requires local compilation. So in my dev shell, I’ve written a derivation which fetches the pre-built Debian binary and uses autoPatchelfHook to patch it.

This works great except running the patched binary prints

mongod: /nix/store/cgmpl823df6sjgc9qbb9wrw379x8yvwk-curl-7.86.0/lib/libcurl.so.4: no version information available (required by mongod)

before proceeding normally.

I’ve tried ensuring that curl is on the binary’s PATH, to no effect.

Is there a way to fix this warning?

The package definition:

{ lib, stdenv, autoPatchelfHook, openssl_1_1, curl, ... }:
stdenv.mkDerivation rec {
  pname = "mongodb";
  version = "4.2.23";

  src = builtins.fetchurl {
    url =
      "https://fastdl.mongodb.org/linux/mongodb-linux-x86_64-debian10-${version}.tgz";
    sha256 = "0zs33gdgszq2qsafynxdxbw5d4al579mc2pw46zry4k54j0xyq3c";
  };

  dontConfigure = true;
  dontBuild = true;

  nativeBuildInputs = [ autoPatchelfHook ];

  buildInputs = [ openssl_1_1 curl ];

  autoPatchelfIgnoreMissingDeps = [
    "libpcap.so.0.8" # Only used by mongoreplay
  ];

  installPhase = ''
    install -m755 -D -t $out/bin bin/*
  '';
}
1 Like