Skip to content

Linking using LD LIBRARY PATH

Mark Winn edited this page Nov 1, 2019 · 2 revisions

Linking using LD_LIBRARY_PATH is a lot simpler than linking using ldconfig (not to say that linking using ldconfig is that hard). To do this you can simply run export LD_LIBRARY_PATH=<path to libs>, so in our case export LD_LIBRARY_PATH=/usr/lib/myosp (if libmyosp has been installed to /usr/lib/myosp).

There is a possibility that there is something pre-existing in LD_LIBRARY_PATH, to check this before overwriting run the command echo $LD_LIBRARY_PATH, if it returns anything other than a blank line, it is already being used. If this is the case, we just need to ensure that our directory comes before that of mysql's library directory. The quick way of doing this is running the command: export LD_LIBRARY_PATH=/usr/lib/myosp:$LD_LIBRARY_PATH.

By running these commands on your terminal command prompt, they will be erased at the end of your terminal session. To ensure it stays to future terminal sessions, you can add these commands to one of your profile files. This could be at /etc/profile or if you are using bash shell, it is probably better to add it into ~/.bashrc , ~/.bash_profile , or ~/.profile. This can be different on different systems, so ensure you do some research on how to set environment variables on session start up on your specific system.

Clone this wiki locally