Linker Errors: Can't Find libm.a and libc.a, "ld: fatal: library -lc: not found" (Doc ID 1004288.1)

Last updated on AUGUST 03, 2016

Applies to:

Oracle Solaris Studio - Version Forte Developer 6 Update 2 to 12.4 [Release 6.0 to 12]
Solaris Operating System - Version 10 3/05 to 11.2 [Release 10.0 to 11.0]
All Platforms

Symptoms

When linking statically, the linker cannot find static system libraries

$ cc -o hello -Bstatic hello.a -lm
ld: fatal: library -lm: not found
ld: fatal: library -lc: not found
ld: fatal: File processing errors. No output written to hello

 

$ /usr/sfw/bin/gcc -static hello_world.c
ld: fatal: library -lc: not found
ld: fatal: library -lc: not found
ld: fatal: File processing errors. No output written to a.out
collect2: ld returned 1 exit status

Cause

Sign In with your My Oracle Support account

Don't have a My Oracle Support account? Click to get started

My Oracle Support provides customers with access to over a
Million Knowledge Articles and hundreds of Community platforms