Operating System - HP-UX
1827481 Members
2039 Online
109965 Solutions
New Discussion

Re: trouble setting default SHLIB_PATH environmental

 
SOLVED
Go to solution
Lynne Seamans
Regular Advisor

trouble setting default SHLIB_PATH environmental

I just installed SyncSort on my 11.0 box (L2000)
and it requires an entry in the SHLIB_PATH
environmental variable. No problem, i figure, so, i went to /etc/SHLIB_PATH and added their library to
what was already there. The same sort of thing
works find for /etc/PATH all the time....

HOWEVER, when i logon and echo $SHLIB_PATH, it says "sh: SHLIB: Parameter not set."

Is there something else i have to do to make the
system "see" the default SHLIB_PATH in /etc like
it does the default PATH in /etc?

Thanks for any pointers... Lynne Seamans,
8 REPLIES 8
Bill McNAMARA_1
Honored Contributor

Re: trouble setting default SHLIB_PATH environmental

Show us your export command

should be something like
export $PATH=$PATH:/extra_path
echo $PATH to verify

or any other variable
echo $VARIABLE
export VARIABLE=value

It works for me (tm)
Andreas Voss
Honored Contributor

Re: trouble setting default SHLIB_PATH environmental

Hi,

think you have to put a line ie:

SHLIB_PATH=/...... ; export SHLIB_PATH

into your /etc/profile

Regards
Steven Sim Kok Leong
Honored Contributor

Re: trouble setting default SHLIB_PATH environmental

Hi,

Think you made a typo in your query. When you echo $SHLIB_PATH, if it has not been set, it should say "sh: SHLIB_PATH: Parameter not set." instead of "sh: SHLIB: Parameter not set." as indicated.

As already mentioned by the rest, assigning and exporting it in the global /etc/profile is the cleanest.

If you only want to tailor SHLIB_PATH specifically to a login account, then you have to add it into ~/.profile of that login user for sh, bash, ksh shells. For csh and tcsh shells, you have to add eg. "setenv SHLIB_PATH /a/b/c:/d/e/f" into either ~/.cshrc or ~/.login.

Hope this helps. Regards.

Steven Sim Kok Leong
Brainbench MVP for Unix Admin
http://www.brainbench.com
Lynne Seamans
Regular Advisor

Re: trouble setting default SHLIB_PATH environmental

Details:
Here is my exact /etc/SHLIB_PATH

/usr/lib:/opt/cobol/cobdir/coblib:/etc/opt/resmon/lib:/usr/local/syncsort/lib

If i don't put anything in my profile, shouldn't I get those values?

BUt anyways, I did put in my profile :

SHLIB_PATH=$SHLIB_PATH:/usr/local/syncsort/lib
export SHLIB_PATH

which i realize would give me syncsort twice, but
i'm just testing.

when i logged back on i got:

.profile[32]: SHLIB_PATH: Parameter not set.

which made me think the $SHLIB_PATH didn't
have any value to add anything to.
Bill McNAMARA_1
Honored Contributor

Re: trouble setting default SHLIB_PATH environmental

Sorry I made a typo too..
I think you all spotted it on the export..

In any case, in your .profile on line 32 are you trying to reference the SHLIB_PATH env variable before it is exported. Your export cammand looks just fine.
echo $SHLIB_PATH even though there is an error in your case should work if that were the case.

You might want to add a set -x near the top of your .profile to debug the .profile.

To source your profile on the fly try
. ~/.profile


Later,
Bill
It works for me (tm)
Lynne Seamans
Regular Advisor

Re: trouble setting default SHLIB_PATH environmental

Now wait, let's back up here.

For PATH, if I want to add to the stuff i get for "free"
in /etc/PATH, i put close to the top of my .profile
PATH=$PATH:newstuff:morenewstuff
and it works, no exporting, whatever.

That's what i'm trying to do for SHLIB_PATH.
So, that's what I just tried. my profile is:
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
".profile" 71 lines, 1536 characters
# @(#) $Revision: 74.2 $
# Default (example of) super-user's .profile file
# Do not put "." in PATH; it is a potential security breach.
# Do not put "/usr/local/bin" in PATH; it is a potential security breach.
# Example assumes /home/root exists.
set +u
PATH=/usr/sbin:$PATH:/sbin:/home/root/bin:/opt/sudo/bin:/opt/sudo/etc:/opt/omni/sbin:/usr/local/sbin
MANPATH=$MANPATH:/opt/sudo/man
SHLIB_PATH=$SHLIB_PATH:/usr/local/syncsort/lib=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
PATH and MANPATH are right. when i say
echo $SHLIB_PATH it says:
:/usr/local/syncsort/lib
which implies the $SHLIB_PATH was null, and i only
got the appended stuff.

Where's the values from /etc/SHLIB_PATH????
Steven Sim Kok Leong
Honored Contributor
Solution

Re: trouble setting default SHLIB_PATH environmental

Hi,

I believe you will have to deal with /etc/SHLIB_PATH differently from /etc/PATH. Notice that when you perform a grep of '/etc/PATH', it is referenced in /etc/csh.login and /etc/profile. However, /etc/SHLIB_PATH is not referenced anywhere in /etc/*.

Thus, SHLIB_PATH variable has to be explicitly assigned or you can choose to modify /etc/profile or /etc/csh.login to source /etc/SHLIB_PATH within the script itself.
=========================================
# cd /etc
# grep 'SHLIB_PATH' * 2>/dev/null
#
# grep '/etc/PATH' * 2>/dev/null
csh.login: if ( -r /etc/PATH ) then
csh.login: # present in /etc/PATH then $PATH is set to the contents
csh.login: # of /etc/PATH. Otherwise, add the contents of /etc/PATH
csh.login: -e ':/usr/bin$' /etc/PATH
csh.login: set path=($path `tr ":" " " csh.login: set path=(`tr ":" " " profile:# Modify the variables through /etc/PATH and /etc/MANPATH
profile: else if [ -r /etc/PATH ]
profile: # present in /etc/PATH then $PATH is set to the contents
profile: # of /etc/PATH. Otherwise, add the contents of /etc/PAT
H
profile: -e ":/usr/bin$" /etc/PATH
profile: PATH=`cat /etc/PATH`
profile: PATH=$PATH:`cat /etc/PATH`
=========================================

Hope this helps. Regards.

Steven Sim Kok Leong
Brainbench MVP for Unix Admin
http://www.brainbench.com
Lynne Seamans
Regular Advisor

Re: trouble setting default SHLIB_PATH environmental

That was it... the default profile (namely /etc/profile) did
NOT cat the data in /etc/SHLIB_PATH the way it did for
/etc/PATH and /etc/MANPATH, so naturally it wasn't
picked up at login.

Just had to change /etc/profile to include a:

SHLIB_PATH=`cat /etc/SHLIB_PATH`

and all was fine. Thanks!