Languages and Scripting
cancel
Showing results for 
Search instead for 
Did you mean: 

while compiling c++ pgm how to make use of static libgcc instead of shared libgcc

 
SOLVED
Go to solution
Highlighted
Occasional Advisor

while compiling c++ pgm how to make use of static libgcc instead of shared libgcc

Hello All,

While compiling a c++ pgm on HP-UX using g++, i am getting an error like this.
#g++ -c test.cxx
#g++ -o test test.o
ld: Can't find dependent library "libgcc_s.so.0"
Fatal error.
collect2: ld returned 1 exit status

I don't have shared version of libgcc. I have only static version of libgcc. How to make use of static libgcc instead of shared libgcc.

Note: I have tried with the following command.
# g++ -static-libgcc -c test.cxx
# g++ -static-libgcc -o test test.o
But still i am getting the same error.

Can anyone please help me?

Thanks,
Vijayalakshmi.
6 REPLIES 6
Highlighted
Respected Contributor
Solution

Re: while compiling c++ pgm how to make use of static libgcc instead of shared libgcc

Highlighted
Honored Contributor

Re: while compiling c++ pgm how to make use of static libgcc instead of shared libgcc

If you have a makefile, specify full path of libgcc.a as -L/usr/local/lib/..../libgcc.a

It should help..

-Arun

"A ship in the harbor is safe, but that is not what ships are built for"
Highlighted
Occasional Advisor

Re: while compiling c++ pgm how to make use of static libgcc instead of shared libgcc

Hello Orhan,

Thank you very much. The link you gave exactly solved my problem.

Thanks,
Vijayalakshmi.
Highlighted
Honored Contributor

Re: while compiling c++ pgm how to make use of static libgcc instead of shared libgcc

vijayalakshmi,

Great to see here at ITRC forums :) Assign points when you are getting solution and close the thread once you got the solution with answer.

Assign 0 points for this thread.

wishes,
-Muthu
Easy to suggest when don't know about the problem!
Highlighted
Occasional Advisor

Re: while compiling c++ pgm how to make use of static libgcc instead of shared libgcc

Hi Muthukumar,

Thanks for ur wishes/encouragement. Ya i'll follow the rules.

Thanks,
Vijayalakshmi.
Highlighted
Occasional Advisor

Re: while compiling c++ pgm how to make use of static libgcc instead of shared libgcc

Found solution