static linking

Laeeth Isharc via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Sat Jul 25 19:35:56 PDT 2015


On Sunday, 26 July 2015 at 01:05:46 UTC, Laeeth Isharc wrote:
> On Saturday, 25 July 2015 at 18:37:18 UTC, Daniel Kozak wrote:
>>
>> On Sat, 25 Jul 2015 18:02:46 +0000
>> Laeeth Isharc via Digitalmars-d-learn 
>> <digitalmars-d-learn at puremagic.com> wrote:
>>
>>> Hi.
>>> 
>>> Is static linking with dmd still broken on linux?  If so, can 
>>> I link statically with gdc or ldc, and if so how?
>>> 
>>> https://issues.dlang.org/show_bug.cgi?id=12268
>>> 
>>> 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 ?
>>> 
>>> Thanks.
>>> 
>>> 
>>> Laeeth.
>>
>> Do you mean dynamic linking?
>>
>> I do not have any problems with dmd.
>> Can you please post more details what you are trying?
>>
>> *.so are dynamic, *.[l]a are static
>
> I meant that I would prefer to link statically, and if that is 
> possible with dmd, what is the right command to pass to dmd and 
> the linker (64 bit linux, arch)?  If not, can I do so with gdc 
> and ldc, and what are the right commands?  And failing that, 
> which library files should I include if only dynamic linking 
> works.  The bug report seemed to suggest static linking might 
> not be possible with dmd, if I understand it correctly (which I 
> am not certain I do).
>
> It's not working currently, but the error message I get back 
> from AWS (I have to call via nodejs) is uninformative, and it 
> might also be because I am compiling on arch, and I think 
> amazon linux is closest to centos 6.
>
> AWS lambda seems a pretty cool idea.  I am not sure if it will 
> be much use for what I want to do, but it might do, and so I 
> wanted to play around with it a little.
>
> Thanks.
>
>
> Laeeth.

So dynamic linking works fine if I bundle the shared libraries 
with the zip (doable since the zip is only 3.3 Mb and limit is 
50), and it turns out arch doesn't provide statically linked 
system libraries as a matter of policy.  So that's good enough 
for now to experiment, I think.



More information about the Digitalmars-d-learn mailing list