From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 23634 invoked by alias); 1 Jan 2002 22:06:01 -0000 Mailing-List: contact gcc-prs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Archive: List-Post: List-Help: Sender: gcc-prs-owner@gcc.gnu.org Received: (qmail 23603 invoked by uid 71); 1 Jan 2002 22:06:00 -0000 Resent-Date: 1 Jan 2002 22:06:00 -0000 Resent-Message-ID: <20020101220600.23602.qmail@sources.redhat.com> Resent-From: gcc-gnats@gcc.gnu.org (GNATS Filer) Resent-To: nobody@gcc.gnu.org Resent-Cc: gcc-prs@gcc.gnu.org, gcc-bugs@gcc.gnu.org Resent-Reply-To: gcc-gnats@gcc.gnu.org, swansma@yahoo.com Received:(qmail 21509 invoked by uid 61); 1 Jan 2002 21:59:31 -0000 Message-Id:<20020101215931.21508.qmail@sources.redhat.com> Date: Tue, 01 Jan 2002 14:06:00 -0000 From: swansma@yahoo.com Reply-To: swansma@yahoo.com To: gcc-gnats@gcc.gnu.org X-Send-Pr-Version:gnatsweb-2.9.3 (1.1.1.1.2.31) Subject: other/5235: -Wl,-Bstatic -lstdc++ -Wl,-Bdynamic combo fails X-SW-Source: 2002-01/txt/msg00016.txt.bz2 List-Id: >Number: 5235 >Category: other >Synopsis: -Wl,-Bstatic -lstdc++ -Wl,-Bdynamic combo fails >Confidential: no >Severity: serious >Priority: medium >Responsible: unassigned >State: open >Class: sw-bug >Submitter-Id: net >Arrival-Date: Tue Jan 01 14:06:00 PST 2002 >Closed-Date: >Last-Modified: >Originator: swansma@yahoo.com >Release: unknown-1.0 >Organization: >Environment: binutils-2.11.92.0.12-1mdk.i586.rpm Reading specs from /usr/lib/gcc-lib/i586-mandrake-linux-gnu/3.0.3/specs Configured with: ../configure --prefix=/usr --mandir=/usr/share/man --infodir=/usr/share/info --datadir=/usr/share/gcc-3.0.3 --enable-shared --enable-threads=posix --disable-checking --enable-long-long --enable-cstdio=stdio --enable-clocale=generic --enable-languages=c,c++,f77,objc,java --program-suffix=-3.0.3 --enable-objc-gc --host=i586-mandrake-linux-gnu Thread model: posix gcc version 3.0.3 (Mandrake Linux 8.2 3.0.3-1mdk) >Description: It is not possible to mix static and dynamic linking with gcc-3.0.2 or gcc-3.0.3. Included are some pasted sample targets. Some are obviously not correct. I also note that unless you do it incorrectly the library is (incorrectly) specified in the static and dynamic sections. F.E. g++-3.0.3 -v vec.cpp -o vec -Wl,-Bstatic -lstdc++ -Wl,-Bdynamic will place -lstdc++ in the static and dynamic section. To get this library only listed in the static section you must use an incorrect format: g++-3.0.3 -v vec.cpp -o vec -Wl,-Bstatic,-lstdc++ -Wl,-Bdynamic In any case, even though the library is only in the static section it still will not link statically. >How-To-Repeat: None of the following make targets work: vec: vec.o Makefile ld -o vec vec.o /usr/lib/crt1.o /usr/lib/crti.o \ /usr/lib/gcc-lib/i586-mandrake-linux-gnu/${GCCVER}/crtbegin.o \ -L/usr/lib/gcc-lib/i586-mandrake-linux-gnu/${GCCVER} \ -lm -lgcc_s -lc -lgcc -lstdc++ \ /usr/lib/gcc-lib/i586-mandrake-linux-gnu/${GCCVER}/crtend.o \ /usr/lib/crtn.o vec2: vec.o ld -o vec2 vec.o /usr/lib/crt1.o /usr/lib/crti.o \ /usr/lib/gcc-lib/i586-mandrake-linux-gnu/${GCCVER}/crtbegin.o \ -L/usr/lib/gcc-lib/i586-mandrake-linux-gnu/${GCCVER} \ -Bstatic -lstdc++ \ -Bdynamic -lm -lgcc_s -lc -lgcc \ /usr/lib/gcc-lib/i586-mandrake-linux-gnu/${GCCVER}/crtend.o \ /usr/lib/crtn.o vec3: vec.cpp Makefile ${CPP} -v vec.cpp \ /usr/lib/gcc-lib/i586-mandrake-linux-gnu/${GCCVER}/libstdc++.a \ -L/usr/lib/gcc-lib/i586-mandrake-linux-gnu/${GCCVER} \ -lm -lgcc_s -lc -lgcc \ -o vec3 vec4: vec.cpp Makefile ${CPP} -v vec.cpp -o vec4 -Wl,-Bstatic -lstdc++ -lm -Wl,-Bdynamic vec5: vec.cpp Makefile ${CPP} -v vec.cpp -o vec5 -Wl,-static,-lstdc++,-lm vec6: vec.cpp Makefile ${CPP} -v vec.cpp -o vec6 -static vec7: vec.cpp Makefile ${CPP} -v vec.cpp -o vec7 -static -lstdc++ -lm -Wl,-Bdynamic >Fix: If some libraries must be linked statically (as is my case) there is no option but to use "gcc -static" to statically link the entire executable. >Release-Note: >Audit-Trail: >Unformatted: ----gnatsweb-attachment---- Content-Type: text/x-c++src; name="vec.cpp" Content-Transfer-Encoding: base64 Content-Disposition: attachment; filename="vec.cpp" Ly8KLy8gJElkOiB2ZWMuY3BwLHYgMS4zIDIwMDEvMTEvMTQgMTk6MTg6NTAgbXN3YW5zb24gRXhw ICQKLy8KCiNpbmNsdWRlIDx2ZWN0b3I+Cgp1c2luZyBuYW1lc3BhY2Ugc3RkOwoKaW50IG1haW4o aW50IGFyZ2MsIGNoYXIqKiBhcmd2KSB7CgkKCXZlY3RvcjxpbnQ+IHg7Cgl4LnB1c2hfYmFjaygw KTsKCglyZXR1cm4gMDsKfQoK