Hi Vasu,
This is a dynamic linker problem. Linking with shared libraries is done
every time you run a program. The compiler has indeed found the
libraries and that is why your `a.out' has been created.
The dynamic linker looks into the `LD_LIBRARY_PATH' shell variable to
find the libraries. So you have to put `/myinst/lib/' in this variable.
You can do this with a command like below. You can also put it in your
`~/.bashrc' to be available at startup of your interactive bash sessions.
export LD_LIBRARY_PATH="/myinst/lib/:$LD_LIBRARY_PATH"
For more on custom installation paths, you can see the explanations in
the link below.
https://www.gnu.org/software/gnuastro/manual/html_node/Installation-directory.html
Cheers,
Mohammad