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

Paul S Card pscard at upd.co.za
Thu Oct 27 03:57:16 CDT 2005


There is no static executable support on sparcv9 architecture (64 bit). You
must compile as a 32 bit executable

Eg on solaris 9

devbox # gcc -m64 -static hello.c -ohello64s
ld: fatal: library -lc: not found
ld: fatal: library -lc: not found
ld: fatal: File processing errors. No output written to hello64s
collect2: ld returned 1 exit status
devbox # gcc -m32 -static hello.c -ohello32s
devbox # file hello32s
hello32s:       ELF 32-bit MSB executable SPARC Version 1, statically
linked, not stripped 

-----Original Message-----
From: sunhelp-bounces at sunhelp.org [mailto:sunhelp-bounces at sunhelp.org] On
Behalf Of fabio
Sent: 27 October 2005 02:59 AM
To: The SunHELP List
Subject: Re: [SunHELP] Unable to ' -static' compile programs with gcc

Sandwich Maker wrote:

>" From: fabio <fabio at crearium.com>
>" 
>" Sandwich Maker wrote:
>" 
>" >" 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.
>" >
>" >
>" I dont understand, we cant build static binaries in Solaris sparc ?
>
>not any more.
>
>" Any workaround?
>
>build in an earlier solaris environmant that still supports static.  i 
>posted that in my first reply.
>  
>
Would you or anyone in the list to explain what are the steps to statically
build a C program on Solaris 10? If it is only possible building a 'ealier
solaris environment', what is exactly that and how to do it?

fabio.
_______________________________________________
SunHELP maillist  -  SunHELP at sunhelp.org
http://www.sunhelp.org/mailman/listinfo/sunhelp



More information about the SunHELP mailing list