Linux: How to statically link against system libs?

Jonathan M Davis jmdavisProg at gmx.com
Tue Apr 26 11:49:56 PDT 2011


> 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

http://d.puremagic.com/issues/show_bug.cgi?id=4376

You're stuck, linking manually with gcc, which means copying all of the 
appropriate linker flags from dmd.conf. It also means that you don't get 
symbols in your stack traces for some reason (I've never been able to figure 
out why). It does work though. Still, I'd love it if this bug could be fixed. 
I hate dynamically linking anything if I can help it.

- Jonathan M Davis


More information about the Digitalmars-d-learn mailing list