My Oracle Support Banner

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

Last updated on OCTOBER 24, 2023

Applies to:

Oracle Solaris Studio - Version Forte Developer 6 Update 2 to 12.6 [Release 6.0 to 12]
Solaris Operating System - Version 10 to 11.4 [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

To view full details, 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 a vibrant support community of peers and Oracle experts.