Обсуждение: Error while loading shared libraries

Поиск
Список
Период
Сортировка

Error while loading shared libraries

От
yulytenorio@gmail.com
Дата:
Hello,
I have installed postgresql, version 8.3.3. and when I run: su -l postgres
-c "/usr/local/pgsql/bin/createuser  -d -a nobody", I get this error:

sh-2.05b# su -l postgres  -c "/usr/local/pgsql/bin/createuser  -d -a nobody"
/usr/local/pgsql/bin/createuser: error while loading shared libraries:
libz.so.1: cannot open shared object file: No such file or directory

However, this library is there..:
sh-2.05b# su -l postgres  -c "echo $LD_LIBRARY_PATH"
/lib:/usr/lib:/opt/IBM-ME-2.2.2/jre/bin:/usr/local/pgsql/lib

sh-2.05b# su -l postgres  -c "ls -ls /usr/lib/libz.*"
 0 lrwxrwxrwx  1 root root    24 Jul 25 13:46 /usr/lib/libz.so ->
/usr/lib/libz.so.1.2.2.2
 0 lrwxrwxrwx  1 root root    24 Jul 25 13:46 /usr/lib/libz.so.1 ->
/usr/lib/libz.so.1.2.2.2
76 -rwxr-xr-x  1 root root 75568 Jul 25 13:45 /usr/lib/libz.so.1.2.2.2
sh-2.05b#

So I was wondering if you guys could help me! I do not know what is wrong
:-(
Is createuser not looking at LD_LIBRARY_PATH for its libraries?
Thanks,
--
- Yuly

Re: Error while loading shared libraries

От
Craig Ringer
Дата:
yulytenorio@gmail.com wrote:
> Hello,
> I have installed postgresql, version 8.3.3.

Some information you left out would be useful, such as:

- Operating system
- Version of operating system
- How you obtained and installed PostgreSQL (from where, how you built
it if you built it yourself, etc)
- ... and anything else that seems relevant.

> and when I run: su -l postgres
> -c "/usr/local/pgsql/bin/createuser  -d -a nobody", I get this error:
>
> sh-2.05b# su -l postgres  -c "/usr/local/pgsql/bin/createuser  -d -a nobody"
> /usr/local/pgsql/bin/createuser: error while loading shared libraries:
> libz.so.1: cannot open shared object file: No such file or directory
>
> However, this library is there..:
> sh-2.05b# su -l postgres  -c "echo $LD_LIBRARY_PATH"
> /lib:/usr/lib:/opt/IBM-ME-2.2.2/jre/bin:/usr/local/pgsql/lib

Hmm... if you're on Linux (at least, any faintly sensible Linux flavour)
you shouldn't need /lib or /usr/lib in LD_LIBRARY_PATH, as they're
configured to be searched by default in /etc/ld.so.conf .

> So I was wondering if you guys could help me! I do not know what is wrong
> :-(
> Is createuser not looking at LD_LIBRARY_PATH for its libraries?

In this case it shouldn't have to.

The error you're encountering does indeed seem rather odd, though.

What's the output of:

  su -l postgres  -c "ldd /usr/local/pgsql/bin/createuser"

?

If you're on a glibc system (essentially all Linux, at least) try using
LD_DEBUG to trace the linker's operation, too, and see if that tells you
anything useful:

  LD_DEBUG="libs,files" su -l postgres "<your-command-here>"

See this page for a simple summary:

  http://www.wlug.org.nz/LD_DEBUG

It looks like it's similar on Solaris, too:

  http://docsun.cites.uiuc.edu/sun_docs/C/solaris_9/SUNWdev/LLM/p18.html

--
Craig Ringer