public inbox for gcc-prs@sourceware.org help / color / mirror / Atom feed
From: stew@tenbox.com To: gcc-gnats@gcc.gnu.org Subject: libstdc++/9776: -static-libgcc does not produce a static link to libstdc++, instead always dynamic Date: Thu, 20 Feb 2003 16:36:00 -0000 [thread overview] Message-ID: <20030220163056.25752.qmail@sources.redhat.com> (raw) >Number: 9776 >Category: libstdc++ >Synopsis: -static-libgcc does not produce a static link to libstdc++, instead always dynamic >Confidential: no >Severity: non-critical >Priority: medium >Responsible: unassigned >State: open >Class: sw-bug >Submitter-Id: net >Arrival-Date: Thu Feb 20 16:36:00 UTC 2003 >Closed-Date: >Last-Modified: >Originator: Stewart Loving-Gibbard (stew@tenbox.com) >Release: unknown-1.0 >Organization: >Environment: Mandrake 9.0 & Solaris 2.7/2.8, GCC 3.2 >Description: -static-libgcc does not produce a static link to libstdc++; see attached file. >How-To-Repeat: See attached file >Fix: See attached file >Release-Note: >Audit-Trail: >Unformatted: ----gnatsweb-attachment---- Content-Type: text/plain; name="LinuxBugReportGCC.txt" Content-Disposition: inline; filename="LinuxBugReportGCC.txt" I believe the -static-libgcc option does not work properly under GCC 3.2. It always produces a *dynamic* link to /usr/lib/libstdc++.so.5, instead of /usr/lib/libstdc++.a. I'll demonstrate: GCC 3.2: [stew@oppenheimer demostdlib]$ g++ -v Reading specs from /usr//bin/../lib/gcc-lib/i586-mandrake-linux-gnu/3.2/specs Configured with: ../configure --prefix=/usr --libdir=/usr/lib --with-slibdir=/lib --mandir=/usr/share/man --infodir=/usr/share/info --enable-shared --enable-threads=posix --disable-checking --enable-long-long --enable-__cxa_atexit --enable-languages=c,c++,ada,f77,objc,java --host=i586-mandrake-linux-gnu --with-system-zlib Thread model: posix gcc version 3.2 (Mandrake Linux 9.0 3.2-1mdk) libstdc++.a is available: [stew@oppenheimer Linux]$ ls -alg /usr/lib/libstdc++.a lrwxrwxrwx 1 root 56 Feb 18 16:54 /usr/lib/libstdc++.a -> /usr/lib/gcc-lib/i586-mandrake-linux-gnu/3.2/libstdc++.a But I always get a dynamic link: [stew@oppenheimer demostdlib]$ cat main.cpp #include <string> #include <iostream> using namespace std; int main() { const string thisProgram = "This program"; cout << thisProgram << " invokes the standard library!" << endl; return 0; } [stew@oppenheimer demostdlib]$ g++ main.cpp -static-libgcc [stew@oppenheimer demostdlib]$ ./a.out This program invokes the standard library! [stew@oppenheimer demostdlib]$ ldd ./a.out libstdc++.so.5 => /usr/lib/libstdc++.so.5 (0x40020000) libm.so.6 => /lib/i686/libm.so.6 (0x400e4000) libc.so.6 => /lib/i686/libc.so.6 (0x40107000) libgcc_s.so.1 => /lib/libgcc_s.so.1 (0x40227000) /lib/ld-linux.so.2 => /lib/ld-linux.so.2 (0x40000000) The example was run on Linux, but I've had the same problem with Solaris. The only way I've found to get a proper static link on /usr/lib/libstdc++.a is to catch the collect2 command (g++ main.cpp -static-libgcc -v), then modify the -lstdc++ to /usr/lib/libstdc++.a. Figuring out how to do this took many confusing hours. I worry that maybe I am confused about what -static-libgcc does; maybe it is not supposed to make the link to libstdc++ static. If not, then I would suggest that such an option is very needed - it is not often reasonable that the user have the precise same version of the C++ runtime library as you. Thank you. I hope I was clear. If not, please write. Stewart Loving-Gibbard stew@tenbox.com
next reply other threads:[~2003-02-20 16:36 UTC|newest] Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top 2003-02-20 16:36 stew [this message] 2003-02-20 16:46 Phil Edwards 2003-02-20 18:23 bkoz
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=20030220163056.25752.qmail@sources.redhat.com \ --to=stew@tenbox.com \ --cc=gcc-gnats@gcc.gnu.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).