This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: static runtime linking and libgcc/libgcc_s


On Fri, Sep 05, 2003 at 11:04:08AM +0400, Vladimir Prus wrote:
> 
> Hello,
> suppose my application links to a number of libraries, some shared and some
> static. But I'd like the C++ runtime (i.e. all the implicitly linked
> libraries like libstdc++, libgcc) to be linked statically. How do I do
> that?
> 
> I'm asking on gcc list because the problem has to do with the list of
> libraries gcc passes to the linker.
> 
> With gcc 2.95 I was able to add "-Wl,-Bstatic" option to the end of command
> line and that option was placed in collect2 invocation before any
> implicitly added libraries.
> 
> But in 3.3 I can not do it any longer. Unless there '-static' option, gcc
> add "lgcc_s" library to the collect2 invocation. That library exists only
> as shared object, so if I have "-Wl,-Bstatic", it's just not found.
> 
> OTOH, if I specify -static, then all libraries will be statically linked,
> not only implicitly added ones.
> 
> So, does anybody knows a solution? 

-static-libgcc will take care of libgcc_s.so.  You'll have to handle
libstdc++ some other way.

-- 
Daniel Jacobowitz
MontaVista Software                         Debian GNU/Linux Developer


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]