September 13, 2013
On Friday, 13 September 2013 at 13:36:45 UTC, Joseph Rushton Wakeling wrote:
> Tried it.  It reduces 12 MB executables to 11 MB -- but if I manually exclude the module responsible for the big data, executable sizes fall to 2 MB.

Then it is likely to be marked as referenced by something :( Can you try to reduce this case? Would be interesting to investigate.
September 13, 2013
On 13/09/13 15:36, Joseph Rushton Wakeling wrote:
> Tried it.  It reduces 12 MB executables to 11 MB -- but if I manually exclude
> the module responsible for the big data, executable sizes fall to 2 MB.

Sorry, I'm talking nonsense.  I managed to accidentally build using ldmd2, which was responsible for the small executable sizes.  The +10 MB executable size seems to be entirely down to gdc.

September 13, 2013
On 13 September 2013 14:42, Joseph Rushton Wakeling <joseph.wakeling@webdrake.net> wrote:
> On 13/09/13 15:36, Joseph Rushton Wakeling wrote:
>>
>> Tried it.  It reduces 12 MB executables to 11 MB -- but if I manually
>> exclude
>> the module responsible for the big data, executable sizes fall to 2 MB.
>
>
> Sorry, I'm talking nonsense.  I managed to accidentally build using ldmd2, which was responsible for the small executable sizes.  The +10 MB executable size seems to be entirely down to gdc.
>

I expect this is because the phobos/druntime libraries shipped with
dmd are (a) without debugging symbols and (b) stripped.

If you were to strip libphobos after installing gdc, then you would see a significant drop in size.

-- 
Iain Buclaw

*(p < e ? p++ : p) = (c & 0x0f) + '0';
September 13, 2013
On 13 September 2013 16:24, Iain Buclaw <ibuclaw@ubuntu.com> wrote:
> On 13 September 2013 14:42, Joseph Rushton Wakeling <joseph.wakeling@webdrake.net> wrote:
>> On 13/09/13 15:36, Joseph Rushton Wakeling wrote:
>>>
>>> Tried it.  It reduces 12 MB executables to 11 MB -- but if I manually
>>> exclude
>>> the module responsible for the big data, executable sizes fall to 2 MB.
>>
>>
>> Sorry, I'm talking nonsense.  I managed to accidentally build using ldmd2, which was responsible for the small executable sizes.  The +10 MB executable size seems to be entirely down to gdc.
>>
>
> I expect this is because the phobos/druntime libraries shipped with
> dmd are (a) without debugging symbols and (b) stripped.
>
> If you were to strip libphobos after installing gdc, then you would see a significant drop in size.
>

In this way, I'd also expect those who build gdc from source would have large executables than those who install gdc through a package manager/installer.


-- 
Iain Buclaw

*(p < e ? p++ : p) = (c & 0x0f) + '0';
September 13, 2013
On 13/09/13 17:24, Iain Buclaw wrote:
> I expect this is because the phobos/druntime libraries shipped with
> dmd are (a) without debugging symbols and (b) stripped.
>
> If you were to strip libphobos after installing gdc, then you would
> see a significant drop in size.

Could be.  I do build with the --enable-checking=release option, what else do I need to do ... ?

September 13, 2013
Am Fri, 13 Sep 2013 18:10:24 +0200
schrieb Joseph Rushton Wakeling <joseph.wakeling@webdrake.net>:

> On 13/09/13 17:24, Iain Buclaw wrote:
> > I expect this is because the phobos/druntime libraries shipped with
> > dmd are (a) without debugging symbols and (b) stripped.
> >
> > If you were to strip libphobos after installing gdc, then you would see a significant drop in size.
> 
> Could be.  I do build with the --enable-checking=release option, what else do I need to do ... ?
> 

Use
make install-strip
instead of "make install"
September 13, 2013
Am Fri, 13 Sep 2013 16:25:47 +0100
schrieb Iain Buclaw <ibuclaw@ubuntu.com>:

> On 13 September 2013 16:24, Iain Buclaw <ibuclaw@ubuntu.com> wrote:
> 
> In this way, I'd also expect those who build gdc from source would have large executables than those who install gdc through a package manager/installer.

The example from the original post is still valid though. Even with a stripped libphobos the executable produced by gdc is almost twice as big.

ls -lh /usr/lib | grep phobos
-rw-r--r-- 1 root root   18M  7. Sep 03:15 libgphobos2.a
-rw-r--r-- 1 root root   12M  7. Sep 03:42 liblphobos.a
-rw-r--r-- 1 root root   13M  7. Sep 03:42 liblphobos-debug.a
-rw-r--r-- 1 root root   30M 25. Aug 19:08 libphobos2.a


September 13, 2013
On 13/09/13 18:30, Johannes Pfau wrote:
> Use
> make install-strip
> instead of "make install"

Hmm, well, I just reinstalled GDC using make install-strip, rebuilt the programs in question and they're still coming out as 12 MB ...

Could it be static vs. shared druntime/Phobos?

September 13, 2013
On Sep 13, 2013 5:41 PM, "Joseph Rushton Wakeling" < joseph.wakeling@webdrake.net> wrote:
>
> On 13/09/13 18:30, Johannes Pfau wrote:
>>
>> Use
>> make install-strip
>> instead of "make install"
>
>
> Hmm, well, I just reinstalled GDC using make install-strip, rebuilt the
programs in question and they're still coming out as 12 MB ...
>
> Could it be static vs. shared druntime/Phobos?
>

Can you check if it in fact strips binaries? (you can check with 'file')

Regards
-- 
Iain Buclaw

*(p < e ? p++ : p) = (c & 0x0f) + '0';


September 13, 2013
On 13/09/13 19:22, Iain Buclaw wrote:
> Can you check if it in fact strips binaries? (you can check with 'file')

bin/gdc:             ELF 64-bit LSB executable, x86-64, version 1 (SYSV), dynamically linked (uses shared libs), for GNU/Linux 2.6.24, stripped
lib64/libgphobos2.a: current ar archive

libgphobos2.a is 72 MB in size, while LDC breaks Phobos up into 2 parts, libphobos-ldc.a (20 MB) and libphobos-ldc-debug.a (33 MB).