September 13, 2013
On 13 September 2013 18:28, Joseph Rushton Wakeling <joseph.wakeling@webdrake.net> wrote:
> 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).

du -h lib64/libgphobos2.a
73M    lib64/libgphobos2.a

strip --strip-unneeded  lib64/libgphobos2.a

du -h lib64/libgphobos2.a
18M    lib64/libgphobos2.a


-- 
Iain Buclaw

*(p < e ? p++ : p) = (c & 0x0f) + '0';
September 13, 2013
On 13/09/13 20:09, Iain Buclaw wrote:
> du -h lib64/libgphobos2.a
> 73M    lib64/libgphobos2.a
>
> strip --strip-unneeded  lib64/libgphobos2.a
>
> du -h lib64/libgphobos2.a
> 18M    lib64/libgphobos2.a

Ahh, OK.

Is there any way in which to ensure that the build splits Phobos up into library and debugging symbols à la LDC?  Could be useful, no?

September 15, 2013
On Friday, 13 September 2013 at 18:09:15 UTC, Iain Buclaw wrote:
> du -h lib64/libgphobos2.a
> 73M    lib64/libgphobos2.a
>
> strip --strip-unneeded  lib64/libgphobos2.a
>
> du -h lib64/libgphobos2.a
> 18M    lib64/libgphobos2.a

Well, looks like you have just found a bug in default Arch Linux makepkg.conf :) It does only "--strip-debug" for static libraries (for unknown reasons I am trying to figure out).

Thanks :)
September 15, 2013
On 15 September 2013 20:46, Dicebot <public@dicebot.lv> wrote:
> On Friday, 13 September 2013 at 18:09:15 UTC, Iain Buclaw wrote:
>>
>> du -h lib64/libgphobos2.a
>> 73M    lib64/libgphobos2.a
>>
>> strip --strip-unneeded  lib64/libgphobos2.a
>>
>> du -h lib64/libgphobos2.a
>> 18M    lib64/libgphobos2.a
>
>
> Well, looks like you have just found a bug in default Arch Linux makepkg.conf :) It does only "--strip-debug" for static libraries (for unknown reasons I am trying to figure out).
>
> Thanks :)

--strip-debug should do the trick as well...  --strip-unneeded probably isn't recommended for libraries. ;)

-- 
Iain Buclaw

*(p < e ? p++ : p) = (c & 0x0f) + '0';
September 15, 2013
On Sunday, 15 September 2013 at 19:59:48 UTC, Iain Buclaw wrote:
> On 15 September 2013 20:46, Dicebot <public@dicebot.lv> wrote:
>> On Friday, 13 September 2013 at 18:09:15 UTC, Iain Buclaw wrote:
>>>
>>> du -h lib64/libgphobos2.a
>>> 73M    lib64/libgphobos2.a
>>>
>>> strip --strip-unneeded  lib64/libgphobos2.a
>>>
>>> du -h lib64/libgphobos2.a
>>> 18M    lib64/libgphobos2.a
>>
>>
>> Well, looks like you have just found a bug in default Arch Linux
>> makepkg.conf :) It does only "--strip-debug" for static libraries (for
>> unknown reasons I am trying to figure out).
>>
>> Thanks :)
>
> --strip-debug should do the trick as well...  --strip-unneeded
> probably isn't recommended for libraries. ;)

Well, with --strip-debug it is back to the original situation in the very first comment, numbers there are with --strip-debug (what is the potential danger with --strip-unneeded?)
September 15, 2013
On 15 September 2013 21:02, Dicebot <public@dicebot.lv> wrote:
> On Sunday, 15 September 2013 at 19:59:48 UTC, Iain Buclaw wrote:
>>
>> On 15 September 2013 20:46, Dicebot <public@dicebot.lv> wrote:
>>>
>>> On Friday, 13 September 2013 at 18:09:15 UTC, Iain Buclaw wrote:
>>>>
>>>>
>>>> du -h lib64/libgphobos2.a
>>>> 73M    lib64/libgphobos2.a
>>>>
>>>> strip --strip-unneeded  lib64/libgphobos2.a
>>>>
>>>> du -h lib64/libgphobos2.a
>>>> 18M    lib64/libgphobos2.a
>>>
>>>
>>>
>>> Well, looks like you have just found a bug in default Arch Linux makepkg.conf :) It does only "--strip-debug" for static libraries (for unknown reasons I am trying to figure out).
>>>
>>> Thanks :)
>>
>>
>> --strip-debug should do the trick as well...  --strip-unneeded probably isn't recommended for libraries. ;)
>
>
> Well, with --strip-debug it is back to the original situation in the very first comment, numbers there are with --strip-debug (what is the potential danger with --strip-unneeded?)

--strip-unneeded could potentially cause lots of undefined reference errors on static libraries.  Shared libraries don't suffer this because symbols are put into a special section which strip knows not to touch.

General rule of them:

binaries: strip <file>
static libraries: strip --strip-debug <file>
shared libraries: strip --strip-unneeded <file>

-- 
Iain Buclaw

*(p < e ? p++ : p) = (c & 0x0f) + '0';
September 15, 2013
On Sunday, 15 September 2013 at 21:05:18 UTC, Iain Buclaw wrote:
> --strip-unneeded could potentially cause lots of undefined reference
> errors on static libraries.  Shared libraries don't suffer this
> because symbols are put into a special section which strip knows not
> to touch.
>
> General rule of them:
>
> binaries: strip <file>
> static libraries: strip --strip-debug <file>
> shared libraries: strip --strip-unneeded <file>

Ok, thanks.

What may cause twice the difference in the original post then? :)
September 15, 2013
On 15 September 2013 22:05, Iain Buclaw <ibuclaw@ubuntu.com> wrote:
> On 15 September 2013 21:02, Dicebot <public@dicebot.lv> wrote:
>> On Sunday, 15 September 2013 at 19:59:48 UTC, Iain Buclaw wrote:
>>>
>>> On 15 September 2013 20:46, Dicebot <public@dicebot.lv> wrote:
>>>>
>>>> On Friday, 13 September 2013 at 18:09:15 UTC, Iain Buclaw wrote:
>>>>>
>>>>>
>>>>> du -h lib64/libgphobos2.a
>>>>> 73M    lib64/libgphobos2.a
>>>>>
>>>>> strip --strip-unneeded  lib64/libgphobos2.a
>>>>>
>>>>> du -h lib64/libgphobos2.a
>>>>> 18M    lib64/libgphobos2.a
>>>>
>>>>
>>>>
>>>> Well, looks like you have just found a bug in default Arch Linux makepkg.conf :) It does only "--strip-debug" for static libraries (for unknown reasons I am trying to figure out).
>>>>
>>>> Thanks :)
>>>
>>>
>>> --strip-debug should do the trick as well...  --strip-unneeded probably isn't recommended for libraries. ;)
>>
>>
>> Well, with --strip-debug it is back to the original situation in the very first comment, numbers there are with --strip-debug (what is the potential danger with --strip-unneeded?)
>
> --strip-unneeded could potentially cause lots of undefined reference errors on static libraries.  Shared libraries don't suffer this because symbols are put into a special section which strip knows not to touch.
>

Just tested on my system,

original size = 74240.
strip-debug size = 17800.
strip-unneeded size = 17448.

So --strip-debug should is sufficient in reducing binary sizes.

-- 
Iain Buclaw

*(p < e ? p++ : p) = (c & 0x0f) + '0';
September 15, 2013
On 15 September 2013 22:07, Dicebot <public@dicebot.lv> wrote:
> On Sunday, 15 September 2013 at 21:05:18 UTC, Iain Buclaw wrote:
>>
>> --strip-unneeded could potentially cause lots of undefined reference errors on static libraries.  Shared libraries don't suffer this because symbols are put into a special section which strip knows not to touch.
>>
>> General rule of them:
>>
>> binaries: strip <file>
>> static libraries: strip --strip-debug <file>
>> shared libraries: strip --strip-unneeded <file>
>
>
> Ok, thanks.
>
> What may cause twice the difference in the original post then? :)

As per my initial post, strip not being ran on the library after installation. :-)

The makefile for libphobos/libdruntime certainly doesn't strip the libraries for you when you make strip-install.  At least not yet...

-- 
Iain Buclaw

*(p < e ? p++ : p) = (c & 0x0f) + '0';
September 15, 2013
On Friday, 13 September 2013 at 19:48:12 UTC, Joseph Rushton Wakeling wrote:
> Is there any way in which to ensure that the build splits Phobos up into library and debugging symbols à la LDC?  Could be useful, no?

LDC does not strip the library into a release build and debugging symbols (yet) – the '-debug' version just contains a debug build (i.e. with assertions and debug info enabled) of the standard library.

Whether this is the best idea going forward can certainly be discussed (considering that the user most probably doesn't expect to get a non-optimized build of the standard library when using -g).

David