Summary: Static Linking on Linux
           Product: D
           Version: D2
          Platform: Other
        OS/Version: Windows
            Status: NEW
          Severity: normal
          Priority: P2
         Component: DMD

--- Comment #0 from David Simcha <> 2011-11-15 09:08:02 PST ---
It seems that the stuff that DMD outputs to GCC on Linux is misconfigured for
static linking.  I've observed this on several machines with various Linux
distros, all of which can statically link a C hello world program successfully
with the machine's GCC install.


import std.stdio;

void main() {
    write("Hello, world\n");

$ dmd -L-static hello.d
/usr/bin/ld: cannot find -lgcc_s
collect2: ld returned 1 exit status
--- errorlevel 1

Yet somehow when I compile/link a C hello world on the same machine it Just


#include <stdio.h>

int main() {
    printf("Hello, world.\n");
    return 0;

$ gcc -o hello -static hello.c
$ ./hello
Hello, world.
$ file hello
hello: ELF 64-bit LSB executable, x86-64, version 1 (GNU/Linux), statically
linked, for GNU/Linux 2.6.15, not stripped

Configure issuemail:
------- You are receiving this mail because: -------

Reply via email to