1

I am trying to compile simple C code on my system. I am running gcc version (4.9.2) on macOS 10.11.6.

ld: library not found for -lgcc
collect2: error: ld returned 1 exit status

I am unable to fix this issue. This problem is not letting me install any ./configure packages as well since they require gcc to work.

clemens
  • 16,716
  • 11
  • 50
  • 65
learner
  • 288
  • 2
  • 16

1 Answers1

1

Even if there is a program called gcc under macOS, it is not a real gcc compiler. It is just a Clang compiler, as you can prove easily:

gcc --version

will print:

Configured with: --prefix=/Applications/Xcode.app/Contents/Developer/usr --with-gxx-include-dir=/usr/include/c++/4.2.1
Apple LLVM version 9.0.0 (clang-900.0.39.2)
Target: x86_64-apple-darwin17.4.0
Thread model: posix
InstalledDir: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin

You should be able to compile and link your program by omitting the -lgcc flag from the command line.

clemens
  • 16,716
  • 11
  • 50
  • 65