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
> 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
> 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