I have a very simple GMP program in C (below)
#include <stdio.h>
#include <gmp.h>
int main() {
mpf_t a, b, inter;
mpf_init(a);
mpf_init(b);
mpf_init(inter);
mpf_set_d(a, 3.0);
mpf_set_d(b, 5.0);
mpf_add(inter, a, b);
gmp_printf("%F+%F=%F\n", a, b, inter);
}
For some reason, it compiles alright, but when run, it produces
error while loading shared libraries: libgmp.so.10: cannot open shared object file: No such file or directory
What’s wrong?
It would appear
/usr/local/libis not in/etc/ld.so.confor/etc/ld.so.conf.d/*.If it is simply run
sudo ldconfig(orldconfigas root) and try again.If it is not, either add it or manually override the library path for the command:
It does seem your configuration is strange, check that
/usr/local/lib/libgmp.so.10is a link to/usr/local/lib/libgmp.so.10.0.2, e.g.