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

Problems with libstdc++

1 view
Skip to first unread message

Intrepid Soldier

unread,
Mar 15, 2002, 4:59:19 AM3/15/02
to
Hi all
I have an application which doesnt use any C++ functionality but is
compiled using g++ ( cant use gcc for some reasons ) . So ,it links to
shared library libstdc++ by default. I have to remove this dynamic
dependency on libstdc++. So, I thought I should do something like
this:-

g++ -Wl,-Bdynamic,-lc,-lpthread,-lnsl,-lcrypt,-Bstatic main.c

Here, I have dynamically linked all libraries that I have used in my
program, and left everything else to be statically linked. If, I have
by mistake used some symbols of libstdc++ , then it will be statically
linked to my program , otherwise it wont be linked at all ( am I right
??? ).

But the problem is that once I do it like mentioned above then my
program hangs in some functions of pthread library. I cant find any
symbols from libstdc++ in my executable ,although its size increases
considerably. I dont know what library is getting staticaly linked to
my executable that is increasing the size. Please help me out here.
Thanks

Intrepid

Moritz Franosch

unread,
Mar 15, 2002, 12:26:07 PM3/15/02
to

intrepi...@yahoo.com (Intrepid Soldier) writes:

> compiled using g++ ( cant use gcc for some reasons ) . So ,it links to
> shared library libstdc++ by default. I have to remove this dynamic
> dependency on libstdc++. So, I thought I should do something like
> this:-
>
> g++ -Wl,-Bdynamic,-lc,-lpthread,-lnsl,-lcrypt,-Bstatic main.c

I do it like this

g++ -nodefaultlibs -o myprogram main.o -lqt -Wl,-Bstatic -lstdc++
-Wl,-Bdynamic -lm -lc -lgcc

and it works.

> But the problem is that once I do it like mentioned above then my
> program hangs in some functions of pthread library.

Don't know why this could be.

Moritz


--
Dipl.-Phys. Moritz Franosch
http://Franosch.org

Eric P. McCoy

unread,
Mar 15, 2002, 1:02:12 PM3/15/02
to
intrepi...@yahoo.com (Intrepid Soldier) writes:

> I have an application which doesnt use any C++ functionality but is
> compiled using g++ ( cant use gcc for some reasons ) . So ,it links to
> shared library libstdc++ by default. I have to remove this dynamic
> dependency on libstdc++. So, I thought I should do something like
> this:-

It seems to me like a better solution would be to figure out why you
can't compile your "C" program using a C compiler. You say you can't
use gcc "for some reasons." Do you know what those reasons are, or
did you just discover g++ made the problems vanish while
troubleshooting?

--
Eric McCoy <ctr2...@yahoo.com>

"I woke up this morning and realized what the game needed: pirates,
pimps, and gay furries." - Rich "Lowtax" Kyanka

0 new messages