digitalmars.D.bugs - [Issue 4376] New: Cannot build static binaries; running dmd with flag -L-static fails to compile
- d-bugmail puremagic.com (41/41) Jun 23 2010 http://d.puremagic.com/issues/show_bug.cgi?id=4376
- d-bugmail puremagic.com (13/13) Nov 16 2011 http://d.puremagic.com/issues/show_bug.cgi?id=4376
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 puremagic.com ReportedBy: jmdavisProg gmail.com 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: -------
Jun 23 2010
http://d.puremagic.com/issues/show_bug.cgi?id=4376 Steven Schveighoffer <schveiguy yahoo.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |RESOLVED CC| |schveiguy yahoo.com Resolution| |DUPLICATE 05:26:34 PST --- Marking as duplicate of later bug, because there is more information there. *** This issue has been marked as a duplicate of issue 6952 *** -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Nov 16 2011