goinsu - Switch user, group and execute a program - a tiny betterC program

Anton Fediushin fediushin.anton at yandex.ru
Wed Sep 27 20:30:16 UTC 2017


On Wednesday, 27 September 2017 at 12:49:16 UTC, jamonahn wrote:
> On Saturday, 16 September 2017 at 19:56:14 UTC, Anton Fediushin 
> wrote:
>> Hey-hey-hey, I am so excited to announce a brand-new program I 
>> just wrote: goinsu!
>
> Just built on my Raspberry Pi 3.  Kudos - very fast, not even a 
> warning!  Now to get some Docker images and go crazy.

Hooray!

>
> BTW, I got a 14,116 byte executable image with LDC but 
> 1,958,892 with GDC.  The GDC image (stripped) is 324,492.  I 
> installed reggae on my laptop (debian) and did a "reggae 
> --export".  Then using make (with ldc2) I got image of 13,088.  
> Using "dub -b release --compiler=ldc2" (same build as on 
> Raspbian) I get image of 381,928.

Reggae builds goinsu in betterC mode, which removes dependency on 
the druntime and phobos.

Dub can also build betterC programs, but I decided not to add 
such flag to dub.json, because betterC is a new thing which can 
cause problems.

LDC and GDC could have very limited betterC support, so results 
may vary.

> How do I do a static linkage using LDC?  I need a static 
> because I want to try and run this with an Alpine (arm) Docker 
> image and Alpine is using muslib-c.  I once built an Alpine 
> Docker image by hand that built ldc, but it couldn't survive D 
> version/Alpine Os updates.

You don't have to compile LDC for this. It is possible to compile 
a static musl and link it together with the goinsu. Take a look 
at `.travis.yml`, since this is exactly what I am doing to build 
releases.

Also, do not forget the `errnofix.c`, which is important for 
static linking.

Reggae does this automatically, you just have to specify static 
libc you want to link to. Maybe it won't work for RPi though.

I've ordered Raspberry Pi recently, so as soon as I get it I can 
start hacking on it as well)

>
> Thank you so much for this tool!

You're welcome!




More information about the Digitalmars-d-announce mailing list