No compatible gmp libraries found

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 in order, but at startup it produces

 error while loading shared libraries: libgmp.so.10: cannot open shared object file: No such file or directory 

What's wrong?

+4
source share
1 answer

It would seem that /usr/local/lib not located in /etc/ld.so.conf or /etc/ld.so.conf.d/* .

If it just starts sudo ldconfig (or ldconfig as root user) and try again.

If this is not the case, add it or manually override the library path for the command:

 LD_LIBRARY_PATH=/usr/local/lib ./myprogram 

It seems your configuration is strange, make sure that /usr/local/lib/libgmp.so.10 is a link to /usr/local/lib/libgmp.so.10.0.2 , for example.

 $ ls -ltr /usr/lib/libgmp.so.3 lrwxrwxrwx 1 root root 15 2011-07-27 12:15 /usr/lib/libgmp.so.3 -> libgmp.so.3.5.2 
+7
source

Source: https://habr.com/ru/post/1369426/


All Articles