Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Setting path on AIX machine.

Status
Not open for further replies.

borntorun

MIS
Oct 16, 2003
82
GB
Guys,

I come from a solaris background and this is driving me nuts.

I need to find a library file from /usr/lib...

So i have a korn shell profile that i have setup as the following:

LIBPATH=/usr/lib
LD_LIBRARY_PATH=/usr/lib
PATH=/usr/lib
export PATH LIBPATH LD_LIBRARY_PATH

Now if i do a which on two files in the /usr/lib it finds one but not the other.

What am i doing wrong?

Example:

$ which librtl.a
/usr/lib/librtl.a

However:

$ which libC.a
which: 0652-141 There is no libC.a in /usr/lib

Now they both exist in the /usr/lib:

$ ls -la libC.a
lrwxrwxrwx 1 bin bin 23 Jul 12 2003 libC.a -> /usr/lpp/xlC/
lib/libC.a

$ ls -la librtl.a
lrwxrwxrwx 1 bin bin 21 Jul 12 2003 librtl.a -> /usr/ccs/li
b/librtl.a

Thanks.
 
which uses any C environment that is configured. If you are using k-shell then you should use the type command.

man which gives

DESCRIPTION
which takes a list of names and looks for the files which would be executed had these names been given as commands. Each argument is expanded if it is aliased, and searched for along the user's path. Both aliases and path are taken from the user's .cshrc file.

man type gives

DESCRIPTION
The type utility indicates how each name operand would be interpreted if used as a command. type displays information about each operand identifying the operand as a shell built-in, function, alias, hashed command, or keyword, and where applicable, may display the operand's path name.





I love deadlines. I like the whooshing sound they make as they fly by - Douglas Adams
 
AIX uses colon-separated LIBPATH.

Don't murder the existing values of LIBPATH and PATH either.

 
As far as I know, Solaris uses colon separated *PATH variables either.

which is used for determining directory of executable files in the directories enumerated in PATH variable. Executables uses LIBPATH (and sometimes LD_LIBRARY_PATH) to fetch their libraries. Thus, if you have a program "someprogram" residing in "/somesoftware/bin" and it is using a library "somelib.o" that resides in "/somesoftware/lib/" then you will need to
set PATH=$PATH:/somesoftware/bin
and
set LIBPATH=$LIBPATH:/somesoftware/lib

After these settings you will be able to determine the directory of program file named "someprogram" and running "someprogram" will it be able to fetch his library called "somelib.o"

If you want to set these variables permanently, you will need to modify /etc/environment and logout-login afterwards.

There is a free software to list libraryes needed for an executable, it is called ldd. You van find it for example on the
--Trifo
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top