[Issue 6952] New: Static Linking on Linux
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Tue Nov 15 09:08:49 PST 2011
http://d.puremagic.com/issues/show_bug.cgi?id=6952
Summary: Static Linking on Linux
Product: D
Version: D2
Platform: Other
OS/Version: Windows
Status: NEW
Severity: normal
Priority: P2
Component: DMD
AssignedTo: nobody at puremagic.com
ReportedBy: dsimcha at yahoo.com
--- Comment #0 from David Simcha <dsimcha at yahoo.com> 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.
hello.d:
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
Works:
hello.c:
#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: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
More information about the Digitalmars-d-bugs
mailing list