Operating System - HP-UX
1820160 Members
2828 Online
109620 Solutions
New Discussion юеВ

Re: Setting env LD_LIBRARY_PATH

 
SOLVED
Go to solution
Rafael Casero
Regular Advisor

Setting env LD_LIBRARY_PATH

I'm trying to setup LD_LIBRARY_PATH env for a user, not sure how to do this.

This is what i want it to look like.

LD_LIBRARY_PATH=/app/oracle/product/9.2.0/lib32:/egate/client/bin:/egate/server/
bin:/egate/client/JRE/1.3.1_02/lib/PA_RISC:/opt/java1.3/jre/lib/PA_RISC:/opt/for
esight/HVInstream:/opt/foresight/HVInstream/java:/opt/foresight/HVInstream/bin:/
app/oracle/product/9.2.0/lib

Can some help me out. PLEASE....
21 REPLIES 21
A. Clay Stephenson
Acclaimed Contributor
Solution

Re: Setting env LD_LIBRARY_PATH

You put that line in the user's .profile and use this syntax:

LD_LIBRARY_PATH=/xxx/yyy:/aaa/bbb/ccc
export LIBRARY_PATH
or
export LD_LIBRARY_PATH=/xxx/yyy:/aaa/bbb/ccc

so, your original line with the keyword 'export ' prepended will do the trick.

If the user is a csh user then you put the a similar entry in .cshrc and

setenv LD_LIBRARY PATH /xxx/yyy:/aaa/bbb/ccc

Often when LD_LIBRARY_PATH is needed SHLIB_PATH is also needed.
If it ain't broke, I can fix that.
A. Clay Stephenson
Acclaimed Contributor

Re: Setting env LD_LIBRARY_PATH

OH, in case it is not obvious, .profile and/or .cshrc are located in each user's home directory and are sourced as the user logs in.
If it ain't broke, I can fix that.
Rafael Casero
Regular Advisor

Re: Setting env LD_LIBRARY_PATH

It would not let me put all the path's in,

It cuts the end off
:/app/oracle/product/9.2.0/lib

Would I be able to add more path's once it's created and how would I go along doing this.

I very new in this env...

Thanks..
A. Clay Stephenson
Acclaimed Contributor

Re: Setting env LD_LIBRARY_PATH

What is "it"? You should be using a text editor such as vi and all of this is one line. Vi allows very long lines that will wrap around.

You can also do something like this:

LD_LIBRARY_PATH=/xxx/yyy/zzz:/aaa/bbc
LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:/mickey/mouse
LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:/donald/duck
export LD_LIBRARY_PATH

The idea is that you can keep adding on the the variable and then finally export it.
If it ain't broke, I can fix that.
Rafael Casero
Regular Advisor

Re: Setting env LD_LIBRARY_PATH

I must be doing something wrong.

1. I su as the user.
2. I set LD_LIBRARY_PATH
3. I export LD_LIBRARY_PATH

I logout and then log back in, it tells me

$ echo $LD_LIBRARY_PATH
su: LD_LIBRARY_PATH: Parameter not set.
James R. Ferguson
Acclaimed Contributor

Re: Setting env LD_LIBRARY_PATH

Hi Rafael:

If you 'su' without the '-' as:

# su rafael

...then user 'rafael's profile is *not* sourced! You need to do:

# su - rafael

...to cause /home/rafael/.profile (for example) to be read (sourced).

Regards!

...JRF...
Rafael Casero
Regular Advisor

Re: Setting env LD_LIBRARY_PATH

I use

su - rafael

And still getting the same results.


A. Clay Stephenson
Acclaimed Contributor

Re: Setting env LD_LIBRARY_PATH

Okay do this and post the output of each command:

1) Let's make certain that rafael's home directory (and shell) is what we think it is:

logins -o -x -l rafael #(Do this as root)

2) Now let's see if the file exists and owner/mode of the file:
ls -l /home/rafael/.profile

3) Finally, let's see what your .profile actually looks like:

cat /home/rafael/.profile
If it ain't broke, I can fix that.
Darrel Louis
Honored Contributor

Re: Setting env LD_LIBRARY_PATH

Hi,

Are putting the LD_LIBRARY_PATH in your .profile?
Do you have permission to access the specified directories?

Darrel
Rafael Casero
Regular Advisor

Re: Setting env LD_LIBRARY_PATH

Here is the outcome.

1)logins -o -x -l egate #(Do this as root)

miaux10: / =>login -o -x -l egate
Password:
Login incorrect

Wait for login retry: ..
login: egate
Password:
No utmp entry.You must exec "login" from the lowest level "sh".

Wait for login exit: ..
$

2)ls -l /home/egate/.profile

miaux10: / =>ls -l /home/egate/.profile
-r--r--r-- 1 egate egate 1794 Jun 21 15:15 /home/egate/.profile

3) cat /home/egate/.profile

miaux10: / =>cat /home/egate/.profile

# @(#)B11.23_LR

# Default user .profile file (/usr/bin/sh initialization).

# Set up the terminal:
if [ "$TERM" = "" ]
then
eval ` tset -s -Q -m ':?hp' `
else
eval ` tset -s -Q `
fi
stty erase "^H" kill "^U" intr "^C" eof "^D"
stty hupcl ixon ixoff
tabs

# Set up the search paths:
export PATH=/egate/client/bin:\
/egate/client/JRE/1.3.1_02/bin:\
/egate/client/odbc40/bin:\
/egate/client/odbc40/lib:\
/egate/server/bin:\
/opt/bin:\
/opt/imake/bin:\
/opt/java1.3/bin:\
/opt/java1.3/lib:\
/opt/langtools/bin:\
/opt/perl/lib/5.6.1:\
/opt/perl/bin:\
/opt/sec_mgmt/spc/bin:\
/usr/bin:\
/usr/lib:\
/usr/local/bin:\
$ORACLE_HOME/bin:\
/opt/foresight/HVInstream:\
/opt/foresight/HVInstream/java:\
/opt/foresight/HVInstream/bin:\
$PATH

# Set up the shell environment:
set -u
trap "echo 'logout'" 0

# Set up the shell variables:
EDITOR=vi
export EDITOR

. oracle_setup

export LD_LIBRARY_PATH=/app/oracle/product/9.2.0/lib32:\
/egate/client/bin:\
/egate/server/bin:\
/egate/client/JRE/1.3.1_02/lib/PA_RISC:\
/opt/java1.3/jre/lib/PA_RISC:\
/opt/foresight/HVInstream:\
/opt/foresight/HVInstream/java:\
/opt/foresight/HVInstream/bin:\
$LD_LIBRARY_PATH

LIBPATH=/egate/server/bin

export SHLIB_PATH=/app/oracle/product/9.2.0/lib32:\
/egate/client/bin:\
/egate/client/JRE/1.3.1_02/lib/PA_RISC:\
/egate/client/JRE/1.3.1_02/lib/PA_RISC/classic:\
/egate/client/odbc40/lib:\
/egate/server/registry/repository/default/JRE/1.3.1_02/lib/PA_RISC/classic:\
/opt/java1.3/jre/lib/PA_RISC:\
/opt/foresight/HVInstream:\
/opt/foresight/HVInstream/java:\
/opt/foresight/HVInstream/bin:\
$SHLIB_PATH


export ODBCINI=/home/egate/.odbc.ini
export ORACLE_SID=xchgtst

export PGPPASS=jumbojet
export PGPPATH=/home/egate

export TEMP=/egate/SMIME_TEMP
export FSINSTREAMINI=/opt/foresight/HVInStream/bin

A. Clay Stephenson
Acclaimed Contributor

Re: Setting env LD_LIBRARY_PATH

You didn't execute this correctly. The command is "logins"; not "login" and you must already be logged in as root to execute it. This will look at the passwd file and tcb entries related to a specific user. I'm trying to determine home directory and shell of this user.

logins -o -x -l egate

Carefully check each of your continued lines that "\" is the very last character of such a line. Specificically, "\" is not a valid line continuation but "\" is.

The other thing to check is the sourced file oracle_setup. Make sure that there are no exit or return statements in it; if any of these are found the current process exits at that point and anything in .profile after that is never executed.
If it ain't broke, I can fix that.
Rafael Casero
Regular Advisor

Re: Setting env LD_LIBRARY_PATH

Sorry, thanks..

miaux10: / =>logins -o -x -l egate
egate:110:egate:110:,,,:/home/egate:/usr/bin/sh:PS:061906:0:90:14
James R. Ferguson
Acclaimed Contributor

Re: Setting env LD_LIBRARY_PATH

Hi Rafael:

OK, the problem is that you are trying to setup LD_LIBRARY_PATH to contain a series of pathes prepended to whatever the variable's current value represents. However, if the current value is null (undefined) you get the error " LD_LIBRARY_PATH: Parameter not set".

You could place this statement ahead of your 'export' declaration.

LD_LIBRARY_PATH=${LD_LIBRARY_PATH:=" "}

...This should achieve your purpose.

Regards!

...JRF...
Peter Nikitka
Honored Contributor

Re: Setting env LD_LIBRARY_PATH

Hi,

I perform this the same way HP-UX handles PATH and MANPATH:

- create a file /etc/LD_LIBRARY_PATH containing the requested values

- in ~/.profile or similar use:
if [ -s /etc/LD_LIBRARY_PATH ]
then
LD_LIBRARY_PATH=`cat /etc/LD_LIBRARY_PATH`
export LD_LIBRARY_PATH
fi

- I would ignore a preset envvar LD_LIBRARY_PATH from the admin point of view and handle all via this file.

mfG Peter
The Universe is a pretty big place, it's bigger than anything anyone has ever dreamed of before. So if it's just us, seems like an awful waste of space, right? Jodie Foster in "Contact"
A. Clay Stephenson
Acclaimed Contributor

Re: Setting env LD_LIBRARY_PATH

You also have the same potential problem with SHLIB_PATH being undefined (as well as PATH although PATH will almost certainly have a value unless /etc/profile has been "improved").

You could do a "set +u" so that undefined variables do not cause an error but that is really considered sloppy so the better approach is test a variable before doing an assignment.
If it ain't broke, I can fix that.
V. Nyga
Honored Contributor

Re: Setting env LD_LIBRARY_PATH

Hi,

you have to check if the user already has an env variable.

This example is for csh and SHLIB_PATH:

if ($?SHLIB_PATH) then
setenv SHLIB_PATH ${SHLIB_PATH}:/opt/java1.4/jre/lib/PA_RISC/server:/opt/java1.4/jre/lib/PA_RISC
else
setenv SHLIB_PATH /opt/java1.4/jre/lib/PA_RISC/server:/opt/java1.4/jre/lib/PA_RISC
endif


HTH
Volkmar
*** Say 'Thanks' with Kudos ***
Rafael Casero
Regular Advisor

Re: Setting env LD_LIBRARY_PATH

Yes,

I have it all defined in the .profile...

# @(#)B11.23_LR

# Default user .profile file (/usr/bin/sh initialization).

# Set up the terminal:
if [ "$TERM" = "" ]
then
eval ` tset -s -Q -m ':?hp' `
else
eval ` tset -s -Q `
fi
stty erase "^H" kill "^U" intr "^C" eof "^D"
stty hupcl ixon ixoff
tabs

# Set up the search paths:
PATH=$PATH:/usr/local/bin:.

# Set up the shell environment:
set -u
trap "echo 'logout'" 0

# Set up the shell variables:
EDITOR=vi
export EDITOR

#. oenv xchgprd


export LD_LIBRARY_PATH=/egate/client/bin:/egate/server/bin:/egate/client/JRE/1.3.1_02/lib/PA_RISC:/opt/java1.3/jre/lib/PA_RISC:/opt
/foresight/HVInstream:/opt/foresight/HVInstream/java:/opt/foresight/HVInstream/bin:$LD_LIBRARY_PATH

export LIBPATH=/egate/server/bin

export SHLIB_PATH=/egate/client/bin:\
/egate/client/JRE/1.3.1_02/lib/PA_RISC:\
/egate/client/JRE/1.3.1_02/lib/PA_RISC/classic:\
/egate/client/odbc40/lib:\
/egate/server/registry/repository/default/JRE/1.3.1_02/lib/PA_RISC/classic:\
/opt/java1.3/jre/lib/PA_RISC:\
/opt/foresight/HVInstream:\
/opt/foresight/HVInstream/java:\
/opt/foresight/HVInstream/bin
Peter Nikitka
Honored Contributor

Re: Setting env LD_LIBRARY_PATH

Hi,

in what way do you login to the host?

- CDE
Check
fgrep PROFILE ~/.dtprofile
for a line like
DTSOURCEPROFILE=true


- telnet
- ssh

What is the result of
set | fgrep LIB
after login?


mfG Peter
The Universe is a pretty big place, it's bigger than anything anyone has ever dreamed of before. So if it's just us, seems like an awful waste of space, right? Jodie Foster in "Contact"
Rafael Casero
Regular Advisor

Re: Setting env LD_LIBRARY_PATH

I use telnet to connect.


$ set |fgrep LIB
$

Comes back to a prompt...
Peter Nikitka
Honored Contributor

Re: Setting env LD_LIBRARY_PATH

Hi,

please send the following output:

1) echo $0 $SHELL
2) fgrep LD_LIBRARY_PATH ~/.profile
3) set -x
. ./.profile


mfG Peter
The Universe is a pretty big place, it's bigger than anything anyone has ever dreamed of before. So if it's just us, seems like an awful waste of space, right? Jodie Foster in "Contact"
Rafael Casero
Regular Advisor

Re: Setting env LD_LIBRARY_PATH

I got it to work...

It was a syntax error.

Thanks all for your support.. Learned a little more about env.

Thanks.