Linux: How to statically link against system libs?

Spacen Jasset spacenjasset at yahoo.co.uk
Tue Apr 26 12:41:44 PDT 2011


On 26/04/2011 19:09, Nick Sabalausky wrote:
> On Linux, how do I get DMD to statically link against the necessary system
> libs like libc?
>
> Someone suggested trying -L-static, but that just gives me this:
>
> /usr/bin/ld: cannot find -lgcc_s
> collect2: ld returned 1 exit status
> --- errorlevel 1
>
>
As I suggest in the other thread you probably shouldn't ever do it. In 
the same way you shouldn't (and can't) statically link to kernel32 on 
windows.

I forget exactly, but you could try this, don't put any extra -L or 
anything, like you appear to have above.

-static  -static-libgcc

it's possible perhaps that you don't have the static libgcc installed on 
your system, seems a bit unlikely, though.



More information about the Digitalmars-d-learn mailing list