How to get the SONAME of a shared library under Linux and Solaris


objdump -p | grep SONAME


elfdump -d | grep SONAME

objdump should be located under /usr/bin/ while elfdump should be located under /usr/ccs/bin

An interesting document describing how to name a shared object can be found here:


SUN linker takes order parameters into account

While I was compiling a program written by a colleague of mine I encountered this strange error:

/opt/SUNWspro/bin/CC -o program program.o -lcurl -L/opt/libcurl/lib
ld: fatal: library -lcurl: not found
ld: fatal: File processing errors. No output written to program

The library was at the right place and everything seemed right until I checked the documentation and I discovered…

$man ld
-L path

Adds path to the library search directories. ld searches
for libraries first in any directories specified by the
-L options and then in the standard directories. This
option is useful only if the option precedes the -l
options to which the -L option applies.
The environment
variable LD_LIBRARY_PATH can be used to supplement the
library search path. See LD_LIBRARY_PATH under ENVIRON-

So the correct version was the following:

/opt/SUNWspro/bin/CC -o program program.o -L/opt/libcurl/lib -lcurl