link static libraries into a shared library

link static libraries into a shared library

Post by Ming Zho » Fri, 11 Apr 1997 04:00:00

Could somebody tell me how to link(archive?) satic libraries
into a shared library?

I am using Java to load a C++ shared library which makes calls
to other static libraries.  The system is Solaris2.5 with

At runtime, the following messages are given by java VM:
fatal: relocation error: symbol not found: cerr: referenced in
./ (
java.lang.UnsatisfiedLinkError: no jsbir in shared library path
        at java.lang.Runtime.loadLibrary(
        at java.lang.System.loadLibrary(

nm command tells the info about cerr:
$nm |grep cerr
[420]   |         0|       0|NOTY |GLOB |0    |UNDEF  |cerr

Do I need to archive the needed static libs(*.a) into the shared

Thanks in advance for any help.



Center for Air-Sea Technology .....
Mississippi State University ......  
Bldg 1103, Rm 233, Stennis Space Center, MS 39529            
tel : (601)688-1157          fax : (601)688-7100


1. Problems linking static library on executable and static library

  I'm a newbie in programming on Un*x platforms, so maybe, it could
be caused by my lack of experience.

Ok. I have a static library "libSM.a" depending on two libraries one
of them shared: "" and a static one: "libCB.a"

I'm trying to compile an executable "EInvA" linking with both "libSM.a" and
"libCB.a" and get the following error:

CC  -mt -fast -DNONE_CLASH -o RELEASE/EInvA     RELEASE/inva.o
-lsocket -lnsl -ldl -lCstd -lc -lnsl -lsocket -lclntsh
-L/libs/libSM/STATIC -lSM -L/libs/libCB/STATIC -lCB

Undefined symbol                 first referenced in file

int CB::Connect(char*, char*) /libs/libSM/STATIC/libSM.a (libSM.o)
CB::CB()                      /libs/libSM/STATIC/libSM.a (libSM.o)
CB::~CB()                     /libs/libSM/STATIC/libSM.a (libSM.o)

And "CB" symbols are defined in "libCB.a"

?Could someone tell me what could be happening?

Thanks in advanced,

2. Summary: suggestions for Unix admin course

3. Question: Inclusion of shared libraries during linking of shared libraries

4. in.rexecd ... how can I put it to work?

5. linking static library against another library

6. Please Help - Console-Switching

7. dynamic link libraries and static libraries

8. Schedtune Command!!! Is fiddling allowed

9. Compiling static libraries as shared libraries

10. Building shared library which includes static libraries

11. Can a static library be compiled into a shared library?

12. Converting a Static Library to a Shared Library

13. Building shared libraries that contain static libraries.