public inbox for gcc-prs@sourceware.org
help / color / mirror / Atom feed
From: swansma@yahoo.com
To: gcc-gnats@gcc.gnu.org
Subject: other/5235: -Wl,-Bstatic -lstdc++ -Wl,-Bdynamic combo fails
Date: Tue, 01 Jan 2002 14:06:00 -0000	[thread overview]
Message-ID: <20020101215931.21508.qmail@sources.redhat.com> (raw)


>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


             reply	other threads:[~2002-01-01 22:06 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-01-01 14:06 swansma [this message]
2003-05-13  1:16 Dara Hazeghi
2003-05-13  6:50 steven

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=20020101215931.21508.qmail@sources.redhat.com \
    --to=swansma@yahoo.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: link
Be 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).