Hi sun-managers,
Here is a summary to my question:
|How do I create a shared library from:
|
|/usr/lib/libsuntool.a
Most common answer: You can't, and there is no need to.
Restore them from tape or CD.
The .o files have to be compiled with -pic . In general the static versions are compiled without it. The only lib that is customizable is libc.
Two remarks about building shared libs came in
Guy Harris wrote:
Well, you could try extracting all the members from the archive,
figuring out which of them should be put in the ".so" file and which
should be put in the ".sa" file, linking the former together with "ld"
to make a shareable object, putting the latter into a ".sa" file with
"ar", and installing both the ".so" and ".sa" file in "/usr/lib" with
the appropriate major and minor version numbers...
...but the resulting shared library wouldn't be position-independent
code, so much of it *wouldn't* be shareable and would be copied when the
run-time loader relocated it at run-time, and it might not work in any
case.
Matthew Donaldson wrote:
Yeah, documentation on shared libraries is pretty thin in the manuals. The
main thing about shared libraries is that all the .o files in them should
have been compiled with the -pic option.
The basic command to make a shared library is
ld -assert pure-text <files> -o lib<whatever>.so.<something>
So if you ar out all the files in libsuntool.a, then ld them with the above
command, you may get what you need. If ld complains about the assertion
failing, the modules in the .a file probably weren't compiled with the -pic
option (position independent code). I once, in desparation tried a shared
library which was made with some modules that failed the assertion, and it
seemed to work - I'm not sure why they need to be position independent.
--- So I will restore it from tape I guess.Thanks to: michael pearlman canuck@rice.edu Russ Poffenberger poffen@sj.ate.slb.com Anthony A. Datri datri@concave.convex.com Guy Harris guy@auspex.com Matthew Donaldson matthew@cs.adelaide.edu.au
This archive was generated by hypermail 2.1.2 : Fri Sep 28 2001 - 23:06:34 CDT