Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

how to staticalll bin libstdc++*

96 views
Skip to first unread message

Billy Patton

unread,
Jan 27, 2005, 3:37:37 PM1/27/05
to
I've got some c++ code that I have written and tested on both a sun solaris8
box and a linux. It works fine. I had a new user try it on thier sun and it
complained about not finding libstdc++??6.so. It has this .so dynamicall
linked to the executable.

How do I tell gcc to statically link ALL libraries?

___ _ ____ ___ __ __
/ _ )(_) / /_ __ / _ \___ _/ /_/ /____ ___
/ _ / / / / // / / ___/ _ `/ __/ __/ _ \/ _ \
/____/_/_/_/\_, / /_/ \_,_/\__/\__/\___/_//_/
/___/
Texas Instruments ASIC Circuit Design Methodology Group
Dallas, Texas, 214-480-4455, b-pa...@ti.com

David Schwartz

unread,
Jan 27, 2005, 10:30:01 PM1/27/05
to

"Billy Patton" <bpa...@ti.com> wrote in message
news:Pine.LNX.4.61.05...@holster07.dal.design.ti.com...

> I've got some c++ code that I have written and tested on both a sun
> solaris8 box and a linux. It works fine. I had a new user try it on
> thier sun and it complained about not finding libstdc++??6.so. It has
> this .so dynamicall linked to the executable.
>
> How do I tell gcc to statically link ALL libraries?

You would use '-static'. There are, however, a variety of problems you
could run into this way. What makes you think your library will work on his
machine?

DS


Paul Pluzhnikov

unread,
Jan 27, 2005, 11:21:11 PM1/27/05
to
Billy Patton <bpa...@ti.com> writes:

> How do I tell gcc to statically link ALL libraries?

Statically linking system libraries (libc.so in particular) is
generally a very bad idea (TM).

This makes your application much larger then it needs to be, and
is quite likely to make your app not work at all on future releases
of the OS.

A much better approach is to link just the libstdc++ statically:

ln -s `g++ --print-file-name=libstdc++.a` .
g++ -o your.exe main.o ... -L. -static-libgcc
rm libstdc++.a

Cheers,
--
In order to understand recursion you must first understand recursion.
Remove /-nsp/ for email.

0 new messages