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
source share