static linking

Laeeth Isharc via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Sun Jul 26 08:19:03 PDT 2015


On Sunday, 26 July 2015 at 05:22:14 UTC, Martin Nowak wrote:
> On Saturday, 25 July 2015 at 18:02:48 UTC, Laeeth Isharc wrote:
>> I am trying to compile a D binary to run on AWS lambda.  If I 
>> cannot link statically, which files should I include in the 
>> zip upload - libphobos2.so, libdruntime-linux64so.o ?
>
> I think dicebot who maitains the arch linux package change dmd 
> to dynamically link with phobos by default (we don't yet do 
> that on any other platform).
> You should be able to link statically using -L-l:libphobos2.a 
> or -defaultlib=libphobos2.a.

Thanks, Martin.  I appreciate your time.  I guess I was mixing up 
two things - total static linking so the executable doesn't 
depend on normal libraries, versus static linking with phobos and 
friends only.  The former is trickier on arch in particular (not 
related to Dicebot's choice) because they don't distributed 
static versions of library files as a matter of policy.  But it's 
really the latter that I would need to do, and I think what you 
suggest will do the job.

How do I do the same on gdc and ldc ?  Since running times may be 
a matter of seconds, speed and startup time counts especially for 
lambda.  Probably starting via nodejs is an unnecessary tax, but 
I guess they will get rid of that requirement in time.


More information about the Digitalmars-d-learn mailing list