log in
Stack Overow
Questions Tags Users Badges Unanswered Ask
linux
linker
shared-libraries
I am trying to build a shared library. Let us say libabc.so .It uses another .so
le , say lib123.so (a lib in /usr/local/lib) .Now i am using my shared lib
libabc.so in my application. say my-app.I want to know how i should link
these binaries??i don't want to link my-app with lib123.so directly. my-app
should be linked with only libabc.so. How can i do this?
Thanks in advance. I am using g++ compiler
share
Asked
Oct 17 '13 at 10:41
have you thought about using an atuomated build system, for example autotools? autotools
comes with libtool, which takes most of the awkward processing required to build shared
libraries away. Andreas Grapentin Oct 17 '13 at 10:45
@nyarlathotep: you are wrong in advising to link with a static lib122.a the shared
libabc.so Basile Starynkevitch Oct 17 '13 at 10:49
Show your exact build commands (for the object les and the shared library). Basile
Starynkevitch Oct 17 '13 at 11:04
add a comment
1 Answer
Order By Votes
abc2.pic.o -L/usr/local/lib -
share
Answered
Oct 17 '13 at 10:47
Edited
Oct 17 '13 at 11:32
Why not a static library for lib123? What if it is not PIC? B Oct 17 '13 at 11:05
I had done exactly the same thing you mentioned here. But when i do a ldd on
libabc.so , it is not listing lib123.so. Do you know why it is like that? Anoop Ravi
Oct 17 '13 at 10:56
I cannot help, unless you show at least the precise commands involved in building
your abc*.pic.o objects and the libabc.so library. Basile Starynkevitch Oct 17
'13 at 11:05
@B: Because static libraries are non-PIC in general, and are basically a
catenation of member object les. Basile Starynkevitch Oct 17 '13 at 11:06
Please edit your question. And tell there exactly how you build both abc.pic.o and
libabc.so Basile Starynkevitch Oct 17 '13 at 11:26
Your Answer
log in
or
Name
meta chat tour help blog privacy policy legal contact us full site
Download the Stack Exchange Android app
2016 Stack Exchange, Inc