[Issue 4376] New: Cannot build static binaries; running dmd with flag -L-static fails to compile
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Wed Jun 23 11:35:37 PDT 2010
http://d.puremagic.com/issues/show_bug.cgi?id=4376
Summary: Cannot build static binaries; running dmd with flag
-L-static fails to compile
Product: D
Version: 2.041
Platform: Other
OS/Version: Linux
Status: NEW
Severity: normal
Priority: P2
Component: DMD
AssignedTo: nobody at puremagic.com
ReportedBy: jmdavisProg at gmail.com
--- Comment #0 from Jonathan M Davis <jmdavisProg at gmail.com> 2010-06-23 11:35:33 PDT ---
I would like to be able to generate binaries that don't depend on any external
libraries whatsoever. In linux at least, when dmd creates a program normally,
the resulting binary depends on various system libraries. For instance, hello
world ends up with these dependencies per ldd:
linux-gate.so.1 => (0xb783b000)
libpthread.so.0 => /lib/libpthread.so.0 (0xb77fd000)
libm.so.6 => /lib/libm.so.6 (0xb77d8000)
libc.so.6 => /lib/libc.so.6 (0xb768c000)
/lib/ld-linux.so.2 (0xb783c00
Want I want, is for ldd to say
not a dynamic executable
The way to get this happen normally is to give gcc the linker flag -static. If
I compile object files with dmd and then link with gcc using -static, then I
can get a static binary. However, if I try and both build and link with dmd, it
fails. If I run
dmd prog.d -L-static
(which as I understand it, is passes the -static flag on to gcc for the linking
phase), I get the error
/usr/bin/ld: cannot find -lgcc_s
collect2: ld returned 1 exit status
--- errorlevel 1
Why having dmd use gcc to do the linking instead of my doing it directly fails
to work, I don't know, but it's rather annoying. I shouldn't have to do the
linking myself to get a static binary.
--
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