How to set the environmental variable LD_LIBRARY_PATH in linux

后端 未结 10 1683
独厮守ぢ
独厮守ぢ 2020-11-22 11:11

I have first executed the command: export LD_LIBRARY_PATH=/usr/local/lib

Then I have opened .bash_profile file: vi ~/.bash_profile

10条回答
  •  野性不改
    2020-11-22 11:27

    You should add more details about your distribution, for example under Ubuntu the right way to do this is to add a custom .conf file to /etc/ld.so.conf.d, for example

    sudo gedit /etc/ld.so.conf.d/randomLibs.conf
    

    inside the file you are supposed to write the complete path to the directory that contains all the libraries that you wish to add to the system, for example

    /home/linux/myLocalLibs
    

    remember to add only the path to the dir, not the full path for the file, all the libs inside that path will be automatically indexed.

    Save and run sudo ldconfig to update the system with this libs.

提交回复
热议问题