This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC 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: g++ -static-libgcc not working (g++ 3.0.4).


Phil Edwards wrote:
On Thu, Sep 05, 2002 at 02:06:39PM +0200, jean-frederic clere wrote:

Hi,

I am on a Solaris machine (5.8) and I am not using the gnu ld.
I am trying to have a program linked staticly with libstdc++.a and libgcc.a.

I have tried g++ -o program -static-libgcc ...
But program still requires libstdc++.so.3 and libgcc_s.so.1

I have tried to -static but it failed because g++ does find  dlopen and relatives.

Any ideas about what could be wrong?

Specify static linking for just the libraries you want statically linked,
and then revert to dynamic libraries for the rest.  See the ld(1) man page
for -Bstatic and -Bdynamic.

Calling ld directly with -Bstatic -lgcc -lstdc++ -Bdynamic -lc works but there seems to be noway to do it directly from g++.

The g++ -static-libgcc gives something like:
+++
/opt/SMAWPlus/lib/gcc-lib/sparc-sun-solaris2.8/3.0.4/collect2 -V -Y P,/usr/ccs/lib:/usr/lib -Qy -o htdig /opt/SMAWPlus/lib/gcc-lib/sparc-sun-solaris2.8/3.0.4/crt1.o /opt/SMAWPlus/lib/gcc-lib/sparc-sun-solaris2.8/3.0.4/crti.o /usr/ccs/lib/values-Xa.o /opt/SMAWPlus/lib/gcc-lib/sparc-sun-solaris2.8/3.0.4/crtbegin.o -L../htlib -L../htcommon -L../db/dist -L/usr/lib -L/opt/SMAWPlus/lib/gcc-lib/sparc-sun-solaris2.8/3.0.4 -L/opt/SMAWPlus/lib/gcc-lib/sparc-sun-solaris2.8/3.0.4/../../../../sparc-sun-solaris2.8/lib -L/usr/ccs/bin -L/usr/ccs/lib -L/opt/SMAWPlus/lib/gcc-lib/sparc-sun-solaris2.8/3.0.4/../../.. Document.o HTML.o Images.o Parsable.o Plaintext.o Retriever.o SGMLEntities.o Server.o URLRef.o htdig.o ExternalParser.o PDF.o ../htcommon/libcommon.a ../htlib/libht.a ../db/dist/libdb.a -lz -lnsl -lsocket -lstdc++ -lm -lgcc -lc -lgcc /opt/SMAWPlus/lib/gcc-lib/sparc-sun-solaris2.8/3.0.4/crtend.o /opt/SMAWPlus/lib/gcc-lib/sparc-sun-solaris2.8/3.0.4/crtn.o
+++
When I am doing:
+++
g++ -v -o htdig -static-libgcc -L../htlib -L../htcommon -L../db/dist -L/usr/lib
Document.o HTML.o Images.o Parsable.o Plaintext.o Retriever.o SGMLEntities.o Server.o URLRef.o htdig.o ExternalParser.o PDF.o ../htcommon/libcommon.a ../htlib/libht.a ../db/dist/libdb.a \
-lz -lnsl -lsocket
+++


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