Link error when multiple static C libraries are linked
379 views
Skip to first unread message
nitya
unread,
Aug 27, 2009, 5:42:57 PM8/27/09
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to android-ndk
Hi,
I'm trying to link multiple C static librraies (xx.a) and build a
shared librray out of that using Android.mk makefile. I'm getting a
lot of link errors because of undefined reference of functions. But
the functions are already defined in the libraries. When the order of
listing the libraries are changed, some of the link errors are gone.
Since there are many libraries, it is very difficult to order them.
How can i get rid of these errors while linking? How can i link
multiple static libraries.
Regards
Nitya
Julien Mercay
unread,
Aug 27, 2009, 7:55:20 PM8/27/09
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to andro...@googlegroups.com
You have circular dependencies in your libraries. Use start-group and end-group lile this on the linker command line:
-Wl,--start-group -la -lb -Wl,--end-group
assuming you have liba.a and libb.a
Julien
-- Julien
Bytes
unread,
Sep 1, 2009, 1:53:10 AM9/1/09
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to android-ndk
Yes, Circular dependancy is a quick fix. But its not a good
discipline.
I couldn't locate the link .... but do googling... you would
definetley find a good articles on libraries.
> Julien- Hide quoted text -
>
> - Show quoted text -
Ash
unread,
Sep 1, 2009, 2:37:12 AM9/1/09
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to android-ndk
Try using "LOCAL_WHOLE_STATIC_LIBRARIES" for linking with multiple
static libraries. Have a look at \build\core\build-system.html
Regards,
Ash
David Turner
unread,
Sep 1, 2009, 2:31:51 PM9/1/09
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to andro...@googlegroups.com
For the record, LOCAL_WHOLE_STATE_LIBRARIES is only supported by the full Android build system, not the NDK one. Still, you should really remove these circular references.