After upgrading my server from Debian Wheezy to Jessie, I encountered the following error during
/usr/lib/apt/methods/https: symbol lookup error: /usr/lib/x86_64-linux-gnu/libhogweed.so.2: undefined symbol: __gmpn_cnd_add_n
Debugging this issue is quite simple. We know that the apt software can’t find the function
__gmpn_cnd_add_n in the library
libhogweed.so.2. This kind of errors almost always means that the library where the error occurs (
libhogweed.so.2) expects a diffent version of a library it depends on (
ldd we can check which version is actually used:
$ ldd /usr/lib/x86_64-linux-gnu/libhogweed.so.2 [...] libgmp.so.10 => /usr/local/lib/libgmp.so.10 (0x00007f5ca1b59000) [...]
We can clearly see that
/usr/local/lib is used. This indicates that at some point someone installed a custom version of
libgmp on the system that is different to the version installed by the package manager.
Usually we can simply remove
/usr/local/lib/libgmp.so.10 which usually solves the problem because
libhogweed starts to use the correct version as installed by the package manager. Beware, however, that other software using
libgmp might stop to work because the library version changed. If removing the local library did not work, try re-checking using the method listed above.