Anyway to turn a .so library into .a library?

5,387 views
Skip to first unread message

Riasat Abir

unread,
Apr 4, 2011, 1:34:22 AM4/4/11
to android-ndk
Hi,

Previously I built all the libraries shared, but as I was facing problem with reference across shared libraries, I want to make .a libraries instead of .so lib
Is there anyway to convert from .so to .a?

I tried to compile just changing the include $(BUILD_SHARED_LIBRARY)  to include $(BUILD_STATIC_LIBRARY), but that gave bunch of undefined reference which I could not manage to resolve.

--

HimHim

Riasat Abir

unread,
Apr 4, 2011, 2:55:17 AM4/4/11
to android-ndk
I mean I've built the modules into .so file
using this .so file can i build the .a file of the libraries?
--

HimHim

simons....@gmail.com

unread,
Apr 4, 2011, 7:10:20 AM4/4/11
to andro...@googlegroups.com
no way...
.so file are already linked (and maybe stripped down of unused code)
.a files are just a bunch of .o files (not linked)

you just can't "convert" a .so in a .a
sorry


--
You received this message because you are subscribed to the Google Groups "android-ndk" group.
To post to this group, send email to andro...@googlegroups.com.
To unsubscribe from this group, send email to android-ndk...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/android-ndk?hl=en.

Riasat Abir

unread,
Apr 4, 2011, 7:17:38 AM4/4/11
to andro...@googlegroups.com
Thanks.

Also I've learned a new thing regarding making static libraries which might be helpful for beginners to know.

If there are 3 libraries A(shared), B(static), C(static): A depends on B. B depends on C.

Then when making the library of B, I had to add local static library C. (not a new thing!)

Then when making the library of A, I had to add local static library both B & C. (At first I thought including B would be enough!)

Regards,
Riasat
--

HimHim

simons....@gmail.com

unread,
Apr 4, 2011, 8:01:56 AM4/4/11
to andro...@googlegroups.com
right!

when compiling B of course you need to to tell that it depends on C, but that's only to make B aware of what's declared in C (headers for structs and functions, so just adding a -Ipath/to/C/include to B CFLAGS should be enough for the compiler to be happy)

but when you are building A (which is a shared lib so after compilation, linking will happens), you need to tell all dependencies so the linker can pull all required definitions of functions and external variables defined in both B and C
Reply all
Reply to author
Forward
0 new messages