[SunHELP] Unable to ' -static' compile programs with gcc

Sandwich Maker adh at an.bradford.ma.us
Wed Oct 26 09:43:55 CDT 2005

" From: fabio <fabio at crearium.com>
" hello,
" -bash-3.00$ cat 1.c;\gcc -static -ggdb 1.c -o 1
" main(){
"       printf("hello world\n");
" }
" ld: fatal: library -lc: not found
" ld: fatal: library -lc: not found
" ld: fatal: File processing errors. No output written to 1
" collect2: ld returned 1 exit status
" -bash-3.00$ find / -name "libc.so.1" -print 2>/dev/null
" /usr/lib/sparcv9/libc.so.1
" /usr/lib/libc.so.1
" /usr/lib/libp/libc.so.1
" /usr/lib/libp/sparcv9/libc.so.1
" /lib/sparcv9/libc.so.1
" /lib/libc.so.1

these are dynamic; static would be libc.a

" -bash-3.00$ uname -srm
" SunOS 5.10 sun4u
" The option -g works fine but I need the option ggdb. Option -static 
" doesnt work either. But It compiles ok if no option is given.

sun's position on late-model solarii is that static binaries and
static linking are passe'.  unless gcc comes with its own libc you're
out of luck.  i don't think sun's forte compiler comes with static
libs either.

just checked my system, solaris 8.  it has static libs; even bsdcompat
libs.  if you really need a static binary you could either set up a s8
system or try something i've long had in mind: install s8 [libs,
headers, compiler etc. - everything] in a chrooted jail under s10 and
try compiling there.  the static s8 bin would of course still run under
s10, unless it requires something unusual.
Andrew Hay                                  the genius nature
internet rambler                            is to see what all have seen
adh at an.bradford.ma.us                       and think what none thought

More information about the SunHELP mailing list