User account creation filtered due to spam.

Bug 15074 - g++ -lsupc++ still links against libstdc++
Summary: g++ -lsupc++ still links against libstdc++
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: libstdc++ (show other bugs)
Version: 3.3.3
: P2 normal
Target Milestone: 3.4.1
Assignee: Benjamin Kosnik
URL:
Keywords: documentation
Depends on:
Blocks:
 
Reported: 2004-04-22 16:06 UTC by James A. Morrison
Modified: 2004-05-14 12:26 UTC (History)
1 user (show)

See Also:
Host: sparc-linux-gnu
Target: sparc-linux-gnu
Build: sparc-linux-gnu
Known to work:
Known to fail:
Last reconfirmed: 2004-04-22 16:19:59


Attachments
A c program that shouldn't use anything from libstdc++ (202 bytes, text/plain)
2004-04-22 16:30 UTC, James A. Morrison
Details

Note You need to log in before you can comment on or make changes to this bug.
Description James A. Morrison 2004-04-22 16:06:13 UTC
The FAQ says that using g++ and -lsupc++ together will link against libsupc++
instead of libstdc++.  This doesn't work on GNU/Linux:
                                                                                
jim@squirrel:~/test $ g++ -o sizeof sizeof.cc -lsupc++
jim@squirrel:~/test $ ldd sizeof
        libstdc++.so.5 => /usr/lib/libstdc++.so.5 (0x7002c000)
        libm.so.6 => /lib/libm.so.6 (0x700f0000)
        libgcc_s.so.1 => /usr/local/lib/libgcc_s.so.1 (0x70184000)
        libc.so.6 => /lib/libc.so.6 (0x701a0000)
        /lib/ld-linux.so.2 => /lib/ld-linux.so.2 (0x70000000)
jim@squirrel:~/test $ gcc -o sizeof sizeof.cc -lsupc++
jim@squirrel:~/test $ ldd sizeof
        libc.so.6 => /lib/libc.so.6 (0x7002c000)
        /lib/ld-linux.so.2 => /lib/ld-linux.so.2 (0x70000000)
Comment 1 Andrew Pinski 2004-04-22 16:17:00 UTC
What FAQ, I do not see any mention of this in <http://gcc.gnu.org/faq.html> or <http://gcc.gnu.org/
onlinedocs/libstdc++/faq/index.html>?
Comment 2 Andrew Pinski 2004-04-22 16:19:59 UTC
If the only functions from libstdc++.a which you need are language  support functions (those listed in  
clause 18 of the standard,  e.g., new and delete), then try linking  against libsupc++.a (usually 
specifying  -lsupc++ when calling g++ for the final link step will  do it). This library contains only 
those support routines, one per  object file. But if you are using anything from the rest of the  library, 
such as IOStreams or vectors, then you'll still need  pieces from libstdc++.a.

It does say to use g++ though :(  This should change.
Comment 3 James A. Morrison 2004-04-22 16:30:57 UTC
Created attachment 6137 [details]
A c program that shouldn't use anything from libstdc++

 For completeness this is the program I tried with g++ and g++ -lsupc++
Comment 4 Benjamin Kosnik 2004-05-13 04:39:50 UTC
Indeed, what FAQ? 

You need to be using gcc, not g++ to do this kind of thing. ie:

gcc -o sizeof sizeof.cc -lsupc++

-benjamin
Comment 5 James A. Morrison 2004-05-13 05:32:49 UTC
 Sorry, the libstdc++ FAQ:
http://gcc.gnu.org/onlinedocs/libstdc++/faq/index.html#2_5
Comment 6 CVS Commits 2004-05-13 15:14:26 UTC
Subject: Bug 15074

CVSROOT:	/cvs/gcc
Module name:	gcc
Changes by:	bkoz@gcc.gnu.org	2004-05-13 15:14:08

Modified files:
	libstdc++-v3   : ChangeLog 
	libstdc++-v3/docs/html/faq: index.html 

Log message:
	2004-05-13  Benjamin Kosnik  <bkoz@redhat.com>
	
	PR libstdc++/15074
	* docs/html/faq/index.html: Update docs for libsupc++ usage.

Patches:
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/libstdc++-v3/ChangeLog.diff?cvsroot=gcc&r1=1.2470&r2=1.2471
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/libstdc++-v3/docs/html/faq/index.html.diff?cvsroot=gcc&r1=1.64&r2=1.65

Comment 7 Benjamin Kosnik 2004-05-13 15:16:08 UTC
This is a documentation error, now fixed.
Comment 8 CVS Commits 2004-05-13 15:27:59 UTC
Subject: Bug 15074

CVSROOT:	/cvs/gcc
Module name:	gcc
Branch: 	gcc-3_4-branch
Changes by:	bkoz@gcc.gnu.org	2004-05-13 15:27:42

Modified files:
	libstdc++-v3   : ChangeLog 
	libstdc++-v3/docs/html/faq: index.html 

Log message:
	2004-05-13  Benjamin Kosnik  <bkoz@redhat.com>
	
	PR libstdc++/15074
	* docs/html/faq/index.html: Update docs for libsupc++ usage.

Patches:
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/libstdc++-v3/ChangeLog.diff?cvsroot=gcc&only_with_tag=gcc-3_4-branch&r1=1.2224.2.98&r2=1.2224.2.99
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/libstdc++-v3/docs/html/faq/index.html.diff?cvsroot=gcc&only_with_tag=gcc-3_4-branch&r1=1.63.4.1&r2=1.63.4.2

Comment 9 Andrew Pinski 2004-05-14 12:26:02 UTC
Fixed for 3.4.1.