LD_LIBRARY_PATH

Can I set LD_LIBRARY_PATH for a single application? I am studying a system call failure so that I can set the correct path using the LD_LIBRARY_PATH parameter?

+3
source share
3 answers

The simplest way would be to create a shell script.

Ask the shell script to export the new LD_LIBRARY_PATH variable, and then run the application

eg. (where foo is your application)

#!/bin/sh
LD_LIBRARY_PATH=some_path:$LD_LIBRARY_PATH
export LD_LIBRARY_PATH
foo
+11
source

Easier than:

LD_LIBRARY_PATH=new_path:$LD_LIBRARY_PATH foo

which works in bash. I think that it works in all derivatives of the bourne shell, but I cannot guarantee this.

Of course, with this approach, you need to enter a path each time. To do this again, prefer Glen's approach .

+7

, : LD_LIBRARY_PATH - . , (ld.so.1 - ) , - . , , exec() . , !

+5

Source: https://habr.com/ru/post/1707789/


All Articles