How to compile static binaries?

DMD 2.60 on Ubuntu 12.04 ... I want to create a static binary so that I can run it in the old environment. dmd does not have a "-static" flag. I tried passing the "-static" flag to the linker with "dmd -L-static ..." - get an error message

/usr/bin/ld: cannot find -lgcc_s

Compiling C code with "gcc -static ..." works fine. Did I miss something? Thank!

+5
source share
1 answer

Currently, it does not work if you use dmd for reference due to the way it passes linker flags to linker. You need to build everything using -cto create object files and then link them manually using gcc or ld.

, glibc . , ( , ). , , , , .

+3

All Articles