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 2002-11-14, Stephen M. Webb wrote:
> On November 14, 2002 04:32 am, Christoph Bugel wrote:
[...]
> > linking with -static doesn't work as I expected:
> >
> > Linux$ g++ -fPIC -shared -static hello.cc -o libhello.so
> >
> > Linux$ ldd ./libhello.so
> > 	libstdc++.so.5 => /usr/lib/libstdc++.so.5
> > 	(etc, etc)
> >
> > Do I have to use -nostdinc and pick all libraries by hand or is
> > there an easier way?
> 
> Just explicitly add the libstdc++.a to the list of files to link, like 
> any other library.  No need for -nostdinc.

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)

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.






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