Re: how to build shared library link to a static library

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, 24 Apr 2019 at 15:42, Wu, Wendy <jian.wu3@xxxxxx> wrote:
>
> Hi GCC team member,
> I am using 64 bit Linux.
> I have a library : libstatic.a, which has function: sfun();
> I need to build a library: libshared.so, which uses sfun(); but I got error “ `.rodata' can not be used when making a shared object; recompile with -fPIC”
> Add -fPIC to libstatic.a Makefile could resolve the issue.
> libstatic.a team reject to add this option, and they told me -fPIC is only for shared library.

-fPIC is for relocatable code. If you want to include code in a shared
library it needs to be relocatable.

> I checked gcc document, it shows -fPIC is for shared library too.
> Could you tell me how to resolve my problem? What’s the official way to link a static 64 bit library to a shared 64bit library?

Either don't use libstatic.a or build it with -fPIC.




[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux