Probably you need a symbolic link from /home/mylibs/libz.so
to /home/mylibs/libz.so.1
.
Note that -lz
will search for libz.so
, but not libz.so.1
, so the linker will keep on searching and will find such a link in /usr/local/lib
.
Other than that, you make want to show the NEEDED entries (which record dynamic dependencies) in the header of your executable, with:
$ objdump -x a.out | grep NEEDED
to see if they are recorded with the full path, as libz.so
or as libz.so.1
.