Operating System - Linux
1751695 Members
4694 Online
108781 Solutions
New Discussion юеВ

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

 
SOLVED
Go to solution
Vijayalakshmi
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
Orhan Biyiklioglu
Respected Contributor
Solution

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

Arunvijai_4
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"
Vijayalakshmi
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.
Muthukumar_5
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!
Vijayalakshmi
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.
Vijayalakshmi
Occasional Advisor

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

Found solution