How to link a specific version of a shared library in makefile without using LD_LIBRARY_PATH?

前端 未结 2 1911
面向向阳花
面向向阳花 2020-12-16 20:28

I know that LD_LIBRARY_PATH is evil and it\'s a good habit to avoid using it. I have a program called server.c on a remote Solaris 9 server that holds two versi

相关标签:
2条回答
  • 2020-12-16 21:05

    I figured out that I can include the absolute path of the specific library that I want to link to and it worked fine for me:

    LD = ${RPATH} -lsocket -lnsl -lpthread ${OPENSSLDIR}/lib/libssl.so.1.0.0 \
             ${OPENSSLDIR}/lib/libcrypto.so.1.0.0
    

    If you are using g++, Piotr Lesnicki pointed out that -l:libssl.so.1.0.0 also works. See more at the original post.

    0 讨论(0)
  • 2020-12-16 21:08

    Do you have any links to the SSL lib? If not, can you create a link to the the desired SSL lib like

    ln -s libssl.so.1.0.0 libssl.so 
    

    in the ssl directory and try it

    0 讨论(0)
提交回复
热议问题