Discovering what library is necessary to run an application

I needed to install rsync in a Solaris 9 so I headed to Sunfreeware and download the package. It had the following description:

Rsync is a replacement for rcp that has many more features – installs in /usr/local. Dependencies: popt, libiconv, libintl, and having libgcc_s.so.1 in /usr/local/lib is required. This can be done by installing libgcc-3.4.6 or gcc-3.4.6 or higher, packages also. There are some new features of version 3 that may require your attention of you have used rsync in the past. See the Details link below for more information.

After you install the package, there is a big probability that it won’t work because it will need the libraries listed in the description. Let’s install and find what my system is missing.

root@solaris9:/tmp/rsync # pkgadd -d rsync-3.0.6-sol9-sparc-local

The following packages are available:
1  SMCrsync     rsync
(sparc) 3.0.6

Select package(s) you wish to process (or ‘all’ to process
all packages). (default: all) [?,??,q]: 1

Processing package instance <SMCrsync> from </tmp/rsync/rsync-3.0.6-sol9-sparc-local>

rsync
(sparc) 3.0.6
The Rsync Group
Using </usr/local> as the package base directory.
## Processing package information.
## Processing system information.
2 package pathnames are already properly installed.
## Verifying disk space requirements.
## Checking for conflicts with packages already installed.
## Checking for setuid/setgid programs.

Installing rsync as <SMCrsync>

## Installing part 1 of 1.
/usr/local/bin/rsync
/usr/local/doc/rsync/COPYING
/usr/local/doc/rsync/INSTALL
/usr/local/doc/rsync/NEWS
/usr/local/doc/rsync/OLDNEWS
/usr/local/doc/rsync/README
/usr/local/doc/rsync/TODO
/usr/local/doc/rsync/csprotocol.txt
/usr/local/doc/rsync/doc/README-SGML
/usr/local/doc/rsync/doc/profile.txt
/usr/local/doc/rsync/doc/rsync.sgml
/usr/local/doc/rsync/rsync3.txt
/usr/local/doc/rsync/rsyncsh.txt
/usr/local/doc/rsync/tech_report.tex
/usr/local/doc/rsync/wildtest.txt
/usr/local/share/man/man1/rsync.1
/usr/local/share/man/man5/rsyncd.conf.5
[ verifying class <none> ]

Installation of <SMCrsync> was successful.

Here I invoke ldd to see what my system is missing. It reported libiconv.so.2, so I need to download the libiconv package as said before.

root@solaris9:/tmp/rsync # ldd /usr/local/bin/rsync
libpopt.so.0 =>  /usr/lib/libpopt.so.0
libsec.so.1 =>   /usr/lib/libsec.so.1
libsocket.so.1 =>        /usr/lib/libsocket.so.1
libnsl.so.1 =>   /usr/lib/libnsl.so.1
libiconv.so.2 =>         (file not found)
libc.so.1 =>     /usr/lib/libc.so.1
libdl.so.1 =>    /usr/lib/libdl.so.1
libmp.so.2 =>    /usr/lib/libmp.so.2
/usr/platform/SUNW,Sun-Fire-V440/lib/libc_psr.so.1

root@solaris9:/tmp/rsync # pkgadd -d libiconv-1.11-sol9-sparc-local

The following packages are available:
1  SMCliconv     libiconv
(sparc) 1.11

Select package(s) you wish to process (or ‘all’ to process
all packages). (default: all) [?,??,q]: 1

Processing package instance <SMCliconv> from </tmp/rsync/libiconv-1.11-sol9-sparc-local>

libiconv
(sparc) 1.11
Bruno Haible
Using </usr/local> as the package base directory.
## Processing package information.
## Processing system information.
5 package pathnames are already properly installed.
## Verifying disk space requirements.
## Checking for conflicts with packages already installed.
## Checking for setuid/setgid programs.

Installing libiconv as <SMCliconv>

## Installing part 1 of 1.
/usr/local/bin/iconv
/usr/local/doc/libiconv/ABOUT-NLS
/usr/local/doc/libiconv/AUTHORS
/usr/local/doc/libiconv/COPYING.LIB
/usr/local/doc/libiconv/ChangeLog
/usr/local/doc/libiconv/DESIGN
/usr/local/doc/libiconv/INSTALL.generic
/usr/local/doc/libiconv/NEWS
/usr/local/doc/libiconv/NOTES
/usr/local/doc/libiconv/PORTS
/usr/local/doc/libiconv/README
/usr/local/doc/libiconv/README.djgpp
/usr/local/doc/libiconv/README.os2
/usr/local/doc/libiconv/README.woe32
/usr/local/doc/libiconv/THANKS
/usr/local/include/iconv.h
/usr/local/include/libcharset.h
/usr/local/include/localcharset.h
/usr/local/lib/libcharset.a
/usr/local/lib/libcharset.la
/usr/local/lib/libcharset.so <symbolic link>
/usr/local/lib/libcharset.so.1 <symbolic link>
/usr/local/lib/libcharset.so.1.0.0
/usr/local/lib/libiconv.la
/usr/local/lib/libiconv.so <symbolic link>
/usr/local/lib/libiconv.so.2 <symbolic link>
/usr/local/lib/libiconv.so.2.4.0
/usr/local/lib/preloadable_libiconv.so
/usr/local/man/man1/iconv.1
/usr/local/man/man3/iconv.3
/usr/local/man/man3/iconv_close.3
/usr/local/man/man3/iconv_open.3
/usr/local/man/man3/iconvctl.3
/usr/local/share/doc/iconv.1.html
/usr/local/share/doc/iconv.3.html
/usr/local/share/doc/iconv_close.3.html
/usr/local/share/doc/iconv_open.3.html
/usr/local/share/doc/iconvctl.3.html
[ verifying class <none> ]

Installation of <SMCliconv> was successful.

Invoking ldd again to see if all dependencies are met. Now I need to install libgcc.

root@solaris9:/tmp/rsync # ldd /usr/local/bin/rsync
libpopt.so.0 =>  /usr/lib/libpopt.so.0
libsec.so.1 =>   /usr/lib/libsec.so.1
libsocket.so.1 =>        /usr/lib/libsocket.so.1
libnsl.so.1 =>   /usr/lib/libnsl.so.1
libiconv.so.2 =>         /usr/local/lib/libiconv.so.2
libc.so.1 =>     /usr/lib/libc.so.1
libdl.so.1 =>    /usr/lib/libdl.so.1
libmp.so.2 =>    /usr/lib/libmp.so.2
libgcc_s.so.1 =>        (file not found)
/usr/platform/SUNW,Sun-Fire-V440/lib/libc_psr.so.1

root@solaris9:/tmp/rsync # pkgadd -d libgcc-3.4.6-sol9-sparc-local

The following packages are available:
1  SMClgcc346     libgcc
(sparc) 3.4.6

Select package(s) you wish to process (or ‘all’ to process
all packages). (default: all) [?,??,q]: 1

Processing package instance <SMClgcc346> from </tmp/rsync/libgcc-3.4.6-sol9-sparc-local>

libgcc
(sparc) 3.4.6
FSF
Using </usr/local> as the package base directory.
## Processing package information.
## Processing system information.
1 package pathname is already properly installed.
## Verifying disk space requirements.
## Checking for conflicts with packages already installed.
## Checking for setuid/setgid programs.

Installing libgcc as <SMClgcc346>

## Installing part 1 of 1.
/usr/local/lib/libg2c.so <symbolic link>
/usr/local/lib/libg2c.so.0 <symbolic link>
/usr/local/lib/libg2c.so.0.0.0
/usr/local/lib/libgcc_s.so <symbolic link>
/usr/local/lib/libgcc_s.so.1
/usr/local/lib/libstdc++.so.6 <symbolic link>
/usr/local/lib/libstdc++.so.6.0.3
[ verifying class <none> ]

Installation of <SMClgcc346> was successful.

No more messages saying that some file is missing. The application is running as expected.

root@solaris9:/tmp/rsync # ldd /usr/local/bin/rsync
libpopt.so.0 =>  /usr/lib/libpopt.so.0
libsec.so.1 =>   /usr/lib/libsec.so.1
libsocket.so.1 =>        /usr/lib/libsocket.so.1
libnsl.so.1 =>   /usr/lib/libnsl.so.1
libiconv.so.2 =>         /usr/local/lib/libiconv.so.2
libc.so.1 =>     /usr/lib/libc.so.1
libdl.so.1 =>    /usr/lib/libdl.so.1
libmp.so.2 =>    /usr/lib/libmp.so.2
libgcc_s.so.1 =>         /usr/local/lib/libgcc_s.so.1
/usr/platform/SUNW,Sun-Fire-V440/lib/libc_psr.so.1

root@solaris9 # rsync
rsync  version 3.0.6  protocol version 30
Copyright (C) 1996-2009 by Andrew Tridgell, Wayne Davison, and others.
Web site: http://rsync.samba.org/
Capabilities:
64-bit files, 64-bit inums, 32-bit timestamps, 64-bit long ints,
socketpairs, hardlinks, symlinks, no IPv6, batchfiles, inplace,
append, ACLs, no xattrs, iconv, no symtimes

rsync comes with ABSOLUTELY NO WARRANTY.  This is free software, and you
are welcome to redistribute it under certain conditions.  See the GNU
General Public Licence for details.

rsync is a file transfer program capable of efficient remote update
via a fast differencing algorithm.

Advertisement