This is the mail archive of the libstdc++@gcc.gnu.org mailing list for the libstdc++ 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: libstdc++ linked as libstdc++.a


On November 14, 2002 09:15 am, Christoph Bugel wrote:
>
> doesn't work for me:
>
> $ g++ -fPIC -shared -static hello.cc -o libhello.so
> /usr/lib/libstdc++.a $ ldd ./libhello.so
>         libstdc++.so.5 => /usr/lib/libstdc++.so.5 (0x4001f000)
> 		(etc, etc)

Try using gcc instead of g++ to front-end the link.  g++ will 
automatically add the .so if it can.

> I think I noticed sometime ago that libstdc++.a is compiled without
> -fPIC. So even if I convince the g++ frontend to use libstdc++.a, it
> could fail at runtime if my target is a shared library.

I don't believe PIC does anything on a GNU/Linux system, but I could be 
mistaken.  I've certainly never had a problem with statically linking 
the C++ runtime into shared libraries used as plugins on Intel-based 
Linux.

-- 
Stephen M. Webb


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