Set LD_LIBRARY_PATH to 1 or empty


 
Thread Tools Search this Thread
Operating Systems AIX Set LD_LIBRARY_PATH to 1 or empty
# 1  
Old 12-11-2012
Set LD_LIBRARY_PATH to 1 or empty

I have a question on setting environmental variable LD_LIBRARY_PATH.
The case is that, i cannot execute wget on my AIX machine.
It return the following error:
Code:
exec(): 0509-036 Cannot load program wget because of the following errors:
        0509-022 Cannot load module /opt/freeware/lib/libintl.a(libintl.so.8).
        0509-150   Dependent module /usr/lib/libiconv.a(libiconv.so.2) could not be loaded.
        0509-152   Member libiconv.so.2 is not found in archive
        0509-022 Cannot load module wget.
        0509-150   Dependent module /opt/freeware/lib/libintl.a(libintl.so.8) could not be loaded.
        0509-022 Cannot load module .

After I unset the environmental variable LD_LIBRARY_PATH using "unset" command, wget can working properly.
Then I set the variable to "1", wget also working properly.
Finally, I set it to "", wget prompt the above error message again.
So, would you tell me what going on? and why wget can working even $LD_LIBRARY_PATH="1"?

thank you very much
# 2  
Old 12-11-2012
First off,

Code:
$LD_LIBRARY_PATH="1"

Will not set the variable "LD_LIBRARY_PATH", but a variable of the name whatever "$LD_LIBRARY_PATH" will evaluate to. Maybe it was only a typo of yours, i mention this just to be sure.

Second, "LD_LIBRARY_PATH" works like the "PATH" variable, just for libraries instead of executables. Why it works if you set it to the nonsense value of "1" i don't know. Whenever you create a new shell, "/etc/environment" and your local user environment (most times "~/.kshrc") is read and parsed in, probably presetting "LD_LIBRARY_PATH" to some sensible value. Have a look there to which value it is set.

I hope this helps.

bakunin
# 3  
Old 12-11-2012
What is LD_LIBRARY_PATH before you change it?
# 4  
Old 12-11-2012
Firstly, I set LD_LIBRARY_PATH in my .profile as following:

export LD_LIBRARY_PATH=""

Then wget does not work.
After that, I change LD_LIBRARY_PATH as mention.
What I want to know is how the system behave when the LD_LIBRARY_PATH set to empty or null?So, that wget does not work.
# 5  
Old 12-12-2012
Quote:
Originally Posted by cstsang
What I want to know is how the system behave when the LD_LIBRARY_PATH set to empty or null?So, that wget does not work.
OK, let us start from the beginning: there has to be some way the system knows where to load shared libraries, analogous to the way it has to know where to load executables. For executables, there is the "PATH" variable and for (shared) libraries there is the variable "LD_LIBRARY_PATH". This is so in every Unix derivate.

AIX now usually ignores the value of "LD_LIBRARY_PATH" (unlike, for instance, Solaris) and uses the value of "LIBPATH" instead for the same purpose. So if a program written for "generic Unix" tells you to set LD_LIBRARY_PATH to some value you can safely change this for "LIBPATH" if you are using AIX.

BUT - and now it comes: every program has to be compiled and linked before it can be run. In AIX, if LIBPATH is set when the linker ("ld") is invoked, then the resulting executable will ignore the setting of "LIBPATH" and use the value set at link time instead. One can override this behavior by using the "-L" flag for "ld".

If you want to know with which flags/settings a program is linked with use the "dump -n" command against the binary.

I hope this helps.

bakunin
# 6  
Old 12-12-2012
dump -H

Code:
dump -H

lists information about expected library paths and names.

I do not have wget installed, so I cannot provide that example - here is another one:

Code:
michael@x054:[/home/michael]dump -H /opt/httpd/sbin/httpd

/opt/httpd/sbin/httpd:

                        ***Loader Section***
                      Loader Header Information
VERSION#         #SYMtableENT     #RELOCent        LENidSTR
0x00000001       0x000003ec       0x00000c11       0x00000091       

#IMPfilID        OFFidSTR         LENstrTBL        OFFstrTBL
0x00000007       0x0000ef0c       0x00005002       0x0000ef9d       


                        ***Import File Strings***
INDEX  PATH                          BASE                MEMBER              
0      /opt/lib:/usr/vac/lib:/usr/lib:/lib                                         
1                                    libpcre.a           libpcre.so.1        
2                                    libaprutil.so                           
3                                    libapr.so                               
4                                    libpthread.a        shr_xpg5.o          
5                                    libc.a              shr.o               
6                                    librtl.a            shr.o

The INDEX 0 is the default library search path the binary will use. If you set a LD_LIBRARY_PATH you override that, and maybe your libraries are not searching properly.

Also note: TE (trusted execution) can prevent you from using LD_LIBRARY_PATH - to prevent someone from being able to insert a trojan library.

Hope this helps!
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Problem with LD_LIBRARY_PATH

I am on Solaris . I have written a script callled T_1.sh #!/bin/sh ######################################################################################################## # # Source borne shell env.This is required for crontab to work as bip.sh uses environmental variables.... (24 Replies)
Discussion started by: rafa_fed2
24 Replies

2. Shell Programming and Scripting

Ld_library_path

Hi., Currently my LD_LIBRARY_PATH setting is, LD_LIBRARY_PATH=/opt/app/product/11.2.0/client_1/lib Now, I need to append the JAVA to this setting... Can I set this way, Please suggest. ... (4 Replies)
Discussion started by: nuthakki
4 Replies

3. Shell Programming and Scripting

updating LD_LIBRARY_PATH

Inside my csh script, I have the following command: source ${HOME}/.login When I execute my csh script, why do I get the following error message: /cygdrive/c/WINDOWS/system32/export: Permission denied This is what I have inside my .login #!/bin/bash export... (9 Replies)
Discussion started by: casau
9 Replies

4. UNIX for Dummies Questions & Answers

Ld_library_path & path

I have googled around to find the difference between LD_LIBRARY_PATH & PATH. But the answers are creating more confusion. What is exact difference between these two paths? (1 Reply)
Discussion started by: tostay2003
1 Replies

5. HP-UX

SHLIB_PATH or LD_LIBRARY_PATH

hi Im using HP-UX 11i,PARISC .... Where do i find SHLIB_PATH or LD_LIBRARY_PATH , i couldnt find in env, listing...... Moreover im trying to execute file its throwing me error usr/lib/dld.sl: Can't find path for shared library: libgcc_s.sl /usr/lib/dld.sl: No such file or directory... (3 Replies)
Discussion started by: vasanthan
3 Replies

6. UNIX for Advanced & Expert Users

Difference between LIB_PATH and LD_LIBRARY_PATH

I would like to know the differences between LIB_PATH and LD_LIBRARY_PATH on Linux and SunOS. I am getting an error while loading shared libraries on Linux (Omni works build environment) as shown below: 1:tradewind/dataaccess/*.pcc... (1 Reply)
Discussion started by: shafi2all
1 Replies

7. UNIX for Advanced & Expert Users

Difference between LIB_PATH and LD_LIBRARY_PATH

I would like to know the differences between LIB_PATH and LD_LIBRARY_PATH on Linux and SunOS. I am getting an error while loading shared libraries on Linux (Omni works build environment) as shown below: 1:tradewind/dataaccess/*.pcc... (1 Reply)
Discussion started by: shafi2all
1 Replies

8. UNIX for Dummies Questions & Answers

Ld_library_path

Hi, can anyone explain this terrm? should we setup it ? Thanks (1 Reply)
Discussion started by: ccp
1 Replies

9. UNIX for Dummies Questions & Answers

Bash LD_LIBRARY_PATH?

Hello I have just tried to install ns-allineone-2.31 on cygwin cygwin is using the bash shell it asks for somethings to be put into the LD_LIBRAY_PATH, here is a snippet of what it says. (1) You MUST put /home/Chris/ns-allinone-2.31/otcl-1.13, /home/Chris/ns-allinone-2.31/lib, into your... (1 Reply)
Discussion started by: bysonary
1 Replies

10. UNIX for Advanced & Expert Users

cc, setuid, and LD_LIBRARY_PATH

Hi, This question deals with Solaris 2.8 and setuid programs. From research I've done so far, setuid programs ignore LD_LIBRARY_PATH; I've proven this and am OK with it. The thing I am not certain of how the C compiler is supposed to behave when it is invoked via a setuid program. Basically,... (0 Replies)
Discussion started by: WolfBoy
0 Replies
Login or Register to Ask a Question