Ask Ubuntu is a question and answer site for Ubuntu users and developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I am attempting to compile a program with g77 and I keep getting the following error:

/usr/bin/ld: cannot find -lgcc_s
collect2: ld returned 1 exit status

I saw on another forum that this is related to libgcc, when looking for libgcc I get

>find /usr/ -name libgcc*

share|improve this question
I've tried exporting the path to /usr/lib/gcc/x86_64-linux-gnu/3.4.6, /usr/lib/gcc/x86_64-linux-gnu/4.6, and /usr/lib, but no luck. Any ideas? – Biz Sep 16 '13 at 20:00
Try sudo apt-get install ia32-libs – Mitch Sep 17 '13 at 5:42

This is because although libgcc is present, it may not be not in the paths known to ldconfig. Check this by doing

sudo /sbin/ldconfig -p | grep libgcc

Does the output show that the is link to libgcc corresponds to paths that you have listed above?

A work around for you may be to add the link to the relevant library to your compile command e.g.

g++ program.cpp -L /usr/lib/gcc/x86_64-linux-gnu/4.6/

Another may be to create a symbolic link to the library yourself.

 ln -s /usr/lib/gcc/x86_64-linux-gnu/4.6/ /usr/lib/gcc/
share|improve this answer
In response to 'sudo /sbin/ldconfig -p | grep libgcc' I got ' (libc6,x86-64) => /usr/lib/ (libc6,x86-64) => /lib/x86_64-linux-gnu/'. Tried with those paths, but no luck. tried with symbolic link but no luck with that either. – Biz Sep 16 '13 at 23:41
Also, I'm using g77 to compile – Biz Sep 17 '13 at 2:58

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.