Thread overview
How to reduce executable filesize
Jul 16
kinke
Jul 21
kinke
July 12
Hi,
If I remember correctly on linux (ubuntu) you can compile an executable which uses and DRuntime as shared objects.

How is the ldc2 command for this?
I assume I can find the shared objects for phobos and DRuntime in the ldc2 linux x86_64 release archive?

Is there also an additional argument to strip any non used symbols?

Kind regards
Andre
July 12
On Friday, 12 July 2019 at 16:37:05 UTC, Andre Pany wrote:
> Hi,
> If I remember correctly on linux (ubuntu) you can compile an executable which uses and DRuntime as shared objects.
>
> How is the ldc2 command for this?
> I assume I can find the shared objects for phobos and DRuntime in the ldc2 linux x86_64 release archive?
>
> Is there also an additional argument to strip any non used symbols?
>
> Kind regards
> Andre

Should read ...which uses Phobos and DRuntime as shared...
July 12
On Friday, 12 July 2019 at 16:42:06 UTC, Andre Pany wrote:
> On Friday, 12 July 2019 at 16:37:05 UTC, Andre Pany wrote:
>> Hi,
>> If I remember correctly on linux (ubuntu) you can compile an executable which uses and DRuntime as shared objects.
>>
>> How is the ldc2 command for this?
>> I assume I can find the shared objects for phobos and DRuntime in the ldc2 linux x86_64 release archive?
>>
>> Is there also an additional argument to strip any non used symbols?
>>
>> Kind regards
>> Andre
>
> Should read ...which uses Phobos and DRuntime as shared...

I found it:

ldc2 app.d -defaultlib=druntime-ldc-shared,phobos2-ldc-shared -debuglib=druntime-ldc-debug-shared,phobos2-ldc-debug-shared

Kind regards
Andre

July 16
On Friday, 12 July 2019 at 22:22:01 UTC, Andre Pany wrote:
> I found it:
>
> ldc2 app.d -defaultlib=druntime-ldc-shared,phobos2-ldc-shared -debuglib=druntime-ldc-debug-shared,phobos2-ldc-debug-shared

`-link-defaultlib-shared` implies that and takes care of rpath as well.
July 19
On Tuesday, 16 July 2019 at 10:30:50 UTC, kinke wrote:
> On Friday, 12 July 2019 at 22:22:01 UTC, Andre Pany wrote:
>> I found it:
>>
>> ldc2 app.d -defaultlib=druntime-ldc-shared,phobos2-ldc-shared -debuglib=druntime-ldc-debug-shared,phobos2-ldc-debug-shared
>
> `-link-defaultlib-shared` implies that and takes care of rpath as well.

Thanks a lot. Is it also easily possible to compile an
application with DRuntime statically linked and completely
without Phobos?

Kind regards
André
July 21
On Friday, 19 July 2019 at 11:28:26 UTC, Andre Pany wrote:
> Is it also easily possible to compile an
> application with DRuntime statically linked and completely
> without Phobos?

Sure, that's `-defaultlib=druntime-ldc`.
July 22
On Sunday, 21 July 2019 at 21:59:06 UTC, kinke wrote:
> On Friday, 19 July 2019 at 11:28:26 UTC, Andre Pany wrote:
>> Is it also easily possible to compile an
>> application with DRuntime statically linked and completely
>> without Phobos?
>
> Sure, that's `-defaultlib=druntime-ldc`.

Thanks again:)

Kind regards
Andre
July 29
On Friday, 12 July 2019 at 16:37:05 UTC, Andre Pany wrote:
> Hi,
> If I remember correctly on linux (ubuntu) you can compile an executable which uses and DRuntime as shared objects.
>
> How is the ldc2 command for this?
> I assume I can find the shared objects for phobos and DRuntime in the ldc2 linux x86_64 release archive?
>
> Is there also an additional argument to strip any non used symbols?
>
> Kind regards
> Andre

If you want to make more compression, then do it with UPX. The complete order of make extremelly compression are: strip.exe. UPX.
...
Using upx should be sufficient to reduce (compress) size of executable file.
Download and extract upx.
Select the files you want to compress.
Click Start compression
Exact steps are here:
https://docsbay.net/upx-how-to-reduce-executable-files-size