LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Software (https://www.linuxquestions.org/questions/linux-software-2/)
-   -   Convert static library (Filename.a) to dynamic shared object (filename.so) (https://www.linuxquestions.org/questions/linux-software-2/convert-static-library-filename-a-to-dynamic-shared-object-filename-so-465709/)

afx2029 07-19-2006 07:48 PM

Convert static library (Filename.a) to dynamic shared object (filename.so)
 
I have this problem where an application (Xgl) complains it can't find two librairies, libXau.so and libXdmcp.so. I don't have these X related files on my system, but have the static libXau.a and libXdmcp.a files in my /usr/X11/lib directory. I already a similiar problem, but using a rarer library (where I couldn't find the .so files on the net), so I simply ran a few (cryptic?!?!) commands to generate .so file(s) from the library archive. anyone know where I can get information on this? Also, anybody know if the .a file is a collection of .o files, or if .a files are the same as .o files, and are only in a different format, using for static linking with an application?

Thanks in advance!

kaz2100 07-19-2006 09:43 PM

http://packages.debian.org/testing/libs/libxau6
http://packages.debian.org/testing/libs/libxdmcp6

These pages have debian packages and links to tarball.

afx2029 07-20-2006 07:53 AM

Thanks for the reply....I'll try getting it to work by downloading the actual files. I was hoping someone would know how to do what I was talking about, but I guess I might as well get down to what I am really trying to do (install XGL and Compiz), I'll probably run across many other problems along the way.
Thanks a lot!

negiliblek 03-04-2007 11:23 PM

Here's where I started:
http://tldp.org/HOWTO/Program-Librar...libraries.html

..here's another site which gave more color to the subject:

homes.esat.kuleuven.be/~gcc/shared_libraries.html

-to answer one of your questions directly: a .a file is a collection of .o files in archive file format. this archived collection of .o files is used for static linking with applications. So no, .o files aren't the same as .a files.



Quote:

Originally Posted by afx2029
I have this problem where an application (Xgl) complains it can't find two librairies, libXau.so and libXdmcp.so. I don't have these X related files on my system, but have the static libXau.a and libXdmcp.a files in my /usr/X11/lib directory. I already a similiar problem, but using a rarer library (where I couldn't find the .so files on the net), so I simply ran a few (cryptic?!?!) commands to generate .so file(s) from the library archive. anyone know where I can get information on this? Also, anybody know if the .a file is a collection of .o files, or if .a files are the same as .o files, and are only in a different format, using for static linking with an application?

Thanks in advance!


pokemaster 08-17-2007 06:07 AM

I'd never run into this until today, when spice3 needed libtermcap :(

So I downloaded, built, and installed termcap, only to discover that it only installed the static libs, libtermcap.a

Fortunately after reading this post, I remembered something... static libs are ar archives. So here's what I tried (and it worked first time):
Code:

ar -x libtermcap.a
gcc -shared *.o -o libtermcap.so.2

Then copied the new file to /usr/lib and voila :)


All times are GMT -5. The time now is 05:12 PM.