The D ecosystem in Debian with free-as-in-freedom DMD
Marco Leise via Digitalmars-d
digitalmars-d at puremagic.com
Wed May 3 11:18:26 PDT 2017
Am Wed, 03 May 2017 01:02:38 +0000
schrieb Moritz Maxeiner <moritz at ucworks.org>:
> On Tuesday, 2 May 2017 at 23:27:28 UTC, Marco Leise wrote:
> > Am Tue, 02 May 2017 20:53:50 +0000
> > schrieb Moritz Maxeiner <moritz at ucworks.org>:
> >
> >> On Tuesday, 2 May 2017 at 19:34:44 UTC, Marco Leise wrote:
> >> >
> >> > I see what you're doing there, but your last point is
> >> > wishful thinking. Dynamically linked binaries can share
> >> > megabytes of code. Even Phobos - although heavily templated
> >> > - has proven to be very amenable to sharing. For example, a
> >> > "Hello world!" program using `writeln()` has these sizes
> >> > when compiled with `dmd -O -release -inline`:
> >> >
> >> > static Phobos2 : 806968 bytes
> >> > dynamic Phobos2 : 18552 bytes
> >> >
> >> > That's about 770 KiB to share or 97.7% of its total size!
> >> > Awesome!
> >>
> >> Is all of that active code, or is some of that (statically
> >> knowable) never getting executed (as in could've been removed
> >> at compile/link time)?
> >
> > I guess David gave you the answer. So it's just 95.4% of its
> > total size. :p
>
> Under the assumption that ldc2 produces no dead code in the
> output; is that a reasonable assumption (I'm not sure)?
>
> > By the way, is the fully dynamic linking version possible with
> > ldc2 now as well ?
>
> I did have a modified ebuild to try that out a while back and it
> seemed to work fine in my limited testing scope. Since I quite
> often change installed d compilers and don't want my programs
> (like tilix) to stop working (or have old d compiler versions
> being kept installed *just* because some programs were built with
> them), I generally link against phobos statically, anyway, so I
> my tests weren't exhaustive. The cmake flag to to use in the
> ebuild would be BUILD_SHARED [1].
>
> [1]
> https://github.com/ldc-developers/ldc/blob/v1.2.0/CMakeLists.txt#L522
I remember seeing this line and thinking "aww .. no way to
build both versions?". I.e. enable the "static-libs" USE flag
to _also_ build static libraries accompanying the shared ones.
I'll create an issue asking about that.
--
Marco
More information about the Digitalmars-d
mailing list